[
  {
    "path": ".dockerignore",
    "content": "*\n\n!/src\n!/composer.json\n!/ecs.php\n!/phpstan.neon\n!/phpstan-baseline.neon\n!/phpunit.xml.dist\n!/psalm.xml\n!/rector.php\n!/tests\n"
  },
  {
    "path": ".gitattributes",
    "content": "/.gitbook.yaml export-ignore\n/.gitattributes export-ignore\n/.github export-ignore\n/.gitignore export-ignore\n/.php_cs.dist export-ignore\n/docker-compose.yml export-ignore\n/Dockerfile export-ignore\n/ecs.php export-ignore\n/Makefile export-ignore\n/phpstan.neon export-ignore\n/phpstan-baseline.neon export-ignore\n/phpunit.xml.dist export-ignore\n/psalm.xml export-ignore\n/rector.php\n/src/Component/legacy/tests export-ignore\n/src/Component/tests export-ignore\n/src/Component/phpunit.xml.dist export-ignore\n/tests export-ignore\n"
  },
  {
    "path": ".gitbook.yaml",
    "content": "root: ./docs/\n"
  },
  {
    "path": ".github/CODEOWNERS",
    "content": "* @Sylius/core-team\n"
  },
  {
    "path": ".github/CONTRIBUTING.md",
    "content": "Contributing Patches and BDD Methodology\n========================================\n\nSylius is a Open Source project driven by the community. \nJoin our amazing adventure and we promise to be nice and welcoming to everyone. \nRemember, you do not have to be a Symfony guru or even a programmer to help!\n\nYou can learn [how to contribute the patches](http://docs.sylius.com/en/latest/contributing/code/patches.html)\nin our [Contributing Guide](http://docs.sylius.com/en/latest/contributing/index.html).\n\nSecurity Issues\n---------------\n\nWe treat security very seriously, you can read about security procedures [here](http://docs.sylius.com/en/latest/contributing/code/security.html).\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug-report.md",
    "content": "---\nname: \"Bug Report 🐛\"\nabout: Report a problem or error\n\n---\n\n\n**Sylius version affected**: 1.x.y\n\n**Description**  \n<!-- A clear and concise description of the bug you are experiencing. -->\n\n**Steps to reproduce**  \n<!-- Code and/or configuration required to reproduce the bug. -->\n\n**Possible Solution**  \n<!--- Optional: if you have any suggestions on a fix/reason for the bug -->\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/documentation-issue.md",
    "content": "---\nname: \"Documentation Issue 📖\"\nabout: Report missing or bugged documentation\n\n---\n\n**Sylius docs version**: 1.x / latest\n\n**Description**\n<!-- Describe what is missing or where exactly is the bug/typo/issue located. Links highly appreciated. --!>\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature-request.md",
    "content": "---\nname: Feature request ✅\nabout: Suggest an idea for a feature or improvement\n\n---\n\n**Describe the proposed solution**\n<!-- A clear and concise description of what you want to happen. --!>\n\n**Describe alternatives you've considered**\n<!-- A clear and concise description of any alternative solutions or features you've considered. --!>\n\n**Additional context**\n<!-- Add any other context or screenshots about the feature request here. --!>\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/security-issue.md",
    "content": "---\nname: \"Security Issue 🔐\"\nabout: Please contact us at security@sylius.com\n\n---\n\nIf you think that you have found a security issue in Sylius, please do not use the issue tracker and do not post it publicly. \nInstead, all security issues must be sent to `security@sylius.com`.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/support-question.md",
    "content": "---\nname: \"Support Question 🚫\"\nabout: See http://docs.sylius.com/en/latest/support/index.html for questions about\n  using Sylius\n\n---\n\nWe use GitHub issues only to discuss about Sylius bugs, new features and documentation. \nFor this kind of questions about Sylius usage, please use\nany of the support alternatives described here: http://docs.sylius.com/en/latest/support/index.html\n\nThank you!\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "content": "| Q                | A\n| ---------------- | -----\n| Bug report?      | no/yes\n| Feature request? | no/yes\n| BC Break report? | no/yes\n| RFC?             | no/yes\n\n<!--\n - For support requests and how-tos, visit http://docs.sylius.com/en/latest/support/\n-->\n"
  },
  {
    "path": ".github/PULL_REQUEST_TEMPLATE.md",
    "content": "| Q               | A\n| --------------- | -----\n| Bug fix?        | no/yes\n| New feature?    | no/yes\n| BC breaks?      | no/yes\n| Deprecations?   | no/yes <!-- don't forget to update the UPGRADE-*.md file -->\n| Related tickets | fixes #X, partially #Y, mentioned in #Z\n| License         | MIT\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "version: 2\nupdates:\n- package-ecosystem: composer\n  directory: \"/\"\n  schedule:\n    interval: daily\n    time: \"10:00\"\n  open-pull-requests-limit: 10\n  ignore:\n  - dependency-name: phpstan/phpstan\n    versions:\n    - 0.12.70\n    - 0.12.71\n    - 0.12.73\n    - 0.12.74\n    - 0.12.75\n    - 0.12.76\n    - 0.12.78\n    - 0.12.79\n    - 0.12.80\n    - 0.12.83\n  - dependency-name: vimeo/psalm\n    versions:\n    - 4.5.0\n    - 4.5.1\n    - 4.5.2\n    - 4.6.0\n    - 4.6.2\n    - 4.6.3\n  - dependency-name: babdev/pagerfanta-bundle\n    versions:\n    - 3.0.0\n  - dependency-name: phpstan/phpstan-webmozart-assert\n    versions:\n    - 0.12.10\n    - 0.12.11\n    - 0.12.9\n"
  },
  {
    "path": ".github/workflows/build.yml",
    "content": "name: Build\n\non:\n    push:\n        branches-ignore:\n            - 'dependabot/**'\n            - 'upmerge/**'\n    pull_request: ~\n    release:\n        types: [created]\n    schedule:\n        -\n            cron: \"0 1 * * 6\" # Run at 1am every Saturday\n    workflow_dispatch: ~\n\njobs:\n    tests:\n        runs-on: ubuntu-latest\n        name: >\n            PHP ${{ matrix.php }},\n            Symfony ${{ matrix.symfony }},\n            ORM ${{ matrix.orm }}\n            ${{ matrix['behat-transliterator'] != ''\n                && format(', Behat transliterator {0}', matrix['behat-transliterator'])\n                || '' }}\n            ${{ matrix['gedmo-doctrine-extensions'] != ''\n                && format(', Gedmo {0}', matrix['gedmo-doctrine-extensions'])\n                || '' }}\n            ${{ matrix['fos-rest-bundle'] != ''\n                && format(', FriendsOfSymfony Rest Bundle {0}', matrix['fos-rest-bundle'])\n                || '' }}\n            ${{ matrix['hateoas-bundle'] != ''\n            && format(', Hateoas Bundle {0}', matrix['hateoas-bundle'])\n            || '' }}            \n            ${{ matrix['jms-serializer-bundle'] != ''\n                && format(', JMSSerializer Bundle {0}', matrix['jms-serializer-bundle'])\n                || '' }}\n            ${{ matrix['symfony-workflow'] != ''\n                && format(', Symfony Workflow {0}', matrix['symfony-workflow'])\n                || '' }}\n            ${{ matrix['winzou-state-machine-bundle'] != ''\n            && format(', winzou State Machine Bundle {0}', matrix['winzou-state-machine-bundle'])\n            || '' }}\n        strategy:\n            fail-fast: false\n            matrix:\n                orm: ['2.*', '3.*']\n                php: [\"8.2\", \"8.3\"]\n                behat-transliterator: [\"\"]\n                composer-flags: ['--no-scripts --prefer-stable --prefer-dist']\n                gedmo-doctrine-extensions: [\"\"]\n                fos-rest-bundle: [\"\"]\n                hateoas-bundle: [\"\"]\n                jms-serializer-bundle: [\"\"]\n                symfony: [\"6.4.*\", \"7.4.*\"]\n                symfony-workflow: [\"\"]\n                winzou-state-machine-bundle: [\"\"]\n                include:\n                    -   php: \"8.4\"\n                        orm: \"3.*\"\n                        symfony: \"8.0.*\"\n                    # with Behat transliterator and Gedmo Doctrine extensions optional packages\n                    -   behat-transliterator: '^1.2'\n                        gedmo-doctrine-extensions: '^3.17.1'\n                        fos-rest-bundle: '^3.7'\n                        jms-serializer-bundle: '^5.5'\n                        php: \"8.3\"\n                        orm: \"3.*\"\n                        symfony: \"7.4.*\"\n                    # with FriendsOfSymfony Rest Bundle, JMS Serializer Bundle & and Hateoas Bundle optional packages\n                    -   fos-rest-bundle: '^3.7'\n                        hateoas-bundle: '^2.5'\n                        jms-serializer-bundle: '^5.5'\n                        php: \"8.3\"\n                        orm: \"3.*\"\n                        symfony: \"7.4.*\"\n                    # with winzou State Machine Bundle optional package\n                    -   winzou-state-machine-bundle: '^0.6.2'\n                        php: \"8.3\"\n                        orm: \"3.*\"\n                        symfony: \"7.4.*\"\n                    # with Symfony workflow optional package\n                    -   symfony-workflow: '7.4.*'\n                        php: \"8.3\"\n                        orm: \"3.*\"\n                        symfony: \"7.4.*\"\n\n        steps:\n            -\n                uses: actions/checkout@v4\n\n            -\n                name: Setup PHP\n                uses: shivammathur/setup-php@v2\n                with:\n                    php-version: \"${{ matrix.php }}\"\n                    extensions: mongodb-1.21.0\n                    coverage: none\n                    tools: 'composer:v2, flex'\n\n            -\n                name: Restrict Symfony version\n                if: matrix.symfony != ''\n                run: |\n                    composer config extra.symfony.require \"${{ matrix.symfony }}\"\n                    (cd src/Component && composer config extra.symfony.require \"${{ matrix.symfony }}\")\n\n            -\n                name: Restrict ORM version\n                if: matrix.orm != ''\n                run: |\n                    composer require --dev doctrine/orm \"${{ matrix.orm }}\" --no-update --no-scripts\n                    (cd src/Component && composer require --dev doctrine/orm \"${{ matrix.orm }}\" --no-update --no-scripts)\n\n            -\n                name: Install Behat transliterator\n                if: matrix.behat-transliterator != ''\n                run: |\n                    composer require --dev behat/transliterator \"${{ matrix.behat-transliterator }}\" --no-update --no-scripts\n\n            -\n                name: Install FriendsOfSymfony Rest Bundle\n                if: matrix.fos-rest-bundle != ''\n                run: |\n                    composer require --dev friendsofsymfony/rest-bundle \"${{ matrix.fos-rest-bundle }}\" --no-update --no-scripts\n\n            -\n                name: Install Gedmo Doctrine Extensions\n                if: matrix.gedmo-doctrine-extensions != ''\n                run: |\n                    composer require --dev gedmo/doctrine-extensions \"${{ matrix.gedmo-doctrine-extensions }}\" --no-update --no-scripts\n\n            -\n                name: Install Hateoas bundle\n                if: matrix.hateoas-bundle != ''\n                run: composer require --dev willdurand/hateoas-bundle \"${{ matrix.hateoas-bundle }}\" --no-update --no-scripts\n\n            -\n                name: Install JMS Serializer bundle\n                if: matrix.jms-serializer-bundle != ''\n                run: composer require --dev jms/serializer-bundle \"${{ matrix.jms-serializer-bundle }}\" --no-update --no-scripts\n\n            -\n                name: Install winzou State Machine Bundle\n                if: matrix.winzou-state-machine-bundle != ''\n                run: |\n                    composer require --dev winzou/state-machine-bundle \"${{ matrix.winzou-state-machine-bundle }}\" --no-update --no-scripts\n\n            -\n                name: Install Symfony workflow\n                if: matrix.symfony-workflow != ''\n                run: |\n                    composer require --dev symfony/workflow \"${{ matrix.symfony-workflow }}\" --no-update --no-scripts\n\n            -\n                name: Install MongoDB ODM package\n                run: |\n                    composer require --dev doctrine/mongodb-odm-bundle \"^5.0\" --no-update --no-scripts\n                    (cd src/Component && composer require --dev doctrine/mongodb-odm \"^2.8\" --no-update --no-scripts)\n\n            -\n                name: Install dependencies\n                run: |\n                    composer update ${{ matrix.composer-flags }}\n                    (cd src/Component && composer update ${{ matrix.composer-flags }})\n\n            -\n                name: Prepare test application\n                run: |\n                    (cd tests/Application && bin/console doctrine:schema:create)\n\n            -\n                name: Run PHPStan\n                run: vendor/bin/phpstan analyse --ansi --memory-limit=-1 -c phpstan.neon src\n\n            -\n                name: Run analysis\n                run: |\n                    composer analyse\n                    (cd src/Component && composer validate --strict)\n\n            -\n                name: Run PHPUnit tests\n                run: vendor/bin/phpunit --colors=always\n\n            -\n                name: Run lint container\n                run: (cd tests/Application && bin/console lint:container)\n\n            -\n                name: Run lint container without sylius/grid-bundle package\n                run: |\n                    find tests/Application/src -type f -name '*Grid.php' -delete\n                    composer remove sylius/grid-bundle --no-scripts --dev\n                    (cd tests/Application && bin/console cache:clear --env=test_without_twig)\n                    (cd tests/Application && bin/console lint:container --env=test_without_twig)\n                    composer require \"sylius/grid-bundle: ^1.13 || ^1.15@alpha\" --no-scripts --dev\n\n    tests_with_skeleton:\n        runs-on: ubuntu-latest\n        name: \"Tests with the Symfony Skeleton PHP ${{ matrix.php }}${{ matrix.skeleton != '' && format(', Skeleton {0}', matrix.skeleton) || '' }}\"\n        strategy:\n            fail-fast: false\n            matrix:\n                php: [\"8.3\"]\n                skeleton: [\"^6\", \"^7\"]\n\n        steps:\n            -\n                uses: actions/checkout@v4\n            -\n                name: Setup PHP\n                uses: shivammathur/setup-php@v2\n                with:\n                    php-version: \"${{ matrix.php }}\"\n                    extensions: mongodb-1.21.0\n                    coverage: none\n\n            -\n                name: Create-project with skeleton\n                run: |\n                    set -x\n                    composer create-project --ansi \"symfony/skeleton:${{ matrix.skeleton }}\" skeleton_app\n                    cd skeleton_app\n                    composer config extra.symfony.allow-contrib true\n                    composer config repositories.local '{\"type\": \"path\", \"url\": \"../\", \"options\": {\"symlink\": true}}' --json\n                    composer require -W --ansi sylius/resource-bundle \"*@dev\"\n"
  },
  {
    "path": ".github/workflows/docker.yml",
    "content": "name: Build Docker Image\n\non:\n    push:\n        branches-ignore:\n            - 'dependabot/**'\n        paths-ignore:\n            - \"*.md\"\n    pull_request:\n        paths-ignore:\n            - \"*.md\"\n    schedule:\n        -   cron: \"0 1 * * 6\" # Run at 1am every Saturday\n    workflow_dispatch: ~\n\njobs:\n    build-image:\n        name: Build Docker Image and Test Docker Compose\n        env:\n            DOCKER_BUILDKIT: 1 # Requires Latest Buildx in docker CLI\n            COMPOSE_DOCKER_CLI_BUILD: 1 # Requires Latest Buildx in docker compose CLI\n        strategy:\n            fail-fast: false\n            matrix:\n                platform: [linux/amd64,linux/arm64]\n\n        runs-on: ubuntu-latest\n        steps:\n            -\n                name: Set Up QEMU\n                uses: docker/setup-qemu-action@v2\n            -\n                name: Set Up Docker Buildx\n                uses: docker/setup-buildx-action@v2\n            -\n                name: Build Image\n                uses: docker/build-push-action@v3\n                with:\n                    push: false\n                    platforms: ${{ matrix.platform }}\n                    cache-from: type=gha\n                    cache-to: type=gha\n                    load: true\n            -\n                name: Shutdown Default MySQL\n                run: sudo service mysql stop\n            -\n                name: Checkout Code\n                uses: actions/checkout@v3\n            -\n                name: Analyse Package\n                run: make analyse\n            -\n                name: Run Tests\n                run: make test\n"
  },
  {
    "path": ".github/workflows/packages_split.yaml",
    "content": "name: 'Packages Split'\n\non:\n    workflow_dispatch:\n        inputs:\n            branch:\n                description: 'Branch to checkout and split. Ignored if tag is specified. At least one required.'\n                required: false\n                type: string\n            tag:\n                description: 'Tag to checkout and split. Takes priority over branch. At least one required.'\n                required: false\n                type: string\n\njobs:\n    split_packages:\n        name: Split ${{ matrix.package.repository }}\n        runs-on: ubuntu-latest\n        strategy:\n            fail-fast: false\n            matrix:\n                package:\n                    -\n                        directory: src/Component\n                        repository: Resource\n\n        steps:\n            -   name: Split package\n                uses: SyliusLabs/SplitPackageAction@v1.0\n                with:\n                    directory: ${{ matrix.package.directory }}\n                    repository: ${{ matrix.package.repository }}\n                    branch: ${{ github.event.inputs.branch }}\n                    tag: ${{ github.event.inputs.tag }}\n                    token: ${{ secrets.SPLIT_TOKEN }}\n"
  },
  {
    "path": ".github/workflows/upmerge_pr.yaml",
    "content": "name: Upmerge PR\n\non:\n    schedule:\n        -\n            cron: \"0 2 * * *\"\n    workflow_dispatch: ~\n\npermissions:\n    contents: write\n    pull-requests: write\n\njobs:\n    upmerge:\n        runs-on: ubuntu-latest\n        if: github.repository == 'Sylius/SyliusResourceBundle'\n        name: \"Upmerge PR\"\n        timeout-minutes: 5\n        strategy:\n            fail-fast: false\n            matrix:\n                include:\n                    -\n                        base_branch: \"1.14\"\n                        target_branch: \"1.15\"\n\n        steps:\n            -\n                uses: actions/checkout@v4\n                with:\n                    ref: ${{ matrix.target_branch }}\n\n            -\n                name: Reset upmerge branch\n                run: |\n                    git fetch origin ${{ matrix.base_branch }}:${{ matrix.base_branch }}\n                    git reset --hard ${{ matrix.base_branch }}\n\n            -\n                name: Create Pull Request\n                uses: peter-evans/create-pull-request@v4\n                with:\n                    token: ${{ secrets.SYLIUS_BOT_PAT }}\n                    title: '[UPMERGE] ${{ matrix.base_branch }} -> ${{ matrix.target_branch }}'\n                    body: |\n                        This PR has been generated automatically.\n                        For more details see [upmerge_pr.yaml](/Sylius/SyliusResourceBundle/blob/1.13/.github/workflows/upmerge_pr.yaml).\n\n                        **Remember!** The upmerge should always be merged with using `Merge pull request` button.\n\n                        In case of conflicts, please resolve them manually with usign the following commands:\n                        ```\n                        git fetch upstream\n                        gh pr checkout <this-pr-number>\n                        git merge upstream/${{ matrix.target_branch }} -m \"Resolve conflicts between ${{ matrix.base_branch }} and ${{ matrix.target_branch }}\"\n                        ```\n\n                        If you use other name for the upstream remote, please replace `upstream` with the name of your remote pointing to the `Sylius/SyliusResourceBundle` repository.\n\n                        Once the conflicts are resolved, please run `git merge --continue` and push the changes to this PR.\n                    branch: \"upmerge/${{ matrix.base_branch }}_${{ matrix.target_branch }}\"\n                    delete-branch: true\n                    base: ${{ matrix.target_branch }}\n"
  },
  {
    "path": ".gitignore",
    "content": "/vendor/\n\n/composer.phar\n/composer.lock\n\n/symfony.lock\n\n/.phpunit.result.cache\n\ntests/Application/config/reference.php\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "## CHANGELOG\n\n## v1.13.1 (2025-09-24)\n\n#### Details\n\n- [#1037](https://github.com/Sylius/SyliusResourceBundle/pull/1037) Add missing event short name on apply state machine transition ([@loic425](https://github.com/loic425))\n- [#1045](https://github.com/Sylius/SyliusResourceBundle/pull/1045) Fix - Add missing redirect & redirect arguments ([@loic425](https://github.com/loic425))\n- [#1064](https://github.com/Sylius/SyliusResourceBundle/pull/1064) Fix missing behat transliterator package ([@loic425](https://github.com/loic425))\n- [#1063](https://github.com/Sylius/SyliusResourceBundle/pull/1063) Add an error message for non existing repository method & suggest to use CreatePaginatorTrait ([@loic425](https://github.com/loic425))\n\n## v1.13.0 (2025-06-04)\n\n#### Details\n\n- [#1025](https://github.com/Sylius/SyliusResourceBundle/pull/1025) Fix implicit nullable parameter + add ECS rule to 1.12 ([@GSadee](https://github.com/GSadee))\n- [#1024](https://github.com/Sylius/SyliusResourceBundle/pull/1024) Fix implicit nullable parameter + add ECS rule ([@GSadee](https://github.com/GSadee))\n\n## v1.13.0-BETA.1 (2025-05-28)\n\n#### Details\n\n- [#985](https://github.com/Sylius/SyliusResourceBundle/pull/985) Add resource name collection ([@loic425](https://github.com/loic425))\n- [#986](https://github.com/Sylius/SyliusResourceBundle/pull/986) Init resource class list factory with attributes ([@loic425](https://github.com/loic425))\n- [#987](https://github.com/Sylius/SyliusResourceBundle/pull/987) Resource route collection factory ([@loic425](https://github.com/loic425))\n- [#997](https://github.com/Sylius/SyliusResourceBundle/pull/997) New resource loader ([@loic425](https://github.com/loic425))\n- [#984](https://github.com/Sylius/SyliusResourceBundle/pull/984) Add Operation defaults trait ([@loic425](https://github.com/loic425))\n- [#1003](https://github.com/Sylius/SyliusResourceBundle/pull/1003) Fix implicit nullable parameter on createRestView method ([@loic425](https://github.com/loic425))\n- [#1006](https://github.com/Sylius/SyliusResourceBundle/pull/1006) Wrap `class_alias` calls in `class_exists` checks ([@quentint](https://github.com/quentint))\n- [#1007](https://github.com/Sylius/SyliusResourceBundle/pull/1007) Gracefully handle rendering actions for non-resource grid view ([@vvasiloi](https://github.com/vvasiloi))\n- [#1010](https://github.com/Sylius/SyliusResourceBundle/pull/1010) Add `#[Attribute]` annotation to validator constraints ([@Rafikooo](https://github.com/Rafikooo))\n- [#1015](https://github.com/Sylius/SyliusResourceBundle/pull/1015) Allow to define a template in grid action options ([@loic425](https://github.com/loic425))\n- [#1014](https://github.com/Sylius/SyliusResourceBundle/pull/1014) Add tests with skeleton ([@loic425](https://github.com/loic425))\n- [#1016](https://github.com/Sylius/SyliusResourceBundle/pull/1016) Fix ClassReflection resource class resolving edge case ([@Pierstoval](https://github.com/Pierstoval))\n- [#1021](https://github.com/Sylius/SyliusResourceBundle/pull/1021) [Maintenance] Exclude dependabot and upmerge push builds ([@NoResponseMate](https://github.com/NoResponseMate))\n- [#1013](https://github.com/Sylius/SyliusResourceBundle/pull/1013) Add new SecurityProvider to allow managing access to resource ([@Prometee](https://github.com/Prometee))\n- [#994](https://github.com/Sylius/SyliusResourceBundle/pull/994) Fix missing route name on operations attributes ([@loic425](https://github.com/loic425))\n\n## v1.13.0-ALPHA.3 (2025-03-12)\n\n#### Details\n\n- [#977](https://github.com/Sylius/SyliusResourceBundle/issues/977) Fix implicit nullable parameter ([@loic425](https://github.com/loic425))\n- [#979](https://github.com/Sylius/SyliusResourceBundle/issues/979) [De] Show legacy resource metadata on de command when specified ([@loic425](https://github.com/loic425))\n- [#990](https://github.com/Sylius/SyliusResourceBundle/issues/990) Fix Grid provider used in Request grid provider to allow using grid c… ([@loic425](https://github.com/loic425))\n- [#991](https://github.com/Sylius/SyliusResourceBundle/issues/991) [CI] Add GitHub Action for creating upmerge PRs ([@GSadee](https://github.com/GSadee))\n- [#993](https://github.com/Sylius/SyliusResourceBundle/issues/993) Add route requirements ([@loic425](https://github.com/loic425))\n- [#995](https://github.com/Sylius/SyliusResourceBundle/issues/995) Custom notification message ([@loic425](https://github.com/loic425))\n\n## v1.13.0-ALPHA.2 (2025-01-21)\n\n#### Details\n\n- [#970](https://github.com/Sylius/SyliusResourceBundle/issues/970) [DX][Internal] use Foundry for comic books ([@loic425](https://github.com/loic425))\n- [#973](https://github.com/Sylius/SyliusResourceBundle/issues/973) Fix Delete handling exception previous argument type ([@loic425](https://github.com/loic425))\n- [#971](https://github.com/Sylius/SyliusResourceBundle/issues/971) [DX][Internal] Do not use Alice anymore ([@loic425](https://github.com/loic425))\n- [#963](https://github.com/Sylius/SyliusResourceBundle/issues/963) [Doc] Documentation migration to SyliusStack using gitbook ([@Prometee](https://github.com/Prometee))\n- [#975](https://github.com/Sylius/SyliusResourceBundle/issues/975) Add missing package and version attributes in deprecated element ([@GSadee](https://github.com/GSadee))\n\n## v1.13.0-ALPHA.1 (2025-01-17)\n\n#### Details\n\n- [#936](https://github.com/Sylius/SyliusResourceBundle/issues/936) [phpspec-2-phpunit] migration of tests (Model) ([@loic425](https://github.com/loic425))\n- [#957](https://github.com/Sylius/SyliusResourceBundle/issues/957) Deprecate VariantWithNoOptionsValuesException ([@GSadee](https://github.com/GSadee))\n- [#959](https://github.com/Sylius/SyliusResourceBundle/issues/959) Create LICENSE_OF_TRADEMARK_AND_LOGO ([@damonsson](https://github.com/damonsson))\n- [#958](https://github.com/Sylius/SyliusResourceBundle/issues/958) Update LICENSE year ([@damonsson](https://github.com/damonsson))\n- [#961](https://github.com/Sylius/SyliusResourceBundle/issues/961) Bump dependencies & Introduce prefer lowest on CI ([@loic425](https://github.com/loic425))\n- [#968](https://github.com/Sylius/SyliusResourceBundle/issues/968) Add support for Doctrine ORM 3 ([@loic425](https://github.com/loic425))\n- [#969](https://github.com/Sylius/SyliusResourceBundle/issues/969) [DX][Internal] Start using Foundry ([@loic425](https://github.com/loic425))\n\n## v1.12.2 (2025-05-28)\n\n#### Details\n\n- [#990](https://github.com/Sylius/SyliusResourceBundle/pull/990) Fix Grid provider used in Request grid provider to allow using grid c… ([@loic425](https://github.com/loic425))\n- [#1010](https://github.com/Sylius/SyliusResourceBundle/pull/1010) Add `#[Attribute]` annotation to validator constraints ([@Rafikooo](https://github.com/Rafikooo))\n- [#1014](https://github.com/Sylius/SyliusResourceBundle/pull/1014) Add tests with skeleton ([@loic425](https://github.com/loic425))\n- [#1016](https://github.com/Sylius/SyliusResourceBundle/pull/1016) Fix ClassReflection resource class resolving edge case ([@Pierstoval](https://github.com/Pierstoval))\n- [#994](https://github.com/Sylius/SyliusResourceBundle/pull/994) Fix missing route name on operations attributes ([@loic425](https://github.com/loic425))\n\n## v1.12.1 (2025-01-21)\n\n#### Details\n\n- [#936](https://github.com/Sylius/SyliusResourceBundle/issues/936) [phpspec-2-phpunit] migration of tests (Model) ([@loic425](https://github.com/loic425))\n- [#958](https://github.com/Sylius/SyliusResourceBundle/issues/958) Update LICENSE year ([@damonsson](https://github.com/damonsson))\n- [#975](https://github.com/Sylius/SyliusResourceBundle/issues/975) Add missing package and version attributes in deprecated element ([@GSadee](https://github.com/GSadee))\n\n## v1.12.0 (2024-10-08)\n\n## v1.12.0-BETA.2 (2024-10-07)\n\n#### Details\n\n- [#948](https://github.com/Sylius/SyliusResourceBundle/issues/948) Remove usage of Symfony\\Component\\HttpKernel\\DependencyInjection\\Exte… ([@loic425](https://github.com/loic425))\n- [#949](https://github.com/Sylius/SyliusResourceBundle/issues/949) [Composer] Bump sylius/grid-bundle dev dependency ([@GSadee](https://github.com/GSadee))\n- [#873](https://github.com/Sylius/SyliusResourceBundle/issues/873) Move winzou state machine on optional requirements ([@loic425](https://github.com/loic425), [@GSadee](https://github.com/GSadee))\n- [#951](https://github.com/Sylius/SyliusResourceBundle/issues/951) [Composer] Add GridBundle 1.13 beta in dev dependencies for SF7 builds ([@GSadee](https://github.com/GSadee))\n\n## v1.12.0-BETA.1 (2024-10-01)\n\n#### Details\n\n- [#945](https://github.com/Sylius/SyliusResourceBundle/issues/945) Restrict Doctrine orm package version ([@loic425](https://github.com/loic425))\n- [#861](https://github.com/Sylius/SyliusResourceBundle/issues/861) [Maintenance] Deprecate unused configuration nodes ([@NoResponseMate](https://github.com/NoResponseMate))\n\n## v1.12.0-ALPHA.3 (2024-09-23)\n\n#### Details\n\n- [#941](https://github.com/Sylius/SyliusResourceBundle/issues/941) Fix Doctrine dependency on state processors ([@loic425](https://github.com/loic425))\n- [#932](https://github.com/Sylius/SyliusResourceBundle/issues/932) [phpspec-2-phpunit] migration of tests (Humanizer) ([@loic425](https://github.com/loic425))\n- [#928](https://github.com/Sylius/SyliusResourceBundle/issues/928) [phpspec-2-phpunit] migration of tests (Doctrine) ([@loic425](https://github.com/loic425))\n- [#929](https://github.com/Sylius/SyliusResourceBundle/issues/929) [phpspec-2-phpunit] migration of tests (Exception) ([@loic425](https://github.com/loic425))\n- [#930](https://github.com/Sylius/SyliusResourceBundle/issues/930) [phpspec-2-phpunit] migration of tests (Generator) ([@loic425](https://github.com/loic425))\n- [#931](https://github.com/Sylius/SyliusResourceBundle/issues/931) [phpspec-2-phpunit] migration of tests (Grid) ([@loic425](https://github.com/loic425))\n- [#942](https://github.com/Sylius/SyliusResourceBundle/issues/942) Doctrine requirement is now optional ([@loic425](https://github.com/loic425))\n- [#933](https://github.com/Sylius/SyliusResourceBundle/issues/933) [phpspec-2-phpunit] migration of tests (Metadata) ([@loic425](https://github.com/loic425))\n\n## v1.12.0-ALPHA.2 (2024-09-12)\n\n#### Details\n\n- [#934](https://github.com/Sylius/SyliusResourceBundle/issues/934) Reproduce getting the translation repository by its interface use case ([@loic425](https://github.com/loic425))\n- [#935](https://github.com/Sylius/SyliusResourceBundle/issues/935) Fix getting translation repository ([@loic425](https://github.com/loic425))\n\n## v1.12.0-ALPHA.1 (2024-09-09)\n\n#### Details\n\n- [#872](https://github.com/Sylius/SyliusResourceBundle/issues/872) Move fos rest, jms serializer and hateoas on optional requirements ([@loic425](https://github.com/loic425))\n- [#863](https://github.com/Sylius/SyliusResourceBundle/issues/863) Adding support for Symfony 7 ([@loic425](https://github.com/loic425))\n- [#924](https://github.com/Sylius/SyliusResourceBundle/issues/924) Remove Twig 2 support ([@loic425](https://github.com/loic425))\n- [#926](https://github.com/Sylius/SyliusResourceBundle/issues/926) [Composer] Allow GridBundle ^v1.13@alpha ([@GSadee](https://github.com/GSadee))\n\n## v1.11.4 (2024-10-07)\n\n#### Details\n\n- [#948](https://github.com/Sylius/SyliusResourceBundle/issues/948) Remove usage of Symfony\\Component\\HttpKernel\\DependencyInjection\\Exte… ([@loic425](https://github.com/loic425))\n- [#949](https://github.com/Sylius/SyliusResourceBundle/issues/949) [Composer] Bump sylius/grid-bundle dev dependency ([@GSadee](https://github.com/GSadee))\n\n## v1.11.3 (2024-09-23)\n\n#### Details\n\n- [#934](https://github.com/Sylius/SyliusResourceBundle/issues/934) Reproduce getting the translation repository by its interface use case ([@loic425](https://github.com/loic425))\n- [#941](https://github.com/Sylius/SyliusResourceBundle/issues/941) Fix Doctrine dependency on state processors ([@loic425](https://github.com/loic425))\n\n## v1.11.2 (2024-09-06)\n\n#### Details\n\n- [#913](https://github.com/Sylius/SyliusResourceBundle/issues/913) [Docs] Disable providing data ([@loic425](https://github.com/loic425))\n- [#918](https://github.com/Sylius/SyliusResourceBundle/issues/918) Fix grid limits on request grid provider ([@loic425](https://github.com/loic425))\n- [#914](https://github.com/Sylius/SyliusResourceBundle/issues/914) [Docs] Disable processing data ([@loic425](https://github.com/loic425))\n- [#925](https://github.com/Sylius/SyliusResourceBundle/issues/925) [Docs] Resource validation ([@loic425](https://github.com/loic425))\n\n## v1.11.1 (2024-09-02)\n\n#### Details\n\n- [#917](https://github.com/Sylius/SyliusResourceBundle/issues/917) Quick Fix ORM translatable listener for Symfony 5 ([@loic425](https://github.com/loic425))\n\n## v1.11.0 (2024-08-29)\n\n## v1.11.0-RC.2 (2024-07-12)\n\n#### Details\n\n- [#900](https://github.com/Sylius/SyliusResourceBundle/issues/900) [Maintenance] Fix PHPStan errors related to class-string ([@lchrusciel](https://github.com/lchrusciel))\n\n## v1.11.0-RC.1 (2024-07-11)\n\n#### Details\n\n- [#874](https://github.com/Sylius/SyliusResourceBundle/issues/874) Remove PHP 8.0 support & not maintained Symfony versions ([@loic425](https://github.com/loic425))\n- [#878](https://github.com/Sylius/SyliusResourceBundle/issues/878) Fix dependency injection namespace ([@loic425](https://github.com/loic425))\n- [#883](https://github.com/Sylius/SyliusResourceBundle/issues/883) Fix form parameter bags accesing in request handler ([@NoResponseMate](https://github.com/NoResponseMate))\n- [#895](https://github.com/Sylius/SyliusResourceBundle/issues/895) Move some routing factories into 2 sub-directories ([@loic425](https://github.com/loic425))\n- [#896](https://github.com/Sylius/SyliusResourceBundle/issues/896) Move attributes operation route factory into sylius resource namespace ([@loic425](https://github.com/loic425))\n- [#898](https://github.com/Sylius/SyliusResourceBundle/issues/898) [Maintenance] Fix builds ([@NoResponseMate](https://github.com/NoResponseMate))\n- [#899](https://github.com/Sylius/SyliusResourceBundle/issues/899) Add missing experimental tags for new routing system ([@loic425](https://github.com/loic425))\n\n## v1.11.0-BETA.2 (2024-05-14)\n\n#### Details\n\n- [#871](https://github.com/Sylius/SyliusResourceBundle/issues/871) Fix state machine tag ([@Zales0123](https://github.com/Zales0123)) Working on Sylius/SyliusResourceBundle (branch 1.11)\n\n## v1.11.0-BETA.1 (2024-04-19)\n\n#### Details\n\n- [#545](https://github.com/Sylius/SyliusResourceBundle/issues/545) Update phpspec/phpspec to 7.3 ([@dannyvw](https://github.com/dannyvw))\n- [#607](https://github.com/Sylius/SyliusResourceBundle/issues/607) Allow jms/serializer-bundle ^5.0 ([@dannyvw](https://github.com/dannyvw))\n- [#611](https://github.com/Sylius/SyliusResourceBundle/issues/611) Allow doctrine/collections ^2.0 ([@dannyvw](https://github.com/dannyvw))\n- [#613](https://github.com/Sylius/SyliusResourceBundle/issues/613) Configure specific state machine component for a resource ([@loic425](https://github.com/loic425))\n- [#634](https://github.com/Sylius/SyliusResourceBundle/issues/634) Allow Pagerfanta 4.0 ([@mbabker](https://github.com/mbabker))\n- [#659](https://github.com/Sylius/SyliusResourceBundle/issues/659) Debug resource with FQCN ([@loic425](https://github.com/loic425))\n- [#682](https://github.com/Sylius/SyliusResourceBundle/issues/682) [New docs] docs' pagination ([@loic425](https://github.com/loic425))\n- [#687](https://github.com/Sylius/SyliusResourceBundle/issues/687) [New docs] Configure the resource name ([@loic425](https://github.com/loic425))\n- [#689](https://github.com/Sylius/SyliusResourceBundle/issues/689) [New docs] Configure the resource plural name ([@loic425](https://github.com/loic425))\n- [#696](https://github.com/Sylius/SyliusResourceBundle/issues/696) [CI] Add support for PHP 8.2 ([@loic425](https://github.com/loic425))\n- [#706](https://github.com/Sylius/SyliusResourceBundle/issues/706) [Test app] Use Doctrine attributes ([@loic425](https://github.com/loic425))\n- [#717](https://github.com/Sylius/SyliusResourceBundle/issues/717) Fix after upmerge ([@loic425](https://github.com/loic425))\n- [#718](https://github.com/Sylius/SyliusResourceBundle/issues/718) Poc rebased ([@loic425](https://github.com/loic425))\n- [#719](https://github.com/Sylius/SyliusResourceBundle/issues/719) Update licence ([@Rafikooo](https://github.com/Rafikooo))\n- [#723](https://github.com/Sylius/SyliusResourceBundle/issues/723) Fix default templates dir ([@loic425](https://github.com/loic425))\n- [#724](https://github.com/Sylius/SyliusResourceBundle/issues/724) Add flash from event on processor ([@lchrusciel](https://github.com/lchrusciel))\n- [#726](https://github.com/Sylius/SyliusResourceBundle/issues/726) Update license ([@Zales0123](https://github.com/Zales0123))\n- [#727](https://github.com/Sylius/SyliusResourceBundle/issues/727) Bulk update ([@loic425](https://github.com/loic425))\n- [#728](https://github.com/Sylius/SyliusResourceBundle/issues/728) Psalm fix after upmerge ([@Zales0123](https://github.com/Zales0123))\n- [#729](https://github.com/Sylius/SyliusResourceBundle/issues/729) [doc] Add missing new line to configure_your_operations.md example ([@diimpp](https://github.com/diimpp))\n- [#730](https://github.com/Sylius/SyliusResourceBundle/issues/730) Grid aware operation ([@loic425](https://github.com/loic425))\n- [#731](https://github.com/Sylius/SyliusResourceBundle/issues/731) Configure driver on resource attribute ([@loic425](https://github.com/loic425))\n- [#732](https://github.com/Sylius/SyliusResourceBundle/issues/732) Remove unused template ([@loic425](https://github.com/loic425))\n- [#733](https://github.com/Sylius/SyliusResourceBundle/issues/733) Move PHPUnit tests from bundle ([@loic425](https://github.com/loic425))\n- [#738](https://github.com/Sylius/SyliusResourceBundle/issues/738) Fix Doctrine subscriber deprecations ([@loic425](https://github.com/loic425))\n- [#740](https://github.com/Sylius/SyliusResourceBundle/issues/740) [Fix] Update delete path name to avoid route conflicts ([@loic425](https://github.com/loic425))\n- [#741](https://github.com/Sylius/SyliusResourceBundle/issues/741) Add request to routing arguments ([@loic425](https://github.com/loic425))\n- [#742](https://github.com/Sylius/SyliusResourceBundle/issues/742) Define simple vars on your operations ([@loic425](https://github.com/loic425))\n- [#743](https://github.com/Sylius/SyliusResourceBundle/issues/743) Update rector/rector requirement from ^0.13.5 to ^0.18.2 ([@dependabot](https://github.com/dependabot)[[@bot](https://github.com/bot)])\n- [#745](https://github.com/Sylius/SyliusResourceBundle/issues/745) Improve testing debug resource command ([@loic425](https://github.com/loic425))\n- [#746](https://github.com/Sylius/SyliusResourceBundle/issues/746) Add POST http method on update, delete and bulk delete operation ([@loic425](https://github.com/loic425))\n- [#747](https://github.com/Sylius/SyliusResourceBundle/issues/747) Fix name of file inside the comments for BookFactory ([@harikt](https://github.com/harikt))\n- [#757](https://github.com/Sylius/SyliusResourceBundle/issues/757) Use AsResource attribute instead of reserved word Resource ([@loic425](https://github.com/loic425))\n- [#758](https://github.com/Sylius/SyliusResourceBundle/issues/758) Remove Component namespace on action ([@loic425](https://github.com/loic425))\n- [#759](https://github.com/Sylius/SyliusResourceBundle/issues/759) Remove Component namespace on annotation ([@loic425](https://github.com/loic425))\n- [#760](https://github.com/Sylius/SyliusResourceBundle/issues/760) Remove Component namespace on context ([@loic425](https://github.com/loic425))\n- [#761](https://github.com/Sylius/SyliusResourceBundle/issues/761) Remove Component namespace on Doctrine ([@loic425](https://github.com/loic425))\n- [#762](https://github.com/Sylius/SyliusResourceBundle/issues/762) Remove Component namespace on state ([@loic425](https://github.com/loic425))\n- [#764](https://github.com/Sylius/SyliusResourceBundle/issues/764) Fix routing with moved attributes ([@loic425](https://github.com/loic425))\n- [#766](https://github.com/Sylius/SyliusResourceBundle/issues/766) Move some namespaces on Storage ([@loic425](https://github.com/loic425))\n- [#767](https://github.com/Sylius/SyliusResourceBundle/issues/767) Move some namespaces on Symfony event dispatchers ([@loic425](https://github.com/loic425))\n- [#768](https://github.com/Sylius/SyliusResourceBundle/issues/768) Move some namespaces on Exceptions ([@loic425](https://github.com/loic425))\n- [#769](https://github.com/Sylius/SyliusResourceBundle/issues/769) Move some namespaces on Grid ([@loic425](https://github.com/loic425))\n- [#770](https://github.com/Sylius/SyliusResourceBundle/issues/770) Move some namespaces on Humanizer ([@loic425](https://github.com/loic425))\n- [#772](https://github.com/Sylius/SyliusResourceBundle/issues/772) Move some namespaces on Symfony event listener  ([@loic425](https://github.com/loic425))\n- [#773](https://github.com/Sylius/SyliusResourceBundle/issues/773) Fix response status when method is safe ([@loic425](https://github.com/loic425))\n- [#774](https://github.com/Sylius/SyliusResourceBundle/issues/774) Move some namespaces on new Metadata ([@loic425](https://github.com/loic425))\n- [#775](https://github.com/Sylius/SyliusResourceBundle/issues/775) Move some namespaces on Twig ([@loic425](https://github.com/loic425))\n- [#777](https://github.com/Sylius/SyliusResourceBundle/issues/777) Move some namespaces on Factory ([@loic425](https://github.com/loic425))\n- [#778](https://github.com/Sylius/SyliusResourceBundle/issues/778) Move some namespaces on Symfony expression language ([@loic425](https://github.com/loic425))\n- [#779](https://github.com/Sylius/SyliusResourceBundle/issues/779) Phpunit tests for Symfony deserialize listener ([@loic425](https://github.com/loic425))\n- [#780](https://github.com/Sylius/SyliusResourceBundle/issues/780) Init Deserialize provider ([@loic425](https://github.com/loic425))\n- [#783](https://github.com/Sylius/SyliusResourceBundle/issues/783) Move some namespaces on Symfony forms, requests and responses ([@loic425](https://github.com/loic425))\n- [#784](https://github.com/Sylius/SyliusResourceBundle/issues/784) Move some namespaces on Symfony routing, validator exceptions and workflow ([@loic425](https://github.com/loic425))\n- [#785](https://github.com/Sylius/SyliusResourceBundle/issues/785) Init read provider ([@loic425](https://github.com/loic425))\n- [#786](https://github.com/Sylius/SyliusResourceBundle/issues/786) Fix readme with supported branches ([@loic425](https://github.com/loic425))\n- [#788](https://github.com/Sylius/SyliusResourceBundle/issues/788) Init flash processor ([@loic425](https://github.com/loic425))\n- [#789](https://github.com/Sylius/SyliusResourceBundle/issues/789) Phpunit tests for Symfony respond listener ([@loic425](https://github.com/loic425))\n- [#790](https://github.com/Sylius/SyliusResourceBundle/issues/790) Init respond processor ([@loic425](https://github.com/loic425))\n- [#791](https://github.com/Sylius/SyliusResourceBundle/issues/791) Phpunit tests for Symfony form listener ([@loic425](https://github.com/loic425))\n- [#792](https://github.com/Sylius/SyliusResourceBundle/issues/792) Phpunit tests for Symfony flash listener ([@loic425](https://github.com/loic425))\n- [#793](https://github.com/Sylius/SyliusResourceBundle/issues/793) Init form provider ([@loic425](https://github.com/loic425))\n- [#795](https://github.com/Sylius/SyliusResourceBundle/issues/795) Init factory provider ([@loic425](https://github.com/loic425))\n- [#798](https://github.com/Sylius/SyliusResourceBundle/issues/798) Init validate provider ([@loic425](https://github.com/loic425))\n- [#799](https://github.com/Sylius/SyliusResourceBundle/issues/799) PHPUnit tests for Symfony serialize listener ([@loic425](https://github.com/loic425))\n- [#800](https://github.com/Sylius/SyliusResourceBundle/issues/800) Init serialize processor ([@loic425](https://github.com/loic425))\n- [#801](https://github.com/Sylius/SyliusResourceBundle/issues/801) PHPUnit tests for Symfony write listener ([@loic425](https://github.com/loic425))\n- [#803](https://github.com/Sylius/SyliusResourceBundle/issues/803) PHPUnit tests for Symfony add format listener ([@loic425](https://github.com/loic425))\n- [#804](https://github.com/Sylius/SyliusResourceBundle/issues/804) Move some namespaces on metadata ([@loic425](https://github.com/loic425))\n- [#805](https://github.com/Sylius/SyliusResourceBundle/issues/805) Move some namespaces on generator ([@loic425](https://github.com/loic425))\n- [#806](https://github.com/Sylius/SyliusResourceBundle/issues/806) Move some namespaces on reflection ([@loic425](https://github.com/loic425))\n- [#810](https://github.com/Sylius/SyliusResourceBundle/issues/810) [CI] Exclude builds for Symfony 6.4 and doctrine/persistence 2.0 ([@GSadee](https://github.com/GSadee), [@loic425](https://github.com/loic425))\n- [#815](https://github.com/Sylius/SyliusResourceBundle/issues/815) PHPUnit tests for factory ([@loic425](https://github.com/loic425))\n- [#816](https://github.com/Sylius/SyliusResourceBundle/issues/816) PHPUnit tests for context ([@loic425](https://github.com/loic425))\n- [#817](https://github.com/Sylius/SyliusResourceBundle/issues/817) Add DI for Main controller, providers and processors ([@loic425](https://github.com/loic425))\n- [#818](https://github.com/Sylius/SyliusResourceBundle/issues/818) Fix Phpspec errors ([@loic425](https://github.com/loic425))\n- [#819](https://github.com/Sylius/SyliusResourceBundle/issues/819) Move some namespaces on model ([@loic425](https://github.com/loic425))\n- [#820](https://github.com/Sylius/SyliusResourceBundle/issues/820) Move some namespaces on repository ([@loic425](https://github.com/loic425))\n- [#821](https://github.com/Sylius/SyliusResourceBundle/issues/821) Fix serialize processor ([@loic425](https://github.com/loic425))\n- [#822](https://github.com/Sylius/SyliusResourceBundle/issues/822) Fix flash processor ([@loic425](https://github.com/loic425))\n- [#823](https://github.com/Sylius/SyliusResourceBundle/issues/823) Fix event dispatcher provider ([@loic425](https://github.com/loic425))\n- [#824](https://github.com/Sylius/SyliusResourceBundle/issues/824) Add main controller ([@loic425](https://github.com/loic425))\n- [#826](https://github.com/Sylius/SyliusResourceBundle/issues/826) Replace decorated by processor  into bulk aware processor ([@loic425](https://github.com/loic425))\n- [#827](https://github.com/Sylius/SyliusResourceBundle/issues/827) Fix respond processor ([@loic425](https://github.com/loic425))\n- [#828](https://github.com/Sylius/SyliusResourceBundle/issues/828) Dispatch pre write event processor ([@loic425](https://github.com/loic425))\n- [#829](https://github.com/Sylius/SyliusResourceBundle/issues/829) Dispatch post write event processor ([@loic425](https://github.com/loic425))\n- [#830](https://github.com/Sylius/SyliusResourceBundle/issues/830) Write processor ([@loic425](https://github.com/loic425))\n- [#831](https://github.com/Sylius/SyliusResourceBundle/issues/831) Move deserialize provider into Symfony namespace ([@loic425](https://github.com/loic425))\n- [#832](https://github.com/Sylius/SyliusResourceBundle/issues/832) Rename event dispatcher provider to dispatch post read event provider ([@loic425](https://github.com/loic425))\n- [#833](https://github.com/Sylius/SyliusResourceBundle/issues/833) Add resource metadata on Twig context ([@loic425](https://github.com/loic425))\n- [#836](https://github.com/Sylius/SyliusResourceBundle/issues/836) Remove cache on metadata when debug is enabled ([@loic425](https://github.com/loic425))\n- [#838](https://github.com/Sylius/SyliusResourceBundle/issues/838) Rename legacy tests directory ([@loic425](https://github.com/loic425))\n- [#841](https://github.com/Sylius/SyliusResourceBundle/issues/841) Add support for PHP 8.3 (CI) ([@loic425](https://github.com/loic425))\n- [#847](https://github.com/Sylius/SyliusResourceBundle/issues/847) Fix autowiring for legacy factory and repository ([@loic425](https://github.com/loic425))\n- [#849](https://github.com/Sylius/SyliusResourceBundle/issues/849) Add local constraints ([@Wojdylak](https://github.com/Wojdylak))\n- [#853](https://github.com/Sylius/SyliusResourceBundle/issues/853) [Docs] Inject factories (autowiring) ([@loic425](https://github.com/loic425))\n- [#857](https://github.com/Sylius/SyliusResourceBundle/issues/857) Move state machine with bc-layer ([@loic425](https://github.com/loic425))\n- [#858](https://github.com/Sylius/SyliusResourceBundle/issues/858) Move Winzou namespace ([@loic425](https://github.com/loic425))\n- [#860](https://github.com/Sylius/SyliusResourceBundle/issues/860) Move translations' namespace ([@loic425](https://github.com/loic425))\n- [#862](https://github.com/Sylius/SyliusResourceBundle/issues/862) [Maintenance] Add an exception for unavailable storages ([@NoResponseMate](https://github.com/NoResponseMate))\n- [#864](https://github.com/Sylius/SyliusResourceBundle/issues/864) Improve legacy book factory to use more bc-layer classes ([@loic425](https://github.com/loic425))\n\n## v1.11.0-ALPHA.2 (2024-01-30)\n\n#### Details\n\n- [#538](https://github.com/Sylius/SyliusResourceBundle/issues/538) fix(flashbag): fixed addFlash in ControllerTrait for Symfony 6 ([@UlrichHP](https://github.com/UlrichHP))\n- [#611](https://github.com/Sylius/SyliusResourceBundle/issues/611) Allow doctrine/collections ^2.0 ([@dannyvw](https://github.com/dannyvw))\n- [#634](https://github.com/Sylius/SyliusResourceBundle/issues/634) Allow Pagerfanta 4.0 ([@mbabker](https://github.com/mbabker))\n- [#729](https://github.com/Sylius/SyliusResourceBundle/issues/729) [doc] Add missing new line to configure_your_operations.md example ([@diimpp](https://github.com/diimpp))\n- [#730](https://github.com/Sylius/SyliusResourceBundle/issues/730) Grid aware operation ([@loic425](https://github.com/loic425))\n- [#731](https://github.com/Sylius/SyliusResourceBundle/issues/731) Configure driver on resource attribute ([@loic425](https://github.com/loic425))\n- [#732](https://github.com/Sylius/SyliusResourceBundle/issues/732) Remove unused template ([@loic425](https://github.com/loic425))\n- [#733](https://github.com/Sylius/SyliusResourceBundle/issues/733) Move PHPUnit tests from bundle ([@loic425](https://github.com/loic425))\n- [#738](https://github.com/Sylius/SyliusResourceBundle/issues/738) Fix Doctrine subscriber deprecations ([@loic425](https://github.com/loic425))\n- [#740](https://github.com/Sylius/SyliusResourceBundle/issues/740) [Fix] Update delete path name to avoid route conflicts ([@loic425](https://github.com/loic425))\n- [#741](https://github.com/Sylius/SyliusResourceBundle/issues/741) Add request to routing arguments ([@loic425](https://github.com/loic425))\n- [#742](https://github.com/Sylius/SyliusResourceBundle/issues/742) Define simple vars on your operations ([@loic425](https://github.com/loic425))\n- [#743](https://github.com/Sylius/SyliusResourceBundle/issues/743) Update rector/rector requirement from ^0.13.5 to ^0.18.2 ([@dependabot](https://github.com/dependabot)[[@bot](https://github.com/bot)])\n- [#745](https://github.com/Sylius/SyliusResourceBundle/issues/745) Improve testing debug resource command ([@loic425](https://github.com/loic425))\n- [#746](https://github.com/Sylius/SyliusResourceBundle/issues/746) Add POST http method on update, delete and bulk delete operation ([@loic425](https://github.com/loic425))\n- [#747](https://github.com/Sylius/SyliusResourceBundle/issues/747) Fix name of file inside the comments for BookFactory ([@harikt](https://github.com/harikt))\n- [#757](https://github.com/Sylius/SyliusResourceBundle/issues/757) Use AsResource attribute instead of reserved word Resource ([@loic425](https://github.com/loic425))\n- [#758](https://github.com/Sylius/SyliusResourceBundle/issues/758) Remove Component namespace on action ([@loic425](https://github.com/loic425))\n- [#759](https://github.com/Sylius/SyliusResourceBundle/issues/759) Remove Component namespace on annotation ([@loic425](https://github.com/loic425))\n- [#760](https://github.com/Sylius/SyliusResourceBundle/issues/760) Remove Component namespace on context ([@loic425](https://github.com/loic425))\n- [#761](https://github.com/Sylius/SyliusResourceBundle/issues/761) Remove Component namespace on Doctrine ([@loic425](https://github.com/loic425))\n- [#762](https://github.com/Sylius/SyliusResourceBundle/issues/762) Remove Component namespace on state ([@loic425](https://github.com/loic425))\n- [#764](https://github.com/Sylius/SyliusResourceBundle/issues/764) Fix routing with moved attributes ([@loic425](https://github.com/loic425))\n- [#765](https://github.com/Sylius/SyliusResourceBundle/issues/765) Missed typehint for `TranslatableFactoryInterface` ([@Rafikooo](https://github.com/Rafikooo))\n- [#766](https://github.com/Sylius/SyliusResourceBundle/issues/766) Move some namespaces on Storage ([@loic425](https://github.com/loic425))\n- [#767](https://github.com/Sylius/SyliusResourceBundle/issues/767) Move some namespaces on Symfony event dispatchers ([@loic425](https://github.com/loic425))\n- [#769](https://github.com/Sylius/SyliusResourceBundle/issues/769) Move some namespaces on Grid ([@loic425](https://github.com/loic425))\n- [#770](https://github.com/Sylius/SyliusResourceBundle/issues/770) Move some namespaces on Humanizer ([@loic425](https://github.com/loic425))\n- [#772](https://github.com/Sylius/SyliusResourceBundle/issues/772) Move some namespaces on Symfony event listener  ([@loic425](https://github.com/loic425))\n- [#773](https://github.com/Sylius/SyliusResourceBundle/issues/773) Fix response status when method is safe ([@loic425](https://github.com/loic425))\n- [#774](https://github.com/Sylius/SyliusResourceBundle/issues/774) Move some namespaces on new Metadata ([@loic425](https://github.com/loic425))\n- [#775](https://github.com/Sylius/SyliusResourceBundle/issues/775) Move some namespaces on Twig ([@loic425](https://github.com/loic425))\n- [#777](https://github.com/Sylius/SyliusResourceBundle/issues/777) Move some namespaces on Factory ([@loic425](https://github.com/loic425))\n- [#778](https://github.com/Sylius/SyliusResourceBundle/issues/778) Move some namespaces on Symfony expression language ([@loic425](https://github.com/loic425))\n- [#779](https://github.com/Sylius/SyliusResourceBundle/issues/779) Phpunit tests for Symfony deserialize listener ([@loic425](https://github.com/loic425))\n- [#780](https://github.com/Sylius/SyliusResourceBundle/issues/780) Init Deserialize provider ([@loic425](https://github.com/loic425))\n- [#783](https://github.com/Sylius/SyliusResourceBundle/issues/783) Move some namespaces on Symfony forms, requests and responses ([@loic425](https://github.com/loic425))\n- [#784](https://github.com/Sylius/SyliusResourceBundle/issues/784) Move some namespaces on Symfony routing, validator exceptions and workflow ([@loic425](https://github.com/loic425))\n- [#785](https://github.com/Sylius/SyliusResourceBundle/issues/785) Init read provider ([@loic425](https://github.com/loic425))\n- [#786](https://github.com/Sylius/SyliusResourceBundle/issues/786) Fix readme with supported branches ([@loic425](https://github.com/loic425))\n- [#788](https://github.com/Sylius/SyliusResourceBundle/issues/788) Init flash processor ([@loic425](https://github.com/loic425))\n- [#789](https://github.com/Sylius/SyliusResourceBundle/issues/789) Phpunit tests for Symfony respond listener ([@loic425](https://github.com/loic425))\n- [#790](https://github.com/Sylius/SyliusResourceBundle/issues/790) Init respond processor ([@loic425](https://github.com/loic425))\n- [#791](https://github.com/Sylius/SyliusResourceBundle/issues/791) Phpunit tests for Symfony form listener ([@loic425](https://github.com/loic425))\n- [#792](https://github.com/Sylius/SyliusResourceBundle/issues/792) Phpunit tests for Symfony flash listener ([@loic425](https://github.com/loic425))\n- [#793](https://github.com/Sylius/SyliusResourceBundle/issues/793) Init form provider ([@loic425](https://github.com/loic425))\n- [#795](https://github.com/Sylius/SyliusResourceBundle/issues/795) Init factory provider ([@loic425](https://github.com/loic425))\n- [#798](https://github.com/Sylius/SyliusResourceBundle/issues/798) Init validate provider ([@loic425](https://github.com/loic425))\n- [#799](https://github.com/Sylius/SyliusResourceBundle/issues/799) PHPUnit tests for Symfony serialize listener ([@loic425](https://github.com/loic425))\n- [#800](https://github.com/Sylius/SyliusResourceBundle/issues/800) Init serialize processor ([@loic425](https://github.com/loic425))\n- [#801](https://github.com/Sylius/SyliusResourceBundle/issues/801) PHPUnit tests for Symfony write listener ([@loic425](https://github.com/loic425))\n- [#803](https://github.com/Sylius/SyliusResourceBundle/issues/803) PHPUnit tests for Symfony add format listener ([@loic425](https://github.com/loic425))\n- [#804](https://github.com/Sylius/SyliusResourceBundle/issues/804) Move some namespaces on metadata ([@loic425](https://github.com/loic425))\n- [#805](https://github.com/Sylius/SyliusResourceBundle/issues/805) Move some namespaces on generator ([@loic425](https://github.com/loic425))\n- [#806](https://github.com/Sylius/SyliusResourceBundle/issues/806) Move some namespaces on reflection ([@loic425](https://github.com/loic425))\n- [#809](https://github.com/Sylius/SyliusResourceBundle/issues/809) Add support for Symfony 6.4 ([@loic425](https://github.com/loic425))\n- [#810](https://github.com/Sylius/SyliusResourceBundle/issues/810) [CI] Exclude builds for Symfony 6.4 and doctrine/persistence 2.0 ([@GSadee](https://github.com/GSadee), [@loic425](https://github.com/loic425))\n- [#815](https://github.com/Sylius/SyliusResourceBundle/issues/815) PHPUnit tests for factory ([@loic425](https://github.com/loic425))\n- [#816](https://github.com/Sylius/SyliusResourceBundle/issues/816) PHPUnit tests for context ([@loic425](https://github.com/loic425))\n- [#817](https://github.com/Sylius/SyliusResourceBundle/issues/817) Add DI for Main controller, providers and processors ([@loic425](https://github.com/loic425))\n- [#818](https://github.com/Sylius/SyliusResourceBundle/issues/818) Fix Phpspec errors ([@loic425](https://github.com/loic425))\n- [#819](https://github.com/Sylius/SyliusResourceBundle/issues/819) Move some namespaces on model ([@loic425](https://github.com/loic425))\n- [#820](https://github.com/Sylius/SyliusResourceBundle/issues/820) Move some namespaces on repository ([@loic425](https://github.com/loic425))\n- [#821](https://github.com/Sylius/SyliusResourceBundle/issues/821) Fix serialize processor ([@loic425](https://github.com/loic425))\n- [#822](https://github.com/Sylius/SyliusResourceBundle/issues/822) Fix flash processor ([@loic425](https://github.com/loic425))\n- [#823](https://github.com/Sylius/SyliusResourceBundle/issues/823) Fix event dispatcher provider ([@loic425](https://github.com/loic425))\n- [#824](https://github.com/Sylius/SyliusResourceBundle/issues/824) Add main controller ([@loic425](https://github.com/loic425))\n- [#826](https://github.com/Sylius/SyliusResourceBundle/issues/826) Replace decorated by processor  into bulk aware processor ([@loic425](https://github.com/loic425))\n- [#827](https://github.com/Sylius/SyliusResourceBundle/issues/827) Fix respond processor ([@loic425](https://github.com/loic425))\n- [#828](https://github.com/Sylius/SyliusResourceBundle/issues/828) Dispatch pre write event processor ([@loic425](https://github.com/loic425))\n- [#829](https://github.com/Sylius/SyliusResourceBundle/issues/829) Dispatch post write event processor ([@loic425](https://github.com/loic425))\n- [#830](https://github.com/Sylius/SyliusResourceBundle/issues/830) Write processor ([@loic425](https://github.com/loic425))\n- [#831](https://github.com/Sylius/SyliusResourceBundle/issues/831) Move deserialize provider into Symfony namespace ([@loic425](https://github.com/loic425))\n- [#832](https://github.com/Sylius/SyliusResourceBundle/issues/832) Rename event dispatcher provider to dispatch post read event provider ([@loic425](https://github.com/loic425))\n- [#833](https://github.com/Sylius/SyliusResourceBundle/issues/833) Add resource metadata on Twig context ([@loic425](https://github.com/loic425))\n- [#836](https://github.com/Sylius/SyliusResourceBundle/issues/836) Remove cache on metadata when debug is enabled ([@loic425](https://github.com/loic425))\n- [#838](https://github.com/Sylius/SyliusResourceBundle/issues/838) Rename legacy tests directory ([@loic425](https://github.com/loic425))\n- [#841](https://github.com/Sylius/SyliusResourceBundle/issues/841) Add support for PHP 8.3 (CI) ([@loic425](https://github.com/loic425))\n\n### v1.11.0-ALPHA.1 (2023-06-22)\n\n#### Details\n\n- [#493](https://github.com/Sylius/SyliusResourceBundle/issues/493) Add support for Doctrine persistence version 3.0 (@[@loic425](https://github.com/loic425))\n- [#498](https://github.com/Sylius/SyliusResourceBundle/issues/498) Add services' aliases to improve autowiring experience ([@loic425](https://github.com/loic425))\n- [#502](https://github.com/Sylius/SyliusResourceBundle/issues/502) Fix the build ([@loic425](https://github.com/loic425))\n- [#503](https://github.com/Sylius/SyliusResourceBundle/issues/503) Init gitattributes file to preserve the planet ([@loic425](https://github.com/loic425))\n- [#507](https://github.com/Sylius/SyliusResourceBundle/issues/507) Fix Symfony 6 Exception ([@mpysiak](https://github.com/mpysiak), [@lchrusciel](https://github.com/lchrusciel))\n- [#510](https://github.com/Sylius/SyliusResourceBundle/issues/510) Fix declaring repository on resource when it is a service entity repository ([@loic425](https://github.com/loic425))\n- [#530](https://github.com/Sylius/SyliusResourceBundle/issues/530) [DOCS] Change configuration to correct one ()\n- [#545](https://github.com/Sylius/SyliusResourceBundle/issues/545) Update phpspec/phpspec to 7.3 ([@dannyvw](https://github.com/dannyvw))\n- [#549](https://github.com/Sylius/SyliusResourceBundle/issues/549) Hotfix for Attributes routing system ([@loic425](https://github.com/loic425))\n- [#550](https://github.com/Sylius/SyliusResourceBundle/issues/550) Fix build on 1.10 ([@loic425](https://github.com/loic425))\n- [#551](https://github.com/Sylius/SyliusResourceBundle/issues/551) Flip back service ids and FQCN ([@loic425](https://github.com/loic425))\n- [#589](https://github.com/Sylius/SyliusResourceBundle/issues/589) Fix the build on 1.10 branch ([@loic425](https://github.com/loic425))\n- [#607](https://github.com/Sylius/SyliusResourceBundle/issues/607) Allow jms/serializer-bundle ^5.0 ([@dannyvw](https://github.com/dannyvw))\n- [#613](https://github.com/Sylius/SyliusResourceBundle/issues/613) Configure specific state machine component for a resource ([@loic425](https://github.com/loic425))\n- [#659](https://github.com/Sylius/SyliusResourceBundle/issues/659) Debug resource with FQCN ([@loic425](https://github.com/loic425))\n- [#682](https://github.com/Sylius/SyliusResourceBundle/issues/682) [New docs] docs' pagination ([@loic425](https://github.com/loic425))\n- [#687](https://github.com/Sylius/SyliusResourceBundle/issues/687) [New docs] Configure the resource name ([@loic425](https://github.com/loic425))\n- [#689](https://github.com/Sylius/SyliusResourceBundle/issues/689) [New docs] Configure the resource plural name ([@loic425](https://github.com/loic425))\n- [#694](https://github.com/Sylius/SyliusResourceBundle/issues/694) Quick fix for state machine workflow usage with Symfony 6.2 ([@loic425](https://github.com/loic425))\n- [#696](https://github.com/Sylius/SyliusResourceBundle/issues/696) [CI] Add support for PHP 8.2 ([@loic425](https://github.com/loic425))\n- [#700](https://github.com/Sylius/SyliusResourceBundle/issues/700) Fix missing pagerfanta ORM adapter error ([@loic425](https://github.com/loic425))\n- [#701](https://github.com/Sylius/SyliusResourceBundle/issues/701) [HotFix] Flip id with alias on resource loader ([@loic425](https://github.com/loic425))\n- [#706](https://github.com/Sylius/SyliusResourceBundle/issues/706) [Test app] Use Doctrine attributes ([@loic425](https://github.com/loic425))\n- [#717](https://github.com/Sylius/SyliusResourceBundle/issues/717) Fix after upmerge ([@loic425](https://github.com/loic425))\n- [#718](https://github.com/Sylius/SyliusResourceBundle/issues/718) Poc rebased ([@loic425](https://github.com/loic425))\n- [#719](https://github.com/Sylius/SyliusResourceBundle/issues/719) Update licence ([@Rafikooo](https://github.com/Rafikooo))\n- [#723](https://github.com/Sylius/SyliusResourceBundle/issues/723) Fix default templates dir ([@loic425](https://github.com/loic425))\n- [#724](https://github.com/Sylius/SyliusResourceBundle/issues/724) Add flash from event on processor ([@lchrusciel](https://github.com/lchrusciel))\n- [#726](https://github.com/Sylius/SyliusResourceBundle/issues/726) Update license ([@Zales0123](https://github.com/Zales0123))\n- [#727](https://github.com/Sylius/SyliusResourceBundle/issues/727) Bulk update ([@loic425](https://github.com/loic425))\n- [#728](https://github.com/Sylius/SyliusResourceBundle/issues/728) Psalm fix after upmerge ([@Zales0123](https://github.com/Zales0123))\n\n### v1.10.3 (2023-12-01)\n\n#### Details\n\n- [#589](https://github.com/Sylius/SyliusResourceBundle/issues/589) Fix the build on 1.10 branch ([@loic425](https://github.com/loic425))\n- [#493](https://github.com/Sylius/SyliusResourceBundle/issues/493) Add support for Doctrine persistence version 3.0 (@[@loic425](https://github.com/loic425))\n- [#701](https://github.com/Sylius/SyliusResourceBundle/issues/701) [HotFix] Flip id with alias on resource loader ([@loic425](https://github.com/loic425))\n- [#700](https://github.com/Sylius/SyliusResourceBundle/issues/700) Fix missing pagerfanta ORM adapter error ([@loic425](https://github.com/loic425))\n- [#694](https://github.com/Sylius/SyliusResourceBundle/issues/694) Quick fix for state machine workflow usage with Symfony 6.2 ([@loic425](https://github.com/loic425))\n- [#538](https://github.com/Sylius/SyliusResourceBundle/issues/538) fix(flashbag): fixed addFlash in ControllerTrait for Symfony 6 ([@UlrichHP](https://github.com/UlrichHP))\n- [#765](https://github.com/Sylius/SyliusResourceBundle/issues/765) Missed typehint for `TranslatableFactoryInterface` ([@Rafikooo](https://github.com/Rafikooo))\n- [#809](https://github.com/Sylius/SyliusResourceBundle/issues/809) Add support for Symfony 6.4 ([@loic425](https://github.com/loic425))\n\n### v1.10.2 (2023-01-04)\n\n#### Details\n\n- [#510](https://github.com/Sylius/SyliusResourceBundle/issues/510) Fix declaring repository on resource when it is a service entity repository ([@loic425](https://github.com/loic425))\n- [#530](https://github.com/Sylius/SyliusResourceBundle/issues/530) [DOCS] Change configuration to correct one ([@arti0090](https://github.com/arti0090))\n- [#549](https://github.com/Sylius/SyliusResourceBundle/issues/549) Hotfix for Attributes routing system ([@loic425](https://github.com/loic425))\n- [#550](https://github.com/Sylius/SyliusResourceBundle/issues/550) Fix build on 1.10 ([@loic425](https://github.com/loic425))\n- [#551](https://github.com/Sylius/SyliusResourceBundle/issues/551) Flip back service ids and FQCN ([@loic425](https://github.com/loic425))\n\n### v1.10.1 (2022-12-05)\n\n#### Details\n\n- [#498](https://github.com/Sylius/SyliusResourceBundle/issues/498) Add services' aliases to improve autowiring experience ([@loic425](https://github.com/loic425))\n- [#502](https://github.com/Sylius/SyliusResourceBundle/issues/502) Fix the build ([@loic425](https://github.com/loic425))\n- [#503](https://github.com/Sylius/SyliusResourceBundle/issues/503) Init gitattributes file to preserve the planet ([@loic425](https://github.com/loic425))\n- [#507](https://github.com/Sylius/SyliusResourceBundle/issues/507) Fix Symfony 6 Exception ([@mpysiak](https://github.com/mpysiak), [@lchrusciel](https://github.com/lchrusciel))\n\n### v1.10.0 (2022-10-31)\n\n#### Details\n\n- [#489](https://github.com/Sylius/SyliusResourceBundle/issues/489) Fix can apply a transition on workflow with a graph ([@loic425](https://github.com/loic425))\n- [#492](https://github.com/Sylius/SyliusResourceBundle/issues/492) [Maintenance] Out-of-date phpstan/phpdoc-parser conflict removed, docker static analysis memory limit increased ([@Rafikooo](https://github.com/Rafikooo))\n- [#495](https://github.com/Sylius/SyliusResourceBundle/issues/495) Inform about potential BC break after response code change ([@Zales0123](https://github.com/Zales0123))\n\n### v1.10.0-BETA.1 (2022-10-18)\n\n#### Details\n\n- [#341](https://github.com/Sylius/SyliusResourceBundle/issues/341) Dropping usage of Request->get ([@loic425](https://github.com/loic425), [@Zales0123](https://github.com/Zales0123))\n- [#450](https://github.com/Sylius/SyliusResourceBundle/issues/450) Adjust when some runtime deprecation notices are triggered and use Symfony's trigger_deprecation() helper ([@mbabker](https://github.com/mbabker))\n- [#467](https://github.com/Sylius/SyliusResourceBundle/issues/467) [README] Add development section and update links ([@lchrusciel](https://github.com/lchrusciel))\n- [#478](https://github.com/Sylius/SyliusResourceBundle/issues/478) Add tests with grids ([@loic425](https://github.com/loic425))\n- [#487](https://github.com/Sylius/SyliusResourceBundle/issues/487) Make CsrfTokenManager public ([@Zales0123](https://github.com/Zales0123))\n- [#488](https://github.com/Sylius/SyliusResourceBundle/issues/488) Return 422 status code when the form fails ([@belmeopmenieuwesim](https://github.com/belmeopmenieuwesim), [@Zales0123](https://github.com/Zales0123))\n\n### v1.10.0-ALPHA.2 (2022-09-09)\n\n#### Details\n\n- [#446](https://github.com/Sylius/SyliusResourceBundle/issues/446) [Maintenance] Add flex support to global composer ([@lchrusciel](https://github.com/lchrusciel))\n- [#454](https://github.com/Sylius/SyliusResourceBundle/issues/454) Add generic typehint to RepositoryInterface and FactoryInterface ([@MrSrsen](https://github.com/MrSrsen))\n- [#458](https://github.com/Sylius/SyliusResourceBundle/issues/458) Basic configuration of Gitbook ([@Zales0123](https://github.com/Zales0123))\n- [#459](https://github.com/Sylius/SyliusResourceBundle/issues/459) Fix coding standards to fix the build ([@Zales0123](https://github.com/Zales0123))\n- [#460](https://github.com/Sylius/SyliusResourceBundle/issues/460) [Maintenance] Allow flex plugin during plugin installation ([@lchrusciel](https://github.com/lchrusciel))\n- [#461](https://github.com/Sylius/SyliusResourceBundle/issues/461) [docker]Dockerized Resource Bundle ([@Ferror](https://github.com/Ferror), [@lchrusciel](https://github.com/lchrusciel))\n- [#462](https://github.com/Sylius/SyliusResourceBundle/issues/462) Configure global symfony/flex plugin ([@Zales0123](https://github.com/Zales0123))\n- [#465](https://github.com/Sylius/SyliusResourceBundle/issues/465) [Maintenance] Downgrade rector to fix build ([@lchrusciel](https://github.com/lchrusciel))\n- [#466](https://github.com/Sylius/SyliusResourceBundle/issues/466) Update rector/rector requirement from ^0.12.20 to ^0.13.5 ([@dependabot](https://github.com/dependabot)[[@bot](https://github.com/bot)])\n- [#470](https://github.com/Sylius/SyliusResourceBundle/issues/470) [CI] Fix the build for 1.10 ([@loic425](https://github.com/loic425))\n- [#471](https://github.com/Sylius/SyliusResourceBundle/issues/471) [Symfony 6] Fix submitting a form ([@loic425](https://github.com/loic425))\n- [#474](https://github.com/Sylius/SyliusResourceBundle/issues/474) Resource alias, always return 2 array items ([@Prometee](https://github.com/Prometee), [@lchrusciel](https://github.com/lchrusciel))\n\n### v1.10.0-ALPHA.1 (2022-05-16)\n\n#### TL;DR\n\nDrop Symfony 4 support, add Symfony 6 support 🚀\n\n#### Details\n\n- [#379](https://github.com/Sylius/SyliusResourceBundle/issues/379) Fix setDeprecated deprecation ([@dannyvw](https://github.com/dannyvw))\n- [#380](https://github.com/Sylius/SyliusResourceBundle/issues/380) Fix session deprecation ([@dannyvw](https://github.com/dannyvw))\n- [#399](https://github.com/Sylius/SyliusResourceBundle/issues/399) [Symfony 6] Fix Kernel on test app ([@loic425](https://github.com/loic425))\n- [#401](https://github.com/Sylius/SyliusResourceBundle/issues/401) [Symfony 6] Use storage factory id option on test app ([@loic425](https://github.com/loic425))\n- [#402](https://github.com/Sylius/SyliusResourceBundle/issues/402) [Symfony 6] Fix http foundation request handler typehints ([@loic425](https://github.com/loic425))\n- [#408](https://github.com/Sylius/SyliusResourceBundle/issues/408) [1.10] Correct branch alias to 1.10-dev ([@Zales0123](https://github.com/Zales0123))\n- [#411](https://github.com/Sylius/SyliusResourceBundle/issues/411) [Symfony 6] Bump Psalm version from 4.7 to 4.22 ([@loic425](https://github.com/loic425))\n- [#412](https://github.com/Sylius/SyliusResourceBundle/issues/412) [Symfony 6] Fix bootstrap on test app ([@loic425](https://github.com/loic425))\n- [#413](https://github.com/Sylius/SyliusResourceBundle/issues/413) [Symfony 6] Fix setting deprecations on pagerfanta bridge pass ([@loic425](https://github.com/loic425))\n- [#418](https://github.com/Sylius/SyliusResourceBundle/issues/418) [Symfony 6] Fix getting container on PHPUnit tests ([@loic425](https://github.com/loic425))\n- [#419](https://github.com/Sylius/SyliusResourceBundle/issues/419) [Symfony 6] Fix routes on test app ([@loic425](https://github.com/loic425))\n- [#426](https://github.com/Sylius/SyliusResourceBundle/issues/426) Add missing options on sylius route attribute ([@loic425](https://github.com/loic425))\n- [#428](https://github.com/Sylius/SyliusResourceBundle/issues/428) Add support for Symfony 6  ([@loic425](https://github.com/loic425), [@lchrusciel](https://github.com/lchrusciel))\n- [#430](https://github.com/Sylius/SyliusResourceBundle/issues/430) Drop Symfony 4 support ([@loic425](https://github.com/loic425))\n- [#431](https://github.com/Sylius/SyliusResourceBundle/issues/431) Simplify Kernel on test app ([@loic425](https://github.com/loic425))\n- [#433](https://github.com/Sylius/SyliusResourceBundle/issues/433) Remove session pass ([@loic425](https://github.com/loic425))\n- [#434](https://github.com/Sylius/SyliusResourceBundle/issues/434) [Maintenance] Bump EasyCodingStandard dependency ([@lchrusciel](https://github.com/lchrusciel))\n- [#435](https://github.com/Sylius/SyliusResourceBundle/issues/435) [Maintenance] Removal of Sf4.4 BC layer leftovers ([@lchrusciel](https://github.com/lchrusciel))\n- [#437](https://github.com/Sylius/SyliusResourceBundle/issues/437) Remove is master request usage ([@loic425](https://github.com/loic425))\n- [#439](https://github.com/Sylius/SyliusResourceBundle/issues/439) Fix Phpspec for symfony 6 ([@loic425](https://github.com/loic425))\n- [#440](https://github.com/Sylius/SyliusResourceBundle/issues/440) Fix some other getting container deprecations ([@loic425](https://github.com/loic425))\n- [#444](https://github.com/Sylius/SyliusResourceBundle/issues/444) [Symfony 6] Third solution to fix resource controllers ([@loic425](https://github.com/loic425))\n- [#445](https://github.com/Sylius/SyliusResourceBundle/issues/445) [Maintenance] Drop Sf4 ACL on parameters class due to lack of its support ([@lchrusciel](https://github.com/lchrusciel))\n\n### v1.9.1 (2022-05-16)\n\n#### Details\n\n- [#407](https://github.com/Sylius/SyliusResourceBundle/issues/407) [1.8] Correct branch alias to 1.8-dev ([@Zales0123](https://github.com/Zales0123))\n- [#409](https://github.com/Sylius/SyliusResourceBundle/issues/409) Document supported branches ([@Zales0123](https://github.com/Zales0123))\n- [#416](https://github.com/Sylius/SyliusResourceBundle/issues/416) Revert \"Bump Pagerfanta from 2.x to 3.x\" ([@lchrusciel](https://github.com/lchrusciel))\n- [#417](https://github.com/Sylius/SyliusResourceBundle/issues/417) Revert \"Revert \"Bump Pagerfanta from 2.x to 3.x\"\" ([@lchrusciel](https://github.com/lchrusciel))\n- [#424](https://github.com/Sylius/SyliusResourceBundle/issues/424) Run lint container instead of smoke test for twig ([@loic425](https://github.com/loic425))\n- [#425](https://github.com/Sylius/SyliusResourceBundle/issues/425) Run lint container for state machine instead of smoke tests ([@loic425](https://github.com/loic425))\n- [#432](https://github.com/Sylius/SyliusResourceBundle/issues/432) [Maintenance] Correct branch alias to 1.9-dev ([@lchrusciel](https://github.com/lchrusciel))\n- [#446](https://github.com/Sylius/SyliusResourceBundle/issues/446) [Maintenance] Simplify GitHub action workflow ([@lchrusciel](https://github.com/lchrusciel))\n\n### v1.9.0 (2022-04-07)\n\n#### TL;DR\n\nStable 1.9.0 release 🎉🎉🎉\n\n- PHP bumped to ^8.0\n- PHP 7.4 syntaxt\n- Sylius Resource routes generated with PHP attributes\n- Support for Symfony Workflow\n- Simpler usage of new service entity repository\n- Multiple bug fixes and improvements\n\n#### Details\n\n- [#375](https://github.com/Sylius/SyliusResourceBundle/issues/375) Testing build with PHP 8.1 ([@loic425](https://github.com/loic425))\n- [#378](https://github.com/Sylius/SyliusResourceBundle/issues/378) Fix phpdoc for getTranslations ([@dannyvw](https://github.com/dannyvw))\n- [#381](https://github.com/Sylius/SyliusResourceBundle/issues/381) Bump Pagerfanta from 2.x to 3.x ([@mbabker](https://github.com/mbabker))\n- [#403](https://github.com/Sylius/SyliusResourceBundle/issues/403) Add form attribute on SyliusCrudRoute ([@loic425](https://github.com/loic425))\n- [#405](https://github.com/Sylius/SyliusResourceBundle/issues/405) Fix the build ([@loic425](https://github.com/loic425))\n- [#406](https://github.com/Sylius/SyliusResourceBundle/issues/406) Allow to run GitHub actions manually + fix build on 1.8 ([@Zales0123](https://github.com/Zales0123))\n\n### v1.9.0-RC.1 (2022-02-28)\n\n#### Details\n\n- [#338](https://github.com/Sylius/SyliusResourceBundle/issues/338) Fix some Symfony Deprecations ([@dannyvw](https://github.com/dannyvw))\n- [#373](https://github.com/Sylius/SyliusResourceBundle/issues/373) Fix the build after #338 ([@Zales0123](https://github.com/Zales0123))\n\n### v1.9.0-BETA.1 (2022-02-10)\n\n#### Details\n\n- [#365](https://github.com/Sylius/SyliusResourceBundle/issues/365) Fix route loaders ([@loic425](https://github.com/loic425))\n\n### v1.9.0-ALPHA.1 (2022-01-25)\n\n#### TL;DR\n\n- Bump required PHP version to ^8.0 and use PHP 7.4 syntax\n- Generate Sylius Resource routes with PHP attributes\n- Add support for Symfony Workflow\n\n#### Details\n\n- [#287](https://github.com/Sylius/SyliusResourceBundle/issues/287) Manage event response in show and index action to be able to redirect ([@maximehuran](https://github.com/maximehuran), [@Zales0123](https://github.com/Zales0123))\n- [#298](https://github.com/Sylius/SyliusResourceBundle/issues/298) Allow use with Pagerfanta 3.0 ([@mbabker](https://github.com/mbabker))\n- [#310](https://github.com/Sylius/SyliusResourceBundle/issues/310) Upgrade to GitHub-native Dependabot ([@dependabot-preview](https://github.com/dependabot-preview)[[@bot](https://github.com/bot)])\n- [#328](https://github.com/Sylius/SyliusResourceBundle/issues/328) Use PHP 7.4 syntax ([@Zales0123](https://github.com/Zales0123))\n- [#330](https://github.com/Sylius/SyliusResourceBundle/issues/330) Add a simple way to use the new service entity repository ([@loic425](https://github.com/loic425))\n- [#332](https://github.com/Sylius/SyliusResourceBundle/issues/332) Change all MasterRequest calls to MainRequest ([@Roshyo](https://github.com/Roshyo), [@Zales0123](https://github.com/Zales0123))\n- [#333](https://github.com/Sylius/SyliusResourceBundle/issues/333) Don't use deprecated Twig `spaceless` tag ([@stloyd](https://github.com/stloyd))\n- [#334](https://github.com/Sylius/SyliusResourceBundle/issues/334) Sylius route with attributes ([@loic425](https://github.com/loic425))\n- [#334](https://github.com/Sylius/SyliusResourceBundle/issues/334) Symfony workflow ([@loic425](https://github.com/loic425))\n- [#340](https://github.com/Sylius/SyliusResourceBundle/issues/340) Allow jms/serializer-bundle 4 ([@dannyvw](https://github.com/dannyvw))\n- [#343](https://github.com/Sylius/SyliusResourceBundle/issues/343) Change ECS config to php and run it ([@Zales0123](https://github.com/Zales0123))\n- [#344](https://github.com/Sylius/SyliusResourceBundle/issues/344) Remove travis build status from README ([@GSadee](https://github.com/GSadee))\n- [#345](https://github.com/Sylius/SyliusResourceBundle/issues/345) Update phpstan/phpstan requirement from 0.12.94 to 0.12.99 ([@dependabot](https://github.com/dependabot)[[@bot](https://github.com/bot)])\n- [#347](https://github.com/Sylius/SyliusResourceBundle/issues/347) Update phpstan/phpstan-webmozart-assert requirement from 0.12.12 to 0.12.16 ([@dependabot](https://github.com/dependabot)[[@bot](https://github.com/bot)])\n- [#348](https://github.com/Sylius/SyliusResourceBundle/issues/348) Update phpstan/phpstan-phpunit requirement from 0.12.18 to 0.12.22 ([@dependabot](https://github.com/dependabot)[[@bot](https://github.com/bot)])\n- [#349](https://github.com/Sylius/SyliusResourceBundle/issues/349) Update winzou/state-machine-bundle requirement from ^0.5 to ^0.6 ([@dependabot](https://github.com/dependabot)[[@bot](https://github.com/bot)])\n- [#353](https://github.com/Sylius/SyliusResourceBundle/issues/353) Require symfony/routing and symfony/http-foundation 4.4 and 5.4 ([@Zales0123](https://github.com/Zales0123))\n- [#354](https://github.com/Sylius/SyliusResourceBundle/issues/354) Reactivate checking coding standard ([@loic425](https://github.com/loic425))\n- [#356](https://github.com/Sylius/SyliusResourceBundle/issues/356) Add documentation for Routes with attributes ([@loic425](https://github.com/loic425))\n- [#358](https://github.com/Sylius/SyliusResourceBundle/issues/358) Fix docs for crud routes with attributes ([@loic425](https://github.com/loic425))\n- [#359](https://github.com/Sylius/SyliusResourceBundle/issues/359) Fix type of serialization groups ([@loic425](https://github.com/loic425))\n\n### v1.8.4 (2022-04-11)\n\n#### Details\n\n- [#416](https://github.com/Sylius/SyliusResourceBundle/issues/416) Revert \"Bump Pagerfanta from 2.x to 3.x\" ([@lchrusciel](https://github.com/lchrusciel))\n\n### v1.8.3 (2022-04-07)\n\n#### Details\n\n- [#375](https://github.com/Sylius/SyliusResourceBundle/issues/375) Testing build with PHP 8.1 ([@loic425](https://github.com/loic425))\n- [#381](https://github.com/Sylius/SyliusResourceBundle/issues/381) Bump Pagerfanta from 2.x to 3.x ([@mbabker](https://github.com/mbabker))\n- [#406](https://github.com/Sylius/SyliusResourceBundle/issues/406) Allow to run GitHub actions manually + fix build on 1.8 ([@Zales0123](https://github.com/Zales0123))\n\n### v1.8.2 (2021-04-08)\n\n#### Details\n\n- [#304](https://github.com/Sylius/SyliusResourceBundle/issues/304) Fix doctrine extensions version on component ([@loic425](https://github.com/loic425))\n- [#303](https://github.com/Sylius/SyliusResourceBundle/issues/303) fix namespace of `ConfigurationTest` ([@bendavies](https://github.com/bendavies))\n- [#302](https://github.com/Sylius/SyliusResourceBundle/issues/302) Fix namespace of `WinzouStateMachinePassTest` ([@bendavies](https://github.com/bendavies))\n- [#301](https://github.com/Sylius/SyliusResourceBundle/issues/301) Update phpstan/phpstan requirement from 0.12.82 to 0.12.83 ([@dependabot-preview](https://github.com/dependabot-preview)[[@bot](https://github.com/bot)])\n- [#300](https://github.com/Sylius/SyliusResourceBundle/issues/300) Update vimeo/psalm requirement from 4.6.4 to 4.7.0 ([@dependabot-preview](https://github.com/dependabot-preview)[[@bot](https://github.com/bot)])\n\n### v1.8.1 (2021-03-19)\n\n#### Details\n\n- [#297](https://github.com/Sylius/SyliusResourceBundle/issues/297) Skip registering controllers as a services if there is no custom class defined ([@pamil](https://github.com/pamil))\n\n### v1.8.0 (2021-03-19)\n\n#### TL;DR\n\n- Added support for PHP 8\n- Removed StofDoctrineExtensionsBundle from dependencies\n- Remvoed support for winzou/state-machine-bundle <0.5\n\n#### Details\n\n- [#210](https://github.com/Sylius/SyliusResourceBundle/issues/210) Add compatibility with PHP 8 ([@pamil](https://github.com/pamil))\n- [#247](https://github.com/Sylius/SyliusResourceBundle/issues/247) Fix wrong licence on test app's kernel ([@loic425](https://github.com/loic425))\n- [#255](https://github.com/Sylius/SyliusResourceBundle/issues/255) Add autowire for resource Controllers ([@AdamKasp](https://github.com/AdamKasp), [@lchrusciel](https://github.com/lchrusciel))\n- [#259](https://github.com/Sylius/SyliusResourceBundle/issues/259) [Minor] Add symfony.lock to git ignore ([@lchrusciel](https://github.com/lchrusciel))\n- [#264](https://github.com/Sylius/SyliusResourceBundle/issues/264) Fix the build ([@pamil](https://github.com/pamil))\n- [#283](https://github.com/Sylius/SyliusResourceBundle/issues/283) Remove StofDoctrineExtensionsBundle and replace it with GedmoDoctrineExtensions ([@pamil](https://github.com/pamil))\n- [#285](https://github.com/Sylius/SyliusResourceBundle/issues/285) Drop winzou/state-machine-bundle <0.5 ([@pamil](https://github.com/pamil))\n\n### v1.7.1 (2020-12-09)\n\n#### Details\n\n- [#243](https://github.com/Sylius/SyliusResourceBundle/issues/243) Add back winzou/state-machine to required packages of the component ([@pamil](https://github.com/pamil))\n\n### v1.7.0 (2020-12-09)\n\nThese are complete release notes summing up all BETA and RC releases.\n\n#### TL;DR\n\n- Bumped up requirements from PHP 7.2 to PHP 7.3\n- Dropped support for Symfony ^3.4, added support for Symfony ^5.1\n- Added support for `doctrine/doctrine-bundle` in version `^2.0`\n- Added support for `winzou/state-machine-bundle` in versions `^0.4.3` and `^0.5`\n- Bumped up `friendsofsymfony/rest-bundle` requirements from `^2.1` to `^3.0`\n- Bumped up `jms/serializer-bundle` requirements from `^2.0` to `^3.5`\n- Bumped up `willdurand/hateoas-bundle` requirements from `^1.2` to `^2.0`\n- Removed the usage of deprecated `doctrine/inflector` API, added support for version `^2.0`\n- Replaced `white-october/pagerfanta-bundle:^1.0` with `babdev/pagerfanta-bundle:^2.5`\n- Deduplicated repositories retrieved from the service container and from the object manager \n\n#### Details\n\n- [#114](https://github.com/Sylius/SyliusResourceBundle/issues/114) Updating composer dependencies ([@mamazu](https://github.com/mamazu))\n- [#117](https://github.com/Sylius/SyliusResourceBundle/issues/117) Fix extended types deprecation ([@dannyvw](https://github.com/dannyvw))\n- [#119](https://github.com/Sylius/SyliusResourceBundle/issues/119) Update composer dependencies ([@pamil](https://github.com/pamil), [@dannyvw](https://github.com/dannyvw))\n- [#124](https://github.com/Sylius/SyliusResourceBundle/issues/124) Replace deprecated doctrine object manager ([@loic425](https://github.com/loic425))\n- [#125](https://github.com/Sylius/SyliusResourceBundle/issues/125) Replace deprecated doctrine object repository ([@loic425](https://github.com/loic425))\n- [#126](https://github.com/Sylius/SyliusResourceBundle/issues/126) Replace dbal types ([@loic425](https://github.com/loic425))\n- [#127](https://github.com/Sylius/SyliusResourceBundle/issues/127) Fix phpspec tests on DefaultFormBuilder ([@loic425](https://github.com/loic425))\n- [#128](https://github.com/Sylius/SyliusResourceBundle/issues/128) Lock static analysis tools versions & fix the build ([@pamil](https://github.com/pamil))\n- [#129](https://github.com/Sylius/SyliusResourceBundle/issues/129) Add support for PHP 7.4 and Symfony 4.4 ([@pamil](https://github.com/pamil), [@dannyvw](https://github.com/dannyvw))\n- [#130](https://github.com/Sylius/SyliusResourceBundle/issues/130) Remove deprecated templating configuration ([@dannyvw](https://github.com/dannyvw))\n- [#131](https://github.com/Sylius/SyliusResourceBundle/issues/131) Allow twig 3.x ([@dannyvw](https://github.com/dannyvw))\n- [#132](https://github.com/Sylius/SyliusResourceBundle/issues/132) Fix controller deprecation ([@dannyvw](https://github.com/dannyvw))\n- [#133](https://github.com/Sylius/SyliusResourceBundle/issues/133) Fix testing multiple Symfony versions, add build for 5.0 & remove support for <4.4 ([@pamil](https://github.com/pamil))\n- [#135](https://github.com/Sylius/SyliusResourceBundle/issues/135) Allow for DoctrineBundle ^2.0 ([@pamil](https://github.com/pamil))\n- [#136](https://github.com/Sylius/SyliusResourceBundle/issues/136) Remove unneccessary dependency on winzou/state-machine in the component ([@pamil](https://github.com/pamil))\n- [#138](https://github.com/Sylius/SyliusResourceBundle/issues/138) Remove legacy di configuration ([@dannyvw](https://github.com/dannyvw))\n- [#139](https://github.com/Sylius/SyliusResourceBundle/issues/139) Fix event dispatcher deprecation ([@dannyvw](https://github.com/dannyvw))\n- [#141](https://github.com/Sylius/SyliusResourceBundle/issues/141) Upgrade to PHPStan 0.12 ([@GSadee](https://github.com/GSadee))\n- [#142](https://github.com/Sylius/SyliusResourceBundle/issues/142) Github repository configuration from Sylius/Sylius ([@CoderMaggie](https://github.com/CoderMaggie))\n- [#143](https://github.com/Sylius/SyliusResourceBundle/issues/143) [Maintenance] Updated branch alias ([@lchrusciel](https://github.com/lchrusciel))\n- [#144](https://github.com/Sylius/SyliusResourceBundle/issues/144) [Maintenance] Update github templates ([@lchrusciel](https://github.com/lchrusciel))\n- [#151](https://github.com/Sylius/SyliusResourceBundle/issues/151) [Maintenance] Bump ApiTestCase to v5.0 ([@lchrusciel](https://github.com/lchrusciel))\n- [#159](https://github.com/Sylius/SyliusResourceBundle/issues/159) Remove duplicated docblocks ([@GSadee](https://github.com/GSadee))\n- [#160](https://github.com/Sylius/SyliusResourceBundle/issues/160) ResourceBundle documentation extracted to its repository ([@SirDomin](https://github.com/SirDomin))\n- [#161](https://github.com/Sylius/SyliusResourceBundle/issues/161) [HOTFIX] Conflict with amphp/amp 2.4.3 ([@lchrusciel](https://github.com/lchrusciel))\n- [#162](https://github.com/Sylius/SyliusResourceBundle/issues/162) [Documentation] Fix index menu ([@SirDomin](https://github.com/SirDomin))\n- [#163](https://github.com/Sylius/SyliusResourceBundle/issues/163) [HOTFIX] Conflict with the newest amphp/amp ([@lchrusciel](https://github.com/lchrusciel))\n- [#165](https://github.com/Sylius/SyliusResourceBundle/issues/165) Fix the build ([@pamil](https://github.com/pamil))\n- [#167](https://github.com/Sylius/SyliusResourceBundle/issues/167) Upgrade rest bundle ([@loic425](https://github.com/loic425))\n- [#168](https://github.com/Sylius/SyliusResourceBundle/issues/168) [Docs] Serialization groups of the elements in a paginated collection ([@vvasiloi](https://github.com/vvasiloi))\n- [#172](https://github.com/Sylius/SyliusResourceBundle/issues/172) Check if form is submitted on resource creation/edition ([@loic425](https://github.com/loic425))\n- [#173](https://github.com/Sylius/SyliusResourceBundle/issues/173) Remove rest dependencies ([@loic425](https://github.com/loic425), [@pamil](https://github.com/pamil))\n- [#175](https://github.com/Sylius/SyliusResourceBundle/issues/175) Upgrade PagerfantaBundle to new version with B/C layer ([@mbabker](https://github.com/mbabker))\n- [#177](https://github.com/Sylius/SyliusResourceBundle/issues/177) Pagerfanta updates ([@mbabker](https://github.com/mbabker))\n- [#178](https://github.com/Sylius/SyliusResourceBundle/issues/178) When using winzouStateMachineBundle 0.4, the old named services are aliases, so need to be marked public as well ([@mbabker](https://github.com/mbabker), [@pamil](https://github.com/pamil))\n- [#181](https://github.com/Sylius/SyliusResourceBundle/issues/181) Fix build ([@loic425](https://github.com/loic425))\n- [#182](https://github.com/Sylius/SyliusResourceBundle/issues/182) Testing several state machine versions ([@loic425](https://github.com/loic425))\n- [#187](https://github.com/Sylius/SyliusResourceBundle/issues/187) Symfony 5 support ([@loic425](https://github.com/loic425))\n- [#189](https://github.com/Sylius/SyliusResourceBundle/issues/189) Require webmozart/assert as it's used by the bundle code ([@pamil](https://github.com/pamil))\n- [#190](https://github.com/Sylius/SyliusResourceBundle/issues/190) Fix errors reported by static analysis tools ([@pamil](https://github.com/pamil))\n- [#191](https://github.com/Sylius/SyliusResourceBundle/issues/191) Normalise composer.json (with ergebnis/composer-normalize) ([@pamil](https://github.com/pamil))\n- [#192](https://github.com/Sylius/SyliusResourceBundle/issues/192) Remove conflict with amphp/amp ([@pamil](https://github.com/pamil))\n- [#193](https://github.com/Sylius/SyliusResourceBundle/issues/193) Bump up requirements to PHP ^7.3 ([@pamil](https://github.com/pamil))\n- [#194](https://github.com/Sylius/SyliusResourceBundle/issues/194) Fix deprecations and errors while running PHPUnit ([@pamil](https://github.com/pamil))\n- [#195](https://github.com/Sylius/SyliusResourceBundle/issues/195) Upgrade to Psalm v3.17.1 ([@pamil](https://github.com/pamil))\n- [#196](https://github.com/Sylius/SyliusResourceBundle/issues/196) Remove unnecessary dev dependency on \"polishsymfonycommunity/symfony-mocker-container\" ([@pamil](https://github.com/pamil))\n- [#197](https://github.com/Sylius/SyliusResourceBundle/issues/197) Make RegisterFormBuilderPass accept multiple tags on a single service ([@pamil](https://github.com/pamil))\n- [#198](https://github.com/Sylius/SyliusResourceBundle/issues/198) Bump up minimal requirements to Symfony ^5.1 ([@pamil](https://github.com/pamil))\n- [#199](https://github.com/Sylius/SyliusResourceBundle/issues/199) Update the year in LICENSE file ([@ValentineJester](https://github.com/ValentineJester))\n- [#200](https://github.com/Sylius/SyliusResourceBundle/issues/200) Use HTTPS instead of HTTP in links in composer.json ([@ValentineJester](https://github.com/ValentineJester))\n- [#201](https://github.com/Sylius/SyliusResourceBundle/issues/201) Remove outdated persistence backends from the documentation ([@ValentineJester](https://github.com/ValentineJester))\n- [#202](https://github.com/Sylius/SyliusResourceBundle/issues/202) Remove winzou state machine dependency ([@loic425](https://github.com/loic425))\n- [#204](https://github.com/Sylius/SyliusResourceBundle/issues/204) Replace AbstractController with ControllerTrait & ContainerAwareInterface ([@pamil](https://github.com/pamil))\n- [#206](https://github.com/Sylius/SyliusResourceBundle/issues/206) Remove twig bundle dependency ([@loic425](https://github.com/loic425))\n- [#207](https://github.com/Sylius/SyliusResourceBundle/issues/207) Bump doctrine/persistance version ([@dotdevru](https://github.com/dotdevru))\n- [#209](https://github.com/Sylius/SyliusResourceBundle/issues/209) [Travis] Use symfony/flex ^1.10 instead of dev-master ([@pamil](https://github.com/pamil))\n- [#211](https://github.com/Sylius/SyliusResourceBundle/issues/211) Upgrade to Psalm 4 ([@pamil](https://github.com/pamil))\n- [#212](https://github.com/Sylius/SyliusResourceBundle/issues/212) Normalise composer.json ([@pamil](https://github.com/pamil))\n- [#213](https://github.com/Sylius/SyliusResourceBundle/issues/213) Update component's composer.json and normalise it ([@pamil](https://github.com/pamil))\n- [#214](https://github.com/Sylius/SyliusResourceBundle/issues/214) Do not use deprecated Doctrine Inflector API ([@pamil](https://github.com/pamil))\n- [#215](https://github.com/Sylius/SyliusResourceBundle/issues/215) Fix InMemoryRepository::applyOrder implementation ([@pamil](https://github.com/pamil))\n- [#216](https://github.com/Sylius/SyliusResourceBundle/issues/216) [CI] Better job naming ([@pamil](https://github.com/pamil))\n- [#220](https://github.com/Sylius/SyliusResourceBundle/issues/220) Duplicate initialisation of repositories ([@Fantus](https://github.com/Fantus))\n- [#224](https://github.com/Sylius/SyliusResourceBundle/issues/224) Require previously required dependencies ([@pamil](https://github.com/pamil))\n- [#225](https://github.com/Sylius/SyliusResourceBundle/issues/225) Bump up dev dependencies ([@pamil](https://github.com/pamil))\n- [#226](https://github.com/Sylius/SyliusResourceBundle/issues/226) Remove Gedmo/DoctrineExtensions from dependencies ([@pamil](https://github.com/pamil))\n- [#227](https://github.com/Sylius/SyliusResourceBundle/issues/227) Apply misc static analysis fixes ([@pamil](https://github.com/pamil))\n- [#228](https://github.com/Sylius/SyliusResourceBundle/issues/228) Add an ability to define your own Inflector for Metadata class ([@pamil](https://github.com/pamil))\n- [#229](https://github.com/Sylius/SyliusResourceBundle/issues/229) Fix tests namespace in the bundle ([@pamil](https://github.com/pamil))\n- [#230](https://github.com/Sylius/SyliusResourceBundle/issues/230) Do not rely on services in DoctrineORMDriver ([@pamil](https://github.com/pamil))\n- [#231](https://github.com/Sylius/SyliusResourceBundle/issues/231) Remove unnecessary BC layer for symfony/dependency-injection <=4.2 ([@pamil](https://github.com/pamil))\n- [#232](https://github.com/Sylius/SyliusResourceBundle/issues/232) Create ResourceBundle's EntityRepository only if custom repository is not set ([@pamil](https://github.com/pamil))\n- [#234](https://github.com/Sylius/SyliusResourceBundle/issues/234) Refactor test app ([@loic425](https://github.com/loic425))\n- [#238](https://github.com/Sylius/SyliusResourceBundle/issues/238) Always set sylius.doctrine.orm.container_repository_factory.entities parameter ([@pamil](https://github.com/pamil))\n- [#239](https://github.com/Sylius/SyliusResourceBundle/issues/239) Fix the static analysis build ([@pamil](https://github.com/pamil))\n\n### v1.7.0-RC.4 (2020-12-07)\n\n#### Details\n\n- [#234](https://github.com/Sylius/SyliusResourceBundle/issues/234) Refactor test app ([@loic425](https://github.com/loic425))\n- [#238](https://github.com/Sylius/SyliusResourceBundle/issues/238) Always set sylius.doctrine.orm.container_repository_factory.entities parameter ([@pamil](https://github.com/pamil))\n- [#239](https://github.com/Sylius/SyliusResourceBundle/issues/239) Fix the static analysis build ([@pamil](https://github.com/pamil))\n\n### v1.7.0-RC.3 (2020-11-25)\n\n#### Details\n\n- [#232](https://github.com/Sylius/SyliusResourceBundle/issues/232) Create ResourceBundle's EntityRepository only if custom repository is not set ([@pamil](https://github.com/pamil))\n\n### v1.7.0-RC.2 (2020-11-25)\n\n#### Details\n\n- [#230](https://github.com/Sylius/SyliusResourceBundle/issues/230) Do not rely on services in DoctrineORMDriver ([@pamil](https://github.com/pamil))\n- [#231](https://github.com/Sylius/SyliusResourceBundle/issues/231) Remove unnecessary BC layer for symfony/dependency-injection <=4.2 ([@pamil](https://github.com/pamil))\n\n### v1.7.0-RC.1 (2020-11-24)\n\n#### TL;DR\n\n- Added an ability to customise the inflector used by Metadata class\n- All the packages made optional in previous 1.7.0-BETA releases were made required once again\n\n#### Details\n\n- [#224](https://github.com/Sylius/SyliusResourceBundle/issues/224) Require previously required dependencies ([@pamil](https://github.com/pamil))\n- [#225](https://github.com/Sylius/SyliusResourceBundle/issues/225) Bump up dev dependencies ([@pamil](https://github.com/pamil))\n- [#226](https://github.com/Sylius/SyliusResourceBundle/issues/226) Remove Gedmo/DoctrineExtensions from dependencies ([@pamil](https://github.com/pamil))\n- [#227](https://github.com/Sylius/SyliusResourceBundle/issues/227) Apply misc static analysis fixes ([@pamil](https://github.com/pamil))\n- [#228](https://github.com/Sylius/SyliusResourceBundle/issues/228) Add an ability to define your own Inflector for Metadata class ([@pamil](https://github.com/pamil))\n- [#229](https://github.com/Sylius/SyliusResourceBundle/issues/229) Fix tests namespace in the bundle ([@pamil](https://github.com/pamil))\n\n### v1.7.0-BETA.5 (2020-11-23)\n\n#### TL;DR\n\n- Modernized the usage of Doctrine Inflector not to use deprecated API\n- Made sure there is only one instance of repository service for each resource\n\n#### Details\n\n- [#214](https://github.com/Sylius/SyliusResourceBundle/issues/214) Do not use deprecated Doctrine Inflector API ([@pamil](https://github.com/pamil))\n- [#215](https://github.com/Sylius/SyliusResourceBundle/issues/215) Fix InMemoryRepository::applyOrder implementation ([@pamil](https://github.com/pamil))\n- [#216](https://github.com/Sylius/SyliusResourceBundle/issues/216) [CI] Better job naming ([@pamil](https://github.com/pamil))\n- [#220](https://github.com/Sylius/SyliusResourceBundle/issues/220) Duplicate initialisation of repositories ([@Justus Krapp](https://github.com/Fantus))\n- [#221](https://github.com/Sylius/SyliusResourceBundle/issues/221) Update vimeo/psalm requirement from 4.1.1 to 4.2.1 ([@dependabot-preview](https://github.com/dependabot-preview))\n- [#223](https://github.com/Sylius/SyliusResourceBundle/issues/223) Update phpstan/phpstan requirement from 0.12.49 to 0.12.57 ([@dependabot-preview](https://github.com/dependabot-preview))\n\n### v1.7.0-BETA.4 (2020-11-05)\n\n#### TL;DR\n\n- Made `winzou/state-machine-bundle` optional\n- Made `symfony/twig-bundle` optional\n\n#### Details\n\n- [#202](https://github.com/Sylius/SyliusResourceBundle/issues/202) Remove winzou state machine dependency ([@loic425](https://github.com/loic425))\n- [#206](https://github.com/Sylius/SyliusResourceBundle/issues/206) Remove twig bundle dependency ([@loic425](https://github.com/loic425))\n- [#207](https://github.com/Sylius/SyliusResourceBundle/issues/207) Bump doctrine/persistance version ([@dotdevru](https://github.com/dotdevru))\n- [#209](https://github.com/Sylius/SyliusResourceBundle/issues/209) [Travis] Use symfony/flex ^1.10 instead of dev-master ([@pamil](https://github.com/pamil))\n- [#211](https://github.com/Sylius/SyliusResourceBundle/issues/211) Upgrade to Psalm 4 ([@pamil](https://github.com/pamil))\n- [#212](https://github.com/Sylius/SyliusResourceBundle/issues/212) Normalise composer.json ([@pamil](https://github.com/pamil))\n- [#213](https://github.com/Sylius/SyliusResourceBundle/issues/213) Update component's composer.json and normalise it ([@pamil](https://github.com/pamil))\n\n### v1.7.0-BETA.3 (2020-10-15)\n\n#### Details\n\n- [#198](https://github.com/Sylius/SyliusResourceBundle/issues/198) Bump up minimal requirements to Symfony ^5.1 ([@pamil](https://github.com/pamil))\n- [#199](https://github.com/Sylius/SyliusResourceBundle/issues/199) Update the year in LICENSE file ([@ValentineJester](https://github.com/ValentineJester))\n- [#200](https://github.com/Sylius/SyliusResourceBundle/issues/200) Use HTTPS instead of HTTP in links in composer.json ([@ValentineJester](https://github.com/ValentineJester))\n- [#201](https://github.com/Sylius/SyliusResourceBundle/issues/201) Remove outdated persistence backends from the documentation ([@ValentineJester](https://github.com/ValentineJester))\n- [#204](https://github.com/Sylius/SyliusResourceBundle/issues/204) Replace AbstractController with ControllerTrait & ContainerAwareInterface ([@pamil](https://github.com/pamil))\n\n### v1.7.0-BETA.2 (2020-10-14)\n\n#### TL;DR\n\n- Made FOSRestBundle optional\n- Ensured WinzouStateMachineBundle services and aliases are public\n\n#### Details\n\n- [#173](https://github.com/Sylius/SyliusResourceBundle/issues/173) Remove rest dependencies ([@loic425](https://github.com/loic425), [@pamil](https://github.com/pamil))\n- [#177](https://github.com/Sylius/SyliusResourceBundle/issues/177) Pagerfanta updates ([@mbabker](https://github.com/mbabker))\n- [#178](https://github.com/Sylius/SyliusResourceBundle/issues/178) When using winzouStateMachineBundle 0.4, the old named services are aliases, so need to be marked public as well ([@mbabker](https://github.com/mbabker), [@pamil](https://github.com/pamil))\n- [#192](https://github.com/Sylius/SyliusResourceBundle/issues/192) Remove conflict with amphp/amp ([@pamil](https://github.com/pamil))\n- [#195](https://github.com/Sylius/SyliusResourceBundle/issues/195) Upgrade to Psalm v3.17.1 ([@pamil](https://github.com/pamil))\n- [#196](https://github.com/Sylius/SyliusResourceBundle/issues/196) Remove unnecessary dev dependency on \"polishsymfonycommunity/symfony-mocker-container\" ([@pamil](https://github.com/pamil))\n- [#197](https://github.com/Sylius/SyliusResourceBundle/issues/197) Make RegisterFormBuilderPass accept multiple tags on a single service ([@pamil](https://github.com/pamil))\n\n### v1.7.0-BETA.1 (2020-10-13)\n\n#### TL;DR\n\n- Added support for Symfony 5\n- Added support for Twig 3\n- Added support for `winzou/state-machine-bundle` 0.4 and 0.5\n\n#### Details\n\n- [#114](https://github.com/Sylius/SyliusResourceBundle/issues/114) Updating composer dependencies ([@mamazu](https://github.com/mamazu))\n- [#117](https://github.com/Sylius/SyliusResourceBundle/issues/117) Fix extended types deprecation ([@dannyvw](https://github.com/dannyvw))\n- [#119](https://github.com/Sylius/SyliusResourceBundle/issues/119) Update composer dependencies ([@dannyvw](https://github.com/dannyvw))\n- [#124](https://github.com/Sylius/SyliusResourceBundle/issues/124) Replace deprecated doctrine object manager ([@loic425](https://github.com/loic425))\n- [#125](https://github.com/Sylius/SyliusResourceBundle/issues/125) Replace deprecated doctrine object repository ([@loic425](https://github.com/loic425))\n- [#126](https://github.com/Sylius/SyliusResourceBundle/issues/126) Replace dbal types ([@loic425](https://github.com/loic425))\n- [#127](https://github.com/Sylius/SyliusResourceBundle/issues/127) Fix phpspec tests on DefaultFormBuilder ([@loic425](https://github.com/loic425))\n- [#128](https://github.com/Sylius/SyliusResourceBundle/issues/128) Lock static analysis tools versions & fix the build ([@pamil](https://github.com/pamil))\n- [#129](https://github.com/Sylius/SyliusResourceBundle/issues/129) Add support for PHP 7.4 and Symfony 4.4 ([@dannyvw](https://github.com/dannyvw), [@pamil](https://github.com/pamil))\n- [#130](https://github.com/Sylius/SyliusResourceBundle/issues/130) Remove deprecated templating configuration ([@dannyvw](https://github.com/dannyvw))\n- [#131](https://github.com/Sylius/SyliusResourceBundle/issues/131) Allow twig 3.x ([@dannyvw](https://github.com/dannyvw))\n- [#132](https://github.com/Sylius/SyliusResourceBundle/issues/132) Fix controller deprecation ([@dannyvw](https://github.com/dannyvw))\n- [#133](https://github.com/Sylius/SyliusResourceBundle/issues/133) Fix testing multiple Symfony versions, add build for 5.0 & remove support for <4.4 ([@pamil](https://github.com/pamil))\n- [#135](https://github.com/Sylius/SyliusResourceBundle/issues/135) Allow for DoctrineBundle ^2.0 ([@pamil](https://github.com/pamil))\n- [#136](https://github.com/Sylius/SyliusResourceBundle/issues/136) Remove unneccessary dependency on winzou/state-machine in the component ([@pamil](https://github.com/pamil))\n- [#138](https://github.com/Sylius/SyliusResourceBundle/issues/138) Remove legacy di configuration ([@dannyvw](https://github.com/dannyvw))\n- [#139](https://github.com/Sylius/SyliusResourceBundle/issues/139) Fix event dispatcher deprecation ([@dannyvw](https://github.com/dannyvw))\n- [#141](https://github.com/Sylius/SyliusResourceBundle/issues/141) Upgrade to PHPStan 0.12 ([@GSadee](https://github.com/GSadee))\n- [#142](https://github.com/Sylius/SyliusResourceBundle/issues/142) Github repository configuration from Sylius/Sylius ([@CoderMaggie](https://github.com/CoderMaggie))\n- [#143](https://github.com/Sylius/SyliusResourceBundle/issues/143) [Maintenance] Updated branch alias ([@lchrusciel](https://github.com/lchrusciel))\n- [#144](https://github.com/Sylius/SyliusResourceBundle/issues/144) [Maintenance] Update github templates ([@lchrusciel](https://github.com/lchrusciel))\n- [#151](https://github.com/Sylius/SyliusResourceBundle/issues/151) [Maintenance] Bump ApiTestCase to v5.0 ([@lchrusciel](https://github.com/lchrusciel))\n- [#159](https://github.com/Sylius/SyliusResourceBundle/issues/159) Remove duplicated docblocks ([@GSadee](https://github.com/GSadee))\n- [#160](https://github.com/Sylius/SyliusResourceBundle/issues/160) ResourceBundle documentation extracted to its repository ()\n- [#161](https://github.com/Sylius/SyliusResourceBundle/issues/161) [HOTFIX] Conflict with amphp/amp 2.4.3 ([@lchrusciel](https://github.com/lchrusciel))\n- [#162](https://github.com/Sylius/SyliusResourceBundle/issues/162) [Documentation] Fix index menu ([@SirDomin](https://github.com/SirDomin))\n- [#163](https://github.com/Sylius/SyliusResourceBundle/issues/163) [HOTFIX] Conflict with the newest amphp/amp ([@lchrusciel](https://github.com/lchrusciel))\n- [#165](https://github.com/Sylius/SyliusResourceBundle/issues/165) Fix the build ([@pamil](https://github.com/pamil))\n- [#167](https://github.com/Sylius/SyliusResourceBundle/issues/167) Upgrade rest bundle ([@loic425](https://github.com/loic425))\n- [#168](https://github.com/Sylius/SyliusResourceBundle/issues/168) [Docs] Serialization groups of the elements in a paginated collection ([@vvasiloi](https://github.com/vvasiloi))\n- [#172](https://github.com/Sylius/SyliusResourceBundle/issues/172) Check if form is submitted on resource creation/edition ([@loic425](https://github.com/loic425))\n- [#175](https://github.com/Sylius/SyliusResourceBundle/issues/175) Upgrade PagerfantaBundle to new version with B/C layer ([@mbabker](https://github.com/mbabker))\n- [#181](https://github.com/Sylius/SyliusResourceBundle/issues/181) Fix build ([@loic425](https://github.com/loic425))\n- [#182](https://github.com/Sylius/SyliusResourceBundle/issues/182) Testing several state machine versions ([@loic425](https://github.com/loic425))\n- [#187](https://github.com/Sylius/SyliusResourceBundle/issues/187) Symfony 5 support ([@loic425](https://github.com/loic425))\n- [#189](https://github.com/Sylius/SyliusResourceBundle/issues/189) Require webmozart/assert as it's used by the bundle code ([@pamil](https://github.com/pamil))\n- [#190](https://github.com/Sylius/SyliusResourceBundle/issues/190) Fix errors reported by static analysis tools ([@pamil](https://github.com/pamil))\n- [#191](https://github.com/Sylius/SyliusResourceBundle/issues/191) Normalise composer.json (with ergebnis/composer-normalize) ([@pamil](https://github.com/pamil))\n- [#193](https://github.com/Sylius/SyliusResourceBundle/issues/193) Bump up requirements to PHP ^7.3 ([@pamil](https://github.com/pamil))\n- [#194](https://github.com/Sylius/SyliusResourceBundle/issues/194) Fix deprecations and errors while running PHPUnit ([@pamil](https://github.com/pamil))\n\n## CHANGELOG FOR `1.6.x`\n\n### v1.6.4 (2020-08-18)\n\nSecurity release:\n\n- [CVE-2020-15143: Remote Code Execution in ParametersParser while using request parameters inside expression language](https://github.com/Sylius/SyliusResourceBundle/security/advisories/GHSA-p4pj-9g59-4ppv)\n- [CVE-2020-15146: Remote Code Execution in OptionsParser while using request parameters inside expression language](https://github.com/Sylius/SyliusResourceBundle/security/advisories/GHSA-h6m7-j4h3-9rf5)\n\n### v1.6.3 (2020-01-27)\n\nSecurity release:\n\n- [CVE-2020-5220: Ability to define unintended serialisation groups via HTTP header which might lead to data exposure](https://github.com/Sylius/SyliusResourceBundle/security/advisories/GHSA-8vp7-j5cj-vvm2)\n\n### v1.6.2 (2020-01-13)\n\n- [#145](https://github.com/Sylius/SyliusResourceBundle/issues/145) Autowire Doctrine\\Persistence\\ObjectManager ([@pamil](https://github.com/pamil))\n\n### v1.6.1 (2019-10-10)\n\n- [#112](https://github.com/Sylius/SyliusResourceBundle/issues/112) Support for Symfony 3.4 / 4.3+ ([@pamil](https://github.com/pamil))\n\n### v1.6.0 (2019-10-07)\n\n- [#104](https://github.com/Sylius/SyliusResourceBundle/issues/104) [RFC] Add success flashes before post event ([@Zales0123](https://github.com/Zales0123))\n- [#110](https://github.com/Sylius/SyliusResourceBundle/issues/110) Add Psalm and fix all the errors ([@pamil](https://github.com/pamil))\n\n### v1.6.0-RC.3 (2019-06-18)\n\n- [#92](https://github.com/Sylius/SyliusResourceBundle/issues/92) Removing '2' from 'Symfony2' ([@loevgaard](https://github.com/loevgaard))\n- [#95](https://github.com/Sylius/SyliusResourceBundle/issues/95) Autowire factories and repositories by class and name ([@pamil](https://github.com/pamil))\n- [#97](https://github.com/Sylius/SyliusResourceBundle/issues/97) Autodiscover resource's model interfaces and deprecate explicit configuration ([@pamil](https://github.com/pamil))\n\n### v1.6.0-RC.2 (2019-06-07)\n\n- [#91](https://github.com/Sylius/SyliusResourceBundle/issues/91) Support for Gedmo/DoctrineExtensions ([@pamil](https://github.com/pamil))\n\n### v1.6.0-RC.1 (2019-06-07)\n\n- [#88](https://github.com/Sylius/SyliusResourceBundle/issues/88) Ensure forward compatibility with ResolveTargetEntityListener ([@teohhanhui](https://github.com/teohhanhui))\n- [#89](https://github.com/Sylius/SyliusResourceBundle/issues/89) Add support for embeddables ([@pamil](https://github.com/pamil))\n- [#90](https://github.com/Sylius/SyliusResourceBundle/issues/90) Drop Symfony 4.1, add support for Symfony 4.3 ([@pamil](https://github.com/pamil))\n\n## CHANGELOG FOR `1.5.x`\n\n### v1.5.2 (2020-08-18)\n\nSecurity release:\n\n- [CVE-2020-15143: Remote Code Execution in ParametersParser while using request parameters inside expression language](https://github.com/Sylius/SyliusResourceBundle/security/advisories/GHSA-p4pj-9g59-4ppv)\n- [CVE-2020-15146: Remote Code Execution in OptionsParser while using request parameters inside expression language](https://github.com/Sylius/SyliusResourceBundle/security/advisories/GHSA-h6m7-j4h3-9rf5)\n\n### v1.5.1 (2020-01-27)\n\nSecurity release:\n\n- [CVE-2020-5220: Ability to define unintended serialisation groups via HTTP header which might lead to data exposure](https://github.com/Sylius/SyliusResourceBundle/security/advisories/GHSA-8vp7-j5cj-vvm2)\n\n### v1.5.0 (2019-05-07)\n\n#### TL;DR\n\nReleased ResourceBundle as a standalone package, containing a subtree split of Resource component.\n\n## CHANGELOG FOR `1.4.x`\n\n### v1.4.7 (2020-08-18)\n\nSecurity release:\n\n- [CVE-2020-15143: Remote Code Execution in ParametersParser while using request parameters inside expression language](https://github.com/Sylius/SyliusResourceBundle/security/advisories/GHSA-p4pj-9g59-4ppv)\n- [CVE-2020-15146: Remote Code Execution in OptionsParser while using request parameters inside expression language](https://github.com/Sylius/SyliusResourceBundle/security/advisories/GHSA-h6m7-j4h3-9rf5)\n\n### v1.4.6 (2020-01-27)\n\nSecurity release:\n\n- [CVE-2020-5220: Ability to define unintended serialisation groups via HTTP header which might lead to data exposure](https://github.com/Sylius/SyliusResourceBundle/security/advisories/GHSA-8vp7-j5cj-vvm2)\n\n### v1.4.5 (2019-10-07)\n\n- [#88](https://github.com/Sylius/SyliusResourceBundle/issues/88) Ensure forward compatibility with ResolveTargetEntityListener ([@teohhanhui](https://github.com/teohhanhui))\n- [#104](https://github.com/Sylius/SyliusResourceBundle/issues/104) [RFC] Add success flashes before post event ([@Zales0123](https://github.com/Zales0123))\n\n### v1.4.4 (2019-05-07)\n\n#### TL;DR\n\nReleased ResourceBundle as a standalone package, containing a subtree split of Resource component.\n\n## CHANGELOG FOR `1.3.x`\n\n### v1.3.14 (2020-08-18)\n\nSecurity release:\n\n- [CVE-2020-15143: Remote Code Execution in ParametersParser while using request parameters inside expression language](https://github.com/Sylius/SyliusResourceBundle/security/advisories/GHSA-p4pj-9g59-4ppv)\n- [CVE-2020-15146: Remote Code Execution in OptionsParser while using request parameters inside expression language](https://github.com/Sylius/SyliusResourceBundle/security/advisories/GHSA-h6m7-j4h3-9rf5)\n\n### v1.3.13 (2020-01-27)\n\nSecurity release:\n\n- [CVE-2020-5220: Ability to define unintended serialisation groups via HTTP header which might lead to data exposure](https://github.com/Sylius/SyliusResourceBundle/security/advisories/GHSA-8vp7-j5cj-vvm2)\n\n### v1.3.12 (2019-05-07)\n\n#### TL;DR\n\nReleased ResourceBundle as a standalone package, containing a subtree split of Resource component.\n\n## CHANGELOG FOR `1.2.x`\n\n### v1.2.17 (2019-05-07)\n\n#### TL;DR\n\nReleased ResourceBundle as a standalone package, containing a subtree split of Resource component.\n\n## CHANGELOG FOR `1.1.x`\n\n### v1.1.18 (2019-05-07)\n\n#### TL;DR\n\nReleased ResourceBundle as a standalone package, containing a subtree split of Resource component.\n"
  },
  {
    "path": "CONFLICTS.md",
    "content": "# CONFLICTS\n\nThis document explains why certain conflicts were added to `composer.json` and\nreferences related issues.\n\n- `willdurand/hateoas-bundle: ^2.6`\n\nThis version allows Symfony 7 but does not support the \"annotation_reader\" service removal.\n@see https://github.com/willdurand/BazingaHateoasBundle/issues/108\n"
  },
  {
    "path": "Dockerfile",
    "content": "ARG COMPOSER_VERSION=2.3\nARG PHP_VERSION=8.4\n\nFROM composer:${COMPOSER_VERSION} AS composer\nFROM mlocati/php-extension-installer AS php_extension_installer\n\nFROM php:${PHP_VERSION}-cli-alpine AS php\n\nCOPY --from=composer /usr/bin/composer /usr/bin/composer\nCOPY --from=php_extension_installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions\n\nRUN install-php-extensions pdo_sqlite\n\nCOPY . /app\n\nWORKDIR /app\n\nRUN echo \"memory_limit=512M\" > /usr/local/etc/php/conf.d/memory-limit.ini\n\nRUN composer global config --no-plugins allow-plugins.symfony/flex true\nRUN composer global require --no-progress --no-scripts --no-plugins \"symfony/flex:^1.10\"\nRUN composer update --with-all-dependencies --no-interaction --no-progress\n\nWORKDIR /app/tests/Application\n\nRUN php bin/console doctrine:schema:create\n\nWORKDIR /app\n"
  },
  {
    "path": "LICENSE",
    "content": "Copyright (c) 2011-present Sylius Sp. z o.o.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is furnished\nto do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "LICENSE_OF_TRADEMARK_AND_LOGO",
    "content": "Encourage widespread and fair use of Sylius logo and brand identity.\n\nThis Trademarks and Logos use policy (the “Policy”) is based on the Ubuntu \nand Symfony trademark policy and published under the CC-BY-SA license. You \nare welcome to base your own project trademark policies off it, just let \nothers use your changes and give credit to the Ubuntu and Symfony projects \nas the original source!\n\nVersion n°1. Published on April 5th 2019.\n\nThe objective of the Policy is to encourage widespread use of the Sylius \ntrademarks by the Sylius community while controlling that use in order to \navoid confusion on the part of Sylius users and the general public, to \nmaintain the value of the image and reputation of the trademarks and to \nprotect them from inappropriate or unauthorised use.\n\nThe sections below describe what is allowed, what isn’t allowed, and cases \nin which you should ask permission.\nIf you have any doubt, please contact us and a member of our legal \nrepresentative will be in touch with you shortly.\nIf you are aware a breach or misuse of the Sylius trademarks in any \nway, we would appreciate you bringing this to our attention. Please \ncontact us so that we can investigate this further.\n\nThe Trademarks and Logos\nSylius sp. z o.o. owns the verbal trademark containing \nin whole or part of the word “Sylius”.\n\nAny verbal mark starting with the letters “Sylius” is sufficiently \nsimilar to one or more of the trademarks that permission will be \nneeded in order to use it.\n\nAll verbal trademarks of Sylius sp. z o.o., all distinctive signs used in \ncommerce by Sylius sp. z o.o. to designate his products or services related \nto Sylius are collectively referred to as the “Trademarks”.\n\nPermitted use of the Trademarks\nCertain usages of the Trademarks are fine and no specific permission \nfrom us is needed.\n\nCommunity advocacy. Sylius is built by its community. We share access to \nthe Trademarks with the entire community for the purposes of discussion, \ndevelopment and advocacy. We recognise that most of the open source discussion \nand development areas are for non-commercial purposes and will allow the \nuse of the Trademarks in this context, provided:\n\nthe Trademark is used in a manner consistent with this Policy;\nthere is no commercial intent behind the use;\nwhat you are referring to is in fact Sylius. If someone is confused into \nthinking that what isn’t Sylius is, in fact, Sylius, you are probably doing \nsomething wrong;\nthere is no suggestion (through words or appearance) that your project is \napproved, sponsored, or affiliated with Sylius, Sylius sp. z o.o. or its \nrelated projects unless it actually has been approved by and is accountable \nto Sylius sp. z o.o. and the Sylius Project.\nBuilding on Sylius or for Sylius. If you are producing new software which is \nintended for use with or on Sylius, you may use the Trademark in a way which \nindicates the intent of your product. For example, if you are developing a \nsystem management tool for Sylius, acceptable project titles would be \n“System Management for Sylius” or “Sylius Based Systems Management”. We would \nstrongly discourage, and likely would consider to be problematic, a name such \nas SyliusMan, Sylius Management, etc. Furthermore, you may not use the \nTrademarks in a way which implies an endorsement where that doesn’t exist, \nor which attempts to unfairly or confusingly capitalise on the goodwill \nor brand of the project.\n\nCommentary and parody. The Trademarks and Logos are designed to cover use of \na mark to imply origin or endorsement by the project. When a user downloads \nsomething called Sylius, they should know it comes from the Sylius project. \nThis helps Sylius build a reputation that will not be damaged by confusion \naround what is, and isn’t, Sylius. Using the Trademarks in your discussion, \ncommentary, criticism or parody, in ways that unequivocally do not imply \nendorsement, is permissible. Anyone is free to write articles, create \nwebsites, blog about, or talk about Sylius — as long as it’s clear to \neveryone — including people completely unfamiliar with Sylius — that they \nare simply referring to Sylius and in no way speaking for the Sylius \nproject and/or for Sylius sp. z o.o.\n\nWe reserve the right to review all usage within the open source community, \nand to object to any usage that appears to overstep the bounds of discussion \nand good-faith non-commercial development. In any event, once a project has \nleft the open source project phase or otherwise become a commercial project, \nthis Policy does not authorise any use of the Trademarks in connection to \nthat project.\n\nRestricted use that requires a trademark licence\nPermission from us is necessary to use any of the Trademarks under any \ncircumstances other than those specifically permitted above.\n\nThese include but are not limited to:\n\nAny commercial use including for any services related to Sylius such as \nproviding training services, conference services, or design services (should \nyou wish to provide such services, please contact us beforehand to explore \nSylius Solution Partner Program);\nUse on or in relation to a software product that includes or is built on top \nof a product supplied by us, if there is any commercial intent associated \nwith that product;\nUse in a domain name or URL;\nUse for merchandising purposes, e.g. on t-shirts and the like.\nIf you wish to have permission for any of the uses above or for any other use \nwhich is not specifically referred to in this Policy, please contact us and \nwe’ll let you know as soon as possible if your proposed use is permissible. \nPermission may only be granted subject to certain conditions and these may \ninclude the requirement that you enter into an agreement with us to maintain \nthe quality of the product and/or service which you intend to supply at a \nprescribed level.\n\nWhile there may be exceptions, it is very unlikely that we will approve \nTrademark use in the following cases:\n\nUse of a Trademark in a company name;\nUse of a Trademark in a domain name which has a commercial intent. The \ncommercial intent can range from promotion of a company or product, to \ncollecting revenue generated by advertising;\nThe calling of any software or product by the name Sylius (or another \nrelated Trademark);\nUse in combination with any other marks or logos. This include use of \na Trademark in a manner that creates a “combined mark,” or use that \nintegrates other wording with the Trademark in a way that the public may \nthink of the use as a new mark (for example Club Sylius or SyliusBooks, or \nin a way that by use of special fonts or presentation with nearby words or \nimages conveys an impression that the two are tied in some way);\nUse in combination with any product or service which is presented as being \nCertified or Official or formally associated with us or our products or \nservices;\nUse in a way which implies an endorsement where that doesn’t exist, or which \nattempts to unfairly or confusingly capitalise on the goodwill or brand of \nthe project;\nUse of a Trademark in a manner that disparages Sylius, or Sylius sp. z o.o.; \nor its products and is not clearly third-party parody;\nUse of a Trademark on or in relation to a software product which constitutes \na substantially modified version of a product supplied by the Sylius project, \nthat is to say with material changes to the code, or services relating to \nsuch a product; and\nUse of a Trademark in a title or metatag of a web page whose sole intention or \nresult is to influence search engine rankings or result listings (for example \nuse as keyword for advertising purposes), rather than for discussion, \ndevelopment or advocacy of the Trademarks.\nLogo usage guidelines\nExcept otherwise agreed, any use of Logos shall be expressly authorized by \nwriting by Sylius sp. z o.o.. To get any authorization to use any Logo, \nplease contact us and a member of our team will be in touch with you shortly.\n\nOur logos are presented in multiple colours and it is important that their \nvisual integrity be maintained.\n\nTherefore, when use of Logos is authorized, it is therefore preferable that \nthe logos only be used in their standard form but if you should feel the need \nto alter them in any way you should keep the following guidelines in mind.\n\nIt should also be borne in mind that the more you wish to vary our logos \nfrom their standard form the smaller is the chance that we will be able to \napprove your proposed use.\n\nIf presented in multiple colours, the logo should only use the “official” \nlogo colours.\nYou may use transparency and gradient/depth tools but should retain the \n“official” colours.\nAny scaling must retain the original proportions of the logo.\nIn case of non-compliance with Trademarks and Logos’ Use Policy or \napplicable law, any use of the Trademarks and/or Logos will be prohibited.\n"
  },
  {
    "path": "Makefile",
    "content": "PACKAGE := @docker compose run --rm package\n\n.PHONY:\ntest:\n\t$(PACKAGE) composer test\n\n.PHONY:\nanalyse:\n\t$(PACKAGE) composer analyse\n"
  },
  {
    "path": "README.md",
    "content": "SyliusResourceBundle\n====================\n\nEasy CRUD and persistence for Symfony apps.\n\nDuring our work on Sylius, we noticed a lot of duplicated code across all controllers. We started looking for good solution of the problem.\nWe're not big fans of administration generators (they're cool, but not for our usecase!) - we wanted something simpler and more flexible.\n\nAnother idea was to not limit ourselves to one persistence backend. Initial implementation included custom manager classes, which was quite of overhead, so we decided to simply \nstick with Doctrine Common Persistence interfaces. If you are using Doctrine ORM or any of the ODM's, you're already familiar with those concepts.\nResource bundle relies mainly on `ObjectManager` and `ObjectRepository` interfaces.\n\nThe last annoying problem this bundle is trying to solve, is having separate \"backend\" and \"frontend\" controllers, or any other duplication for displaying the same resource,\nwith different presentation (view). We also wanted an easy way to filter some resources from list, sort them or display by id, slug or any other criteria - without having to defining\nanother super simple action for that purpose.\n\nIf these are issues you're struggling with, this bundle may be helpful!\n\nPlease note that this bundle **is not an admin generator**. It won't create forms, filters and grids for you. \nIt only provides format agnostic controllers as a foundation to build on, with some basic sorting and filter mechanisms.\n\n### Supported branches\n\n- `1.10` (`v1.10.*` versions) - bug fixes and improvements of existing features\n- `1.11` (next version - `v1.11.0`) - new features and bigger changes\n\nBeware! There is no `main` or `master` branch on the repository. You should always open a Pull Request to the branch\nnamed as the minor version on which your changes should be applied.\n\nSylius\n------\n\n<p align=\"center\">\n    <a href=\"https://sylius.com\" target=\"_blank\">\n        <picture>\n          <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://media.sylius.com/sylius-logo-800-dark.png\">\n          <source media=\"(prefers-color-scheme: light)\" srcset=\"https://media.sylius.com/sylius-logo-800.png\">\n          <img alt=\"Sylius Logo.\" src=\"https://media.sylius.com/sylius-logo-800.png\">\n        </picture>\n    </a>\n</p>\n\nSylius is an Open Source eCommerce solution built from decoupled components with powerful API and the highest quality code. [Read more on sylius.com](http://sylius.com).\n\nDevelopment\n-----------\n\n#### Build: \n\n```bash\ndocker compose up -d --build\n```\n\n#### Test:\n\n```bash\nmake test\n```\n\nDocumentation\n-------------\n\n[Sylius Stack documentation &raquo; Resource Bundle](https://stack.sylius.com/resource/index)\n\nContributing\n------------\n\n[This page](http://docs.sylius.com/en/latest/contributing/index.html) contains all the information about contributing to Sylius.\n\nFollow Sylius' Development\n--------------------------\n\nIf you want to keep up with the updates and latest features, follow us on the following channels:\n\n* [Official Blog](https://sylius.com/blog)\n* [Sylius on Twitter](https://twitter.com/Sylius)\n* [Sylius on Facebook](https://facebook.com/SyliusEcommerce)\n\nBug tracking\n------------\n\nSylius uses [GitHub issues](https://github.com/Sylius/SyliusResourceBundle/issues).\nIf you have found bug, please create an issue.\n\nMIT License\n-----------\n\nLicense can be found [here](https://github.com/Sylius/SyliusResourceBundle/blob/1.10/LICENSE).\n\nAuthors\n-------\n\nThe bundle was originally created by [Paweł Jędrzejewski](http://pjedrzejewski.com).\nSee the list of [contributors](https://github.com/Sylius/SyliusResourceBundle/graphs/contributors).\n"
  },
  {
    "path": "UPGRADE.md",
    "content": "## UPGRADE FOR `1.15.x`\n\n### FROM `1.14.x` to `1.15.x`\n\n#### Routing Path\n\nRouting paths may have been changed depending on your configuration.\n\n*Using ResourceController*\n\n```yaml\n# config/packages/\nsylius_resource:\n    routing_path_bc_layer: false\n```\n\nIf you have disabled the routing path bc-layer, the bulk delete operations will have this path change:\n\nexample:\n```diff\n-/science-books/bulk_delete\n+/science-books/bulk-delete\n```\n\n*Using the new routing system with `AsResource` attribute and operations*\n\nIf the shortName of your operation contains an underscore, it will be replaced by a dash.\n\nexample:\n```diff\n-/subscriptions/bulk_delete\n+/subscriptions/bulk-delete\n-/subscriptions/bulk_publish\n+/subscriptions/bulk-publish\n```\n\nNote this will keep an underscore if you have configured the resource bundle like this:\n```yaml\n# config/packages/\nsylius_resource:\n    path_segment_name_generator: sylius.metadata.path_segment_name_generator.underscore\n```\n\nPlease note this configuration is not recommended for SEO.\n\n## UPGRADE FOR `1.14.x`\n\n### FROM `1.13.x` to `1.14.x`\n\n#### Minimal Requirements\n\nThe minimum required PHP version is now 8.2.\n\n#### Routing Path\n\nRouting paths may have been changed depending on your configuration.\n\n| behat/transliterator | Routing Path BC-layer | Routing paths |\n|----------------------|-----------------------|---------------|\n| ✅ Installed          | ✅ Enabled by default  | ✅ Unchanged   |\n| ❌ Not installed      | ❌ Disabled by default | ❌ Changed     |\n\nIf you want to keep the previous paths, please follow these following steps:\n\n1. Make sure to have Behat transliterator installed.\n\n```shell\ncomposer require behat/transliterator\n```\n\n2/ Ensure routing path bc-layer is enabled\n\n```yaml\n# config/packages/\nsylius_resource:\n    routing_path_bc_layer: true\n```\n\nWhen using the `ResourceController` for your routes and when the BC-layer is enabled, the routing path\ncontains a trailing slash by default. In 2.x, it will be removed.\nYou can disable the BC-layer to remove these trailing slashes on all your routes and be prepared for the 2.x release.\n\nIf you are using the new Routing system with `AsResource` attribute and operations, this change has no effect, there is\nno trailing slash in both configuration.\n\n```yaml\n# config/packages/\nsylius_resource:\n    routing_path_bc_layer: false\n```\n\n| Routing system               | Routing Path BC-layer | Trailing slash |\n|------------------------------|-----------------------|----------------|\n| Using the ResourceController | ✅ Enabled             | ✅              |\n| Using the ResourceController | ❌ Disabled            | ❌              |\n| Using AsResource attribute   | ✅ Enabled             | ❌              |\n| Using AsResource attribute   | ❌ Disabled            | ❌              |\n\nThe routing path uses dashes to separate words by default. Eg: `/shipping-categories`.\nOn the new routing system only, you can configure using underscores instead. Eg: `/shipping_categories`\n\n```yaml\n# config/packages/\nsylius_resource:\n    path_segment_name_generator: sylius.metadata.path_segment_name_generator.underscore\n```\n\nNote that even if this is configurable, it's recommended to use dashes to separate the words for SEO.\n\n*Source:*\n* https://developers.google.com/search/docs/crawling-indexing/url-structure\n\n## UPGRADE FOR `1.13.x`\n\n### FROM `1.12.x` to `1.13.x`\n\nThe `Sylius\\Resource\\Exception\\VariantWithNoOptionsValuesException` and\n`Sylius\\Component\\Resource\\Exception\\VariantWithNoOptionsValuesException`\nclasses have been deprecated and will be removed in `2.0`.\n\n## UPGRADE FOR `1.12.x`\n\n### FROM `1.11.x` to `1.12.x`\n\nIn preparation of removal, following dependencies were moved to optional requirements. If still in use by your app,\nrequire them explicitly in your `composer.json`.\n\n* friendsofsymfony/rest-bundle\n* jms/serializer-bundle\n* willdurand/hateoas-bundle\n* winzou/state-machine-bundle\n\n## UPGRADE FOR `1.11.x`\n\n### FROM `1.11.0` to `1.11.1`\n\nThe `Sylius\\Bundle\\ResourceBundle\\EventListener\\ORMTranslatableListener` service has become a Doctrine subscriber again\nto fully support Symfony 5.\n\n### FROM `1.10.x` to `1.11.x`\n\nWe remove the default mapping paths which are used to read PHP 8 attributes to build routes.\n\nTo configure this default value, please edit your `config/packages/sylius_resource.yaml` file to add your mapping paths\nmanually:\n\n```yaml\n# config/packages/sylius_resource.yaml\nsylius_resource:\n    mapping:\n        paths:\n            - '%kernel.project_dir%/src/Entity'\n```\n\nThese following services are now Doctrine listeners instead of Doctrine subscribers (\n@see https://github.com/symfony/symfony/issues/49586)\n\n* Sylius\\Bundle\\ResourceBundle\\EventListener\\ORMTranslatableListener\n* Sylius\\Bundle\\ResourceBundle\\EventListener\\ORMRepositoryClassSubscriber\n* Sylius\\Bundle\\ResourceBundle\\EventListener\\ORMMappedSuperClassSubscriber\n\nApplied the `UniqueEntity` constraint for `locale` and `translatable` fields, and added `NotBlank` & `Locale`\nconstraints for the `locale` property in classes extending `Sylius\\Resource\\Model\\AbstractTranslation`.\n\nApplied the `Valid` constraint for the `getTranslations` method for objects implementing\n`Sylius\\Resource\\Model\\TranslatableInterface`.\n\n## UPGRADE FOR `1.10.x`\n\n### FROM `1.9.x` to `1.10.x`\n\n- failed form response status code returned from the `ResourceController::createAction` and\n  `ResourceController::updateAction` changed from `200` to `422`\n\n  see: https://github.com/Sylius/SyliusResourceBundle/pull/488. This is technically a bug fix, but could break the\n  application\n  if your logic is based on this bugged previous status code\n\n## UPGRADE FOR `1.7.x`\n\n### FROM `1.6.x` TO `1.7.x`\n\n#### Dependencies\n\n- `jms/serializer` and `jms/serializer-bundle` from `2.x` to `3.x`:\n\n  follow their upgrade process\n  for [the component](https://github.com/schmittjoh/serializer/blob/master/UPGRADING.md#from-2x-to-300)\n  and [the bundle](https://github.com/schmittjoh/JMSSerializerBundle/blob/master/UPGRADING.md#upgrading-from-2x-to-30);\n  if you're getting errors about serializing the entity manager, consider changing the serialized type\n  from `array` to `iterable` for Doctrine collections in your models\n\n- `friendsofsymfony/rest-bundle` from `2.x` to `3.x`:\n\n  follow their [upgrade process](https://github.com/FriendsOfSymfony/FOSRestBundle/blob/3.x/UPGRADING-3.0.md);\n  if you're using this bundle to render HTML templates as well, replace it with direct calls to Twig\n  and handle only the REST logic via this\n  bundle ([see this PR for more](https://github.com/Sylius/SyliusResourceBundle/pull/167/files))\n\n- `willdurand/hateoas` from `2.x` to `3.x`:\n\n  follow their [upgrade process](https://github.com/willdurand/Hateoas/blob/master/UPGRADING.md#from-2120-to-300)\n\n- from `white-october/pagerfanta-bundle` `^1.0` to `babdev/pagerfanta-bundle` `^2.5`:\n\n  follow\n  their [upgrade process](https://github.com/BabDev/PagerfantaBundle/blob/2.x/UPGRADE-2.0.md#migrate-from-whiteoctoberpagerfantabundle-1x-to-babdevpagerfantabundle-20)\n\n- `doctrine/persistence` from `1.x` to `2.x` (if applicable):\n\n  replace `Doctrine\\Common\\Persistence` with `Doctrine\\Persistence` in your codebase\n\n#### Example\n\nYou can find an exemplary upgrade to this version of ResourceBundle on Sylius repository\nin [this PR](https://github.com/Sylius/Sylius/pull/12084).\n\n## UPGRADE FOR `1.3.x`\n\n### FROM `1.3.x` TO `1.3.13`\n\nIf you're using an \"Accept\" HTTP header to set the serialization groups, you need to define allowed groups\neither by passing them as default in `serialization_groups` setting or marking them as allowed in\n`allowed_serialization_groups` setting, both settings are set in the route definition (under `_sylius` key).\n"
  },
  {
    "path": "composer.json",
    "content": "{\n    \"name\": \"sylius/resource-bundle\",\n    \"type\": \"symfony-bundle\",\n    \"description\": \"Resource component for Sylius.\",\n    \"keywords\": [\n        \"resource\",\n        \"storage\",\n        \"persistence\",\n        \"sylius\"\n    ],\n    \"homepage\": \"https://sylius.com\",\n    \"license\": \"MIT\",\n    \"authors\": [\n        {\n            \"name\": \"Paweł Jędrzejewski\",\n            \"homepage\": \"https://pjedrzejewski.com\"\n        },\n        {\n            \"name\": \"Sylius project\",\n            \"homepage\": \"https://sylius.com\"\n        },\n        {\n            \"name\": \"Community contributions\",\n            \"homepage\": \"https://github.com/Sylius/Sylius/contributors\"\n        }\n    ],\n    \"require\": {\n        \"php\": \"^8.2\",\n        \"babdev/pagerfanta-bundle\": \"^4.4\",\n        \"doctrine/collections\": \"^2.2\",\n        \"doctrine/event-manager\": \"^1.1 || ^2.0\",\n        \"doctrine/inflector\": \"^2.0\",\n        \"doctrine/persistence\": \"^3.3 || ^4.0\",\n        \"sylius/registry\": \"^1.2\",\n        \"symfony/config\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/deprecation-contracts\": \"^3.5\",\n        \"symfony/expression-language\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/form\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/framework-bundle\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/http-foundation\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/intl\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/routing\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/security-core\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/security-csrf\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/string\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/translation\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/twig-bundle\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/validator\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/yaml\": \"^6.4 || ^7.4 || ^8.0\",\n        \"webmozart/assert\": \"^1.11\",\n        \"willdurand/negotiation\": \"^3.1\"\n    },\n    \"replace\": {\n        \"sylius/resource\": \"self.version\"\n    },\n    \"require-dev\": {\n        \"coduo/php-matcher\": \"^6.0\",\n        \"doctrine/data-fixtures\": \"^2.0\",\n        \"doctrine/doctrine-bundle\": \"^2.13 || ^3.0 || ^4.0\",\n        \"doctrine/orm\": \"^2.18 || ^3.3\",\n        \"jackalope/jackalope\": \"^2.0\",\n        \"jackalope/jackalope-doctrine-dbal\": \"^2.0\",\n        \"matthiasnoback/symfony-dependency-injection-test\": \"^6.1.0\",\n        \"openlss/lib-array2xml\": \"^1.0\",\n        \"pagerfanta/pagerfanta\": \"^4.4\",\n        \"phpcr/phpcr\": \"^2.1\",\n        \"phpstan/phpstan\": \"^1.12\",\n        \"phpstan/phpstan-phpunit\": \"^1.4\",\n        \"phpstan/phpstan-webmozart-assert\": \"^1.2\",\n        \"phpunit/phpunit\": \"^10.0\",\n        \"rector/rector\": \"^0.18.2\",\n        \"sylius-labs/coding-standard\": \"^4.4\",\n        \"sylius/grid-bundle\": \"^1.13 || ^1.15@alpha\",\n        \"symfony/browser-kit\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/console\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/css-selector\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/dependency-injection\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/dotenv\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/http-kernel\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/messenger\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/security-bundle\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/serializer\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/stopwatch\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/uid\": \"^6.4 || ^7.4 || ^8.0\",\n        \"twig/twig\": \"^3.14\",\n        \"zenstruck/foundry\": \"^2.3\"\n    },\n    \"conflict\": {\n        \"behat/transliterator\": \"<1.2\",\n        \"doctrine/orm\": \"<2.18\",\n        \"doctrine/doctrine-bundle\": \"<2.0\",\n        \"doctrine/phpcr-odm\": \"<2.1\",\n        \"friendsofsymfony/rest-bundle\": \"<3.7\",\n        \"gedmo/doctrine-extensions\": \"<3.17.1\",\n        \"jms/serializer-bundle\": \"<5.5\",\n        \"pagerfanta/pagerfanta\" : \"<4.4\",\n        \"willdurand/hateoas-bundle\": \"<2.5 || ^3.0\",\n        \"winzou/state-machine-bundle\": \"<0.6.2\",\n        \"symfony/workflow\": \"<6.4 || >=7.0,<7.4\",\n        \"twig/twig\": \"<3.0\"\n    },\n    \"suggest\": {\n        \"doctrine/orm\": \"^2.20\",\n        \"sylius/locale\": \"^1.0\"\n    },\n    \"config\": {\n        \"allow-plugins\": {\n            \"symfony/flex\": true,\n            \"dealerdirect/phpcodesniffer-composer-installer\": false\n        },\n        \"sort-packages\": true\n    },\n    \"extra\": {\n        \"symfony\": {\n            \"require\": \"8.0.*\"\n        }\n    },\n    \"autoload\": {\n        \"psr-4\": {\n            \"Sylius\\\\Bundle\\\\ResourceBundle\\\\\": \"src/Bundle/\",\n            \"Sylius\\\\Component\\\\Resource\\\\\": \"src/Component/legacy/src/\",\n            \"Sylius\\\\Resource\\\\\": \"src/Component/src/\"\n        }\n    },\n    \"autoload-dev\": {\n        \"psr-4\": {\n            \"Sylius\\\\Bundle\\\\ResourceBundle\\\\Tests\\\\\": \"tests/Bundle/\",\n            \"Sylius\\\\Component\\\\Resource\\\\spec\\\\\": \"src/Component/legacy/spec/\",\n            \"Sylius\\\\Component\\\\Resource\\\\Tests\\\\\": \"src/Component/legacy/tests/\",\n            \"Sylius\\\\Resource\\\\Tests\\\\\": \"src/Component/tests/\",\n            \"App\\\\\": \"tests/Application/src/\",\n            \"Tests\\\\\": \"tests/\"\n        }\n    },\n    \"scripts\": {\n        \"analyse\": [\n            \"@composer validate --strict\",\n            \"vendor/bin/ecs check\",\n            \"vendor/bin/phpstan analyse --ansi --memory-limit=256M -c phpstan.neon src\"\n        ],\n        \"fix\": [\n            \"vendor/bin/ecs check --fix\"\n        ],\n        \"test\": [\n            \"vendor/bin/phpunit --colors=always\"\n        ]\n    }\n}\n"
  },
  {
    "path": "docker-compose.yml",
    "content": "services:\n    package:\n        build:\n            context: .\n            target: php\n            args:\n                COMPOSER_VERSION: \"2.3\"\n                PHP_VERSION: \"8.4\"\n        command: [\"composer\", \"test\"]\n        volumes:\n            - ./:/package:delegate\n"
  },
  {
    "path": "ecs.php",
    "content": "<?php\n\nuse PhpCsFixer\\Fixer\\ClassNotation\\VisibilityRequiredFixer;\nuse PhpCsFixer\\Fixer\\Comment\\HeaderCommentFixer;\nuse PhpCsFixer\\Fixer\\FunctionNotation\\MethodArgumentSpaceFixer;\nuse PhpCsFixer\\Fixer\\FunctionNotation\\NullableTypeDeclarationForDefaultNullValueFixer;\nuse PhpCsFixer\\Fixer\\Phpdoc\\NoSuperfluousPhpdocTagsFixer;\nuse SlevomatCodingStandard\\Sniffs\\Commenting\\InlineDocCommentDeclarationSniff;\nuse Symplify\\EasyCodingStandard\\Config\\ECSConfig;\n\nreturn static function (ECSConfig $ecsConfig): void {\n    $ecsConfig->paths([\n        __DIR__ . '/src',\n        __DIR__ . '/tests',\n    ]);\n\n    $ecsConfig->skip([\n        __DIR__ . '/tests/Application/config/reference.php',\n    ]);\n\n    $ecsConfig->import('vendor/sylius-labs/coding-standard/ecs.php');\n\n    $ecsConfig->ruleWithConfiguration(HeaderCommentFixer::class, [\n            'location' => 'after_open',\n            'header' =>\n'This file is part of the Sylius package.\n\n(c) Sylius Sp. z o.o.\n\nFor the full copyright and license information, please view the LICENSE\nfile that was distributed with this source code.',\n        ])\n    ;\n    $ecsConfig->ruleWithConfiguration(NoSuperfluousPhpdocTagsFixer::class, ['allow_mixed' => true]);\n    $ecsConfig->ruleWithConfiguration(NullableTypeDeclarationForDefaultNullValueFixer::class, ['use_nullable_type_declaration' => true]);\n\n    $ecsConfig->skip([\n        InlineDocCommentDeclarationSniff::class . '.MissingVariable',\n        VisibilityRequiredFixer::class => ['*Spec.php'],\n        MethodArgumentSpaceFixer::class => ['*/BoardGameBlog/*', '*/Subscription/*'],\n        'src/Bundle/Controller/ControllerTrait.php',\n        'src/Bundle/EventListener/ODMMappedSuperClassSubscriber.php', // hot-fix to fix the build\n        'src/Component/vendor/*',\n        'src/Component/Reflection/ClassReflection.php',\n        '**/var/*',\n    ]);\n};\n"
  },
  {
    "path": "phpstan-baseline.neon",
    "content": "parameters:\n\tignoreErrors:\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\AbstractResourceBundle\\\\:\\\\:getMappingCompilerPassInfo\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/AbstractResourceBundle.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Command\\\\\\\\DebugResourceCommand\\\\:\\\\:addResourceOperationsRows\\\\(\\\\) has parameter \\\\$rows with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Command/DebugResourceCommand.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Command\\\\\\\\DebugResourceCommand\\\\:\\\\:addResourceOperationsRows\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Command/DebugResourceCommand.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Command\\\\\\\\DebugResourceCommand\\\\:\\\\:configurationToArray\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Command/DebugResourceCommand.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Command\\\\\\\\DebugResourceCommand\\\\:\\\\:objectToArray\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Command/DebugResourceCommand.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Command\\\\\\\\DebugResourceCommand\\\\:\\\\:operationToArray\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Command/DebugResourceCommand.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Command\\\\\\\\DebugResourceCommand\\\\:\\\\:resourceToArray\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Command/DebugResourceCommand.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Context\\\\\\\\Initiator\\\\\\\\LegacyRequestContextInitiator\\\\:\\\\:resolveVars\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Context/Initiator/LegacyRequestContextInitiator.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Context\\\\\\\\Initiator\\\\\\\\LegacyRequestContextInitiator\\\\:\\\\:resolveVars\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Context/Initiator/LegacyRequestContextInitiator.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot cast mixed to string\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/FlashHelper.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\FlashHelper\\\\:\\\\:addFlash\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/FlashHelper.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\FlashHelper\\\\:\\\\:getParametersWithName\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/FlashHelper.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\FlashHelper\\\\:\\\\:isTranslationDefined\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/FlashHelper.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\FlashHelper\\\\:\\\\:prepareMessage\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/FlashHelper.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\FlashHelper\\\\:\\\\:prepareMessage\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/FlashHelper.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\NewResourceFactory\\\\:\\\\:create\\\\(\\\\) has parameter \\\\$factory with generic interface Sylius\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\FactoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/NewResourceFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\NewResourceFactoryInterface\\\\:\\\\:create\\\\(\\\\) has parameter \\\\$factory with generic interface Sylius\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\FactoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/NewResourceFactoryInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ParametersParser\\\\:\\\\:parseRequestValues\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ParametersParser.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ParametersParser\\\\:\\\\:parseRequestValues\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ParametersParser.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#2 \\\\$callback of function preg_replace_callback expects callable\\\\(array\\\\<int\\\\|string, string\\\\>\\\\)\\\\: string, Closure\\\\(array\\\\)\\\\: mixed given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ParametersParser.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ParametersParserInterface\\\\:\\\\:parseRequestValues\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ParametersParserInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ParametersParserInterface\\\\:\\\\:parseRequestValues\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ParametersParserInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot cast mixed to string\\\\.$#\"\n\t\t\tcount: 3\n\t\t\tpath: src/Bundle/Controller/RedirectHandler.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RedirectHandler\\\\:\\\\:redirectToRoute\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RedirectHandler.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RedirectHandlerInterface\\\\:\\\\:redirectToRoute\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RedirectHandlerInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot access offset 'arguments' on mixed\\\\.$#\"\n\t\t\tcount: 2\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot access offset 'graph' on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot access offset 'options' on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot access offset 'parameters' on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot access offset 'transition' on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot access offset 'type' on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot cast mixed to int\\\\.$#\"\n\t\t\tcount: 2\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:addExtraRedirectParameters\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:addExtraRedirectParameters\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getCriteria\\\\(\\\\) has parameter \\\\$criteria with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getCriteria\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getEvent\\\\(\\\\) should return string\\\\|null but returns mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getFactoryArguments\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getFactoryMethod\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getFormOptions\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getFormOptions\\\\(\\\\) should return array but returns mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getFormType\\\\(\\\\) should return string\\\\|null but returns mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getGrid\\\\(\\\\) should return string but returns mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getPermission\\\\(\\\\) should return string but returns mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getRedirectParameters\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getRepositoryArguments\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getRepositoryMethod\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getRequestParameter\\\\(\\\\) has parameter \\\\$defaults with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getRequestParameter\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getSection\\\\(\\\\) should return string\\\\|null but returns mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getSerializationGroups\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getSerializationGroups\\\\(\\\\) should return array\\\\|null but returns mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getSorting\\\\(\\\\) has parameter \\\\$sorting with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getSorting\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getStateMachineGraph\\\\(\\\\) should return string\\\\|null but returns mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getStateMachineTransition\\\\(\\\\) should return string\\\\|null but returns mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getVars\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:getVars\\\\(\\\\) should return array but returns mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:isCsrfProtectionEnabled\\\\(\\\\) should return bool but returns mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:parseResourceValues\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfiguration\\\\:\\\\:parseResourceValues\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$redirect has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#1 \\\\.\\\\.\\\\.\\\\$arrays of function array_merge expects array, mixed given\\\\.$#\"\n\t\t\tcount: 2\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#2 \\\\.\\\\.\\\\.\\\\$replacements of function array_replace_recursive expects array, mixed given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot access offset 'allowed…' on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfigurationFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot access offset 'serialization_groups' on mixed\\\\.$#\"\n\t\t\tcount: 2\n\t\t\tpath: src/Bundle/Controller/RequestConfigurationFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot access offset 'serialization…' on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfigurationFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfigurationFactory\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$defaultParameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfigurationFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfigurationFactory\\\\:\\\\:parseApiParameters\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfigurationFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfigurationFactory\\\\:\\\\:parseApiParameters\\\\(\\\\) should return array but returns mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfigurationFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#1 \\\\.\\\\.\\\\.\\\\$arrays of function array_merge expects array, mixed given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfigurationFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#2 \\\\.\\\\.\\\\.\\\\$arrays of function array_merge expects array, mixed given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfigurationFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RequestConfigurationFactory\\\\:\\\\:\\\\$defaultParameters type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/RequestConfigurationFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method create\\\\(\\\\) on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method createBuilder\\\\(\\\\) on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method dispatch\\\\(\\\\) on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method display\\\\(\\\\) on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method generate\\\\(\\\\) on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method getCurrentRequest\\\\(\\\\) on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method getSession\\\\(\\\\) on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method getToken\\\\(\\\\) on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method handle\\\\(\\\\) on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method isGranted\\\\(\\\\) on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method isTokenValid\\\\(\\\\) on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method render\\\\(\\\\) on mixed\\\\.$#\"\n\t\t\tcount: 4\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method serialize\\\\(\\\\) on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method stream\\\\(\\\\) on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method withLink\\\\(\\\\) on mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$factory with generic interface Sylius\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\FactoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repository with generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:addFlash\\\\(\\\\) has no return type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:addFlash\\\\(\\\\) has parameter \\\\$message with no type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:addLink\\\\(\\\\) has no return type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:createForm\\\\(\\\\) has parameter \\\\$data with no type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:createForm\\\\(\\\\) has parameter \\\\$options with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:createFormBuilder\\\\(\\\\) has parameter \\\\$data with no type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:createFormBuilder\\\\(\\\\) has parameter \\\\$options with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:denyAccessUnlessGranted\\\\(\\\\) has no return type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:denyAccessUnlessGranted\\\\(\\\\) has parameter \\\\$attributes with no type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:denyAccessUnlessGranted\\\\(\\\\) has parameter \\\\$subject with no type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:forward\\\\(\\\\) has parameter \\\\$path with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:forward\\\\(\\\\) has parameter \\\\$query with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:generateUrl\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:get\\\\(\\\\) should return object but returns mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:getDoctrine\\\\(\\\\) should return Doctrine\\\\\\\\Persistence\\\\\\\\ManagerRegistry but returns mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:isGranted\\\\(\\\\) has parameter \\\\$attributes with no type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:isGranted\\\\(\\\\) has parameter \\\\$subject with no type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:json\\\\(\\\\) has parameter \\\\$context with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:json\\\\(\\\\) has parameter \\\\$data with no type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:json\\\\(\\\\) has parameter \\\\$headers with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:redirectToRoute\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:render\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:renderView\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:stream\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#1 \\\\$resource of method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceUpdateHandlerInterface\\\\:\\\\:handle\\\\(\\\\) expects Sylius\\\\\\\\Resource\\\\\\\\Model\\\\\\\\ResourceInterface, mixed given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#1 \\\\$resource of method Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface\\\\<Sylius\\\\\\\\Resource\\\\\\\\Model\\\\\\\\ResourceInterface\\\\>\\\\:\\\\:add\\\\(\\\\) expects Sylius\\\\\\\\Resource\\\\\\\\Model\\\\\\\\ResourceInterface, mixed given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#1 \\\\$view of method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:render\\\\(\\\\) expects string, mixed given\\\\.$#\"\n\t\t\tcount: 4\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#2 \\\\$resource of method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RedirectHandlerInterface\\\\:\\\\:redirectToIndex\\\\(\\\\) expects Sylius\\\\\\\\Resource\\\\\\\\Model\\\\\\\\ResourceInterface\\\\|null, mixed given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#2 \\\\$resource of method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\RedirectHandlerInterface\\\\:\\\\:redirectToResource\\\\(\\\\) expects Sylius\\\\\\\\Resource\\\\\\\\Model\\\\\\\\ResourceInterface, mixed given\\\\.$#\"\n\t\t\tcount: 3\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#2 \\\\$resource of method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\StateMachineInterface\\\\:\\\\:apply\\\\(\\\\) expects Sylius\\\\\\\\Resource\\\\\\\\Model\\\\\\\\ResourceInterface, mixed given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#2 \\\\$token of method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:isCsrfTokenValid\\\\(\\\\) expects string\\\\|null, mixed given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#3 \\\\$resource of method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\EventDispatcherInterface\\\\:\\\\:dispatchPostEvent\\\\(\\\\) expects Sylius\\\\\\\\Resource\\\\\\\\Model\\\\\\\\ResourceInterface, mixed given\\\\.$#\"\n\t\t\tcount: 2\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#3 \\\\$resource of method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\EventDispatcherInterface\\\\:\\\\:dispatchPreEvent\\\\(\\\\) expects Sylius\\\\\\\\Resource\\\\\\\\Model\\\\\\\\ResourceInterface, mixed given\\\\.$#\"\n\t\t\tcount: 2\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#3 \\\\$resource of method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\FlashHelperInterface\\\\:\\\\:addSuccessFlash\\\\(\\\\) expects Sylius\\\\\\\\Resource\\\\\\\\Model\\\\\\\\ResourceInterface\\\\|null, mixed given\\\\.$#\"\n\t\t\tcount: 2\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:\\\\$container \\\\(Psr\\\\\\\\Container\\\\\\\\ContainerInterface\\\\) does not accept Symfony\\\\\\\\Component\\\\\\\\DependencyInjection\\\\\\\\ContainerInterface\\\\|null\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:\\\\$factory with generic interface Sylius\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\FactoryInterface does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceController\\\\:\\\\:\\\\$repository with generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceDeleteHandler\\\\:\\\\:handle\\\\(\\\\) has parameter \\\\$repository with generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceDeleteHandler.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourceDeleteHandlerInterface\\\\:\\\\:handle\\\\(\\\\) has parameter \\\\$repository with generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourceDeleteHandlerInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourcesCollectionProvider\\\\:\\\\:get\\\\(\\\\) has no return type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourcesCollectionProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourcesCollectionProvider\\\\:\\\\:get\\\\(\\\\) has parameter \\\\$repository with generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourcesCollectionProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#1 \\\\$name of class Hateoas\\\\\\\\Configuration\\\\\\\\Route constructor expects JMS\\\\\\\\Serializer\\\\\\\\Expression\\\\\\\\Expression\\\\|string, mixed given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourcesCollectionProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#1 \\\\.\\\\.\\\\.\\\\$arrays of function array_merge expects array, mixed given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourcesCollectionProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourcesCollectionProviderInterface\\\\:\\\\:get\\\\(\\\\) has no return type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourcesCollectionProviderInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourcesCollectionProviderInterface\\\\:\\\\:get\\\\(\\\\) has parameter \\\\$repository with generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourcesCollectionProviderInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourcesResolver\\\\:\\\\:getResources\\\\(\\\\) has no return type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourcesResolver.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourcesResolver\\\\:\\\\:getResources\\\\(\\\\) has parameter \\\\$repository with generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourcesResolver.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourcesResolverInterface\\\\:\\\\:getResources\\\\(\\\\) has no return type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourcesResolverInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\ResourcesResolverInterface\\\\:\\\\:getResources\\\\(\\\\) has parameter \\\\$repository with generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ResourcesResolverInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\SingleResourceProvider\\\\:\\\\:get\\\\(\\\\) has parameter \\\\$repository with generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/SingleResourceProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Controller\\\\\\\\SingleResourceProviderInterface\\\\:\\\\:get\\\\(\\\\) has parameter \\\\$repository with generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/SingleResourceProviderInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#1 \\\\$version of method FOS\\\\\\\\RestBundle\\\\\\\\View\\\\\\\\ConfigurableViewHandlerInterface\\\\:\\\\:setExclusionStrategyVersion\\\\(\\\\) expects string, mixed given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Controller/ViewHandler.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$resources has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/DoctrineTargetEntitiesResolverPass.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\Compiler\\\\\\\\Helper\\\\\\\\TargetEntitiesResolver\\\\:\\\\:getModel\\\\(\\\\) has parameter \\\\$configuration with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/Helper/TargetEntitiesResolver.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\Compiler\\\\\\\\Helper\\\\\\\\TargetEntitiesResolver\\\\:\\\\:resolve\\\\(\\\\) has parameter \\\\$resourcesConfiguration with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/Helper/TargetEntitiesResolver.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\Compiler\\\\\\\\Helper\\\\\\\\TargetEntitiesResolver\\\\:\\\\:resolve\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/Helper/TargetEntitiesResolver.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\Compiler\\\\\\\\Helper\\\\\\\\TargetEntitiesResolverInterface\\\\:\\\\:resolve\\\\(\\\\) has parameter \\\\$resourcesConfiguration with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/Helper/TargetEntitiesResolverInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\Compiler\\\\\\\\Helper\\\\\\\\TargetEntitiesResolverInterface\\\\:\\\\:resolve\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/Helper/TargetEntitiesResolverInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\Compiler\\\\\\\\PrioritizedCompositeServicePass\\\\:\\\\:addMethodCall\\\\(\\\\) has parameter \\\\$attributes with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/PrioritizedCompositeServicePass.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\Compiler\\\\\\\\PrioritizedCompositeServicePass\\\\:\\\\:addMethodCalls\\\\(\\\\) has parameter \\\\$tags with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/PrioritizedCompositeServicePass.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$resources has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/RegisterFqcnControllersPass.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$resources has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/RegisterResourceRepositoryPass.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$resources has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/RegisterResourceStateMachinePass.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$interfaces has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/RegisterResourcesPass.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$resources has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/RegisterResourcesPass.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$bundles has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/RegisterStateMachinePass.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$settings has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/RegisterStateMachinePass.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$bundles has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/UnregisterFosRestDefinitionsPass.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$bundles has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/UnregisterHateoasDefinitionsPass.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$bundles has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Compiler/WinzouStateMachinePass.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method end\\\\(\\\\) on Symfony\\\\\\\\Component\\\\\\\\Config\\\\\\\\Definition\\\\\\\\Builder\\\\\\\\NodeParentInterface\\\\|null\\\\.$#\"\n\t\t\tcount: 3\n\t\t\tpath: src/Bundle/DependencyInjection/Configuration.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method variableNode\\\\(\\\\) on Symfony\\\\\\\\Component\\\\\\\\Config\\\\\\\\Definition\\\\\\\\Builder\\\\\\\\NodeParentInterface\\\\|null\\\\.$#\"\n\t\t\tcount: 2\n\t\t\tpath: src/Bundle/DependencyInjection/Configuration.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$factoryInterfaces has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Driver/AbstractDriver.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$factoryParents has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Driver/AbstractDriver.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$repositoryInterfaces has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Driver/Doctrine/DoctrineORMDriver.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$repositoryParents has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Driver/Doctrine/DoctrineORMDriver.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#1 \\\\$array of function array_keys expects array, array\\\\|string given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Driver/Doctrine/DoctrinePHPCRDriver.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#1 \\\\$class of class Symfony\\\\\\\\Component\\\\\\\\DependencyInjection\\\\\\\\Definition constructor expects string\\\\|null, class\\\\-string\\\\|Symfony\\\\\\\\Component\\\\\\\\DependencyInjection\\\\\\\\Parameter given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Driver/Doctrine/DoctrinePHPCRDriver.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#2 \\\\.\\\\.\\\\.\\\\$arrays of function array_merge expects array, array\\\\|string given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Driver/Doctrine/DoctrinePHPCRDriver.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\Extension\\\\\\\\AbstractResourceExtension\\\\:\\\\:registerResources\\\\(\\\\) has parameter \\\\$registeredResources with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Extension/AbstractResourceExtension.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$resources has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/Extension/AbstractResourceExtension.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method end\\\\(\\\\) on Symfony\\\\\\\\Component\\\\\\\\Config\\\\\\\\Definition\\\\\\\\Builder\\\\\\\\NodeParentInterface\\\\|null\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/PagerfantaConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method scalarNode\\\\(\\\\) on Symfony\\\\\\\\Component\\\\\\\\Config\\\\\\\\Definition\\\\\\\\Builder\\\\\\\\NodeParentInterface\\\\|null\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/PagerfantaConfiguration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\PagerfantaExtension\\\\:\\\\:getConfiguration\\\\(\\\\) has parameter \\\\$config with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/PagerfantaExtension.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\SyliusResourceExtension\\\\:\\\\:autoRegisterResources\\\\(\\\\) has parameter \\\\$config with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/SyliusResourceExtension.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\SyliusResourceExtension\\\\:\\\\:getAvailableDrivers\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/SyliusResourceExtension.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\SyliusResourceExtension\\\\:\\\\:getConfiguration\\\\(\\\\) has parameter \\\\$config with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/SyliusResourceExtension.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\SyliusResourceExtension\\\\:\\\\:getResourceFilesToWatch\\\\(\\\\) has parameter \\\\$config with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/SyliusResourceExtension.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\SyliusResourceExtension\\\\:\\\\:getResourceFilesToWatch\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/SyliusResourceExtension.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\SyliusResourceExtension\\\\:\\\\:loadPersistence\\\\(\\\\) has parameter \\\\$drivers with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/SyliusResourceExtension.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\SyliusResourceExtension\\\\:\\\\:loadResources\\\\(\\\\) has parameter \\\\$loadedResources with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/SyliusResourceExtension.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\DependencyInjection\\\\\\\\SyliusResourceExtension\\\\:\\\\:registerMetadataConfiguration\\\\(\\\\) has parameter \\\\$config with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/SyliusResourceExtension.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$mapping has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/DependencyInjection/SyliusResourceExtension.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$resources has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 2\n\t\t\tpath: src/Bundle/DependencyInjection/SyliusResourceExtension.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Doctrine\\\\\\\\ORM\\\\\\\\ContainerRepositoryFactory\\\\:\\\\:getOrCreateRepository\\\\(\\\\) has parameter \\\\$metadata with generic class Doctrine\\\\\\\\ORM\\\\\\\\Mapping\\\\\\\\ClassMetadata but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Doctrine/ORM/ContainerRepositoryFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Doctrine\\\\\\\\ORM\\\\\\\\ContainerRepositoryFactory\\\\:\\\\:getOrCreateRepository\\\\(\\\\) return type with generic class Doctrine\\\\\\\\ORM\\\\\\\\EntityRepository does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Doctrine/ORM/ContainerRepositoryFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Doctrine\\\\\\\\ORM\\\\\\\\ContainerRepositoryFactory\\\\:\\\\:getRepository\\\\(\\\\) return type with generic class Doctrine\\\\\\\\ORM\\\\\\\\EntityRepository does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Doctrine/ORM/ContainerRepositoryFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$repository contains generic class Doctrine\\\\\\\\ORM\\\\\\\\EntityRepository but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Doctrine/ORM/ContainerRepositoryFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Doctrine\\\\\\\\ORM\\\\\\\\ContainerRepositoryFactory\\\\:\\\\:\\\\$managedRepositories with generic class Doctrine\\\\\\\\ORM\\\\\\\\EntityRepository does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Doctrine/ORM/ContainerRepositoryFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Class Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Doctrine\\\\\\\\ORM\\\\\\\\EntityRepository extends generic class Doctrine\\\\\\\\ORM\\\\\\\\EntityRepository but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Doctrine/ORM/EntityRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^Class Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Doctrine\\\\\\\\ORM\\\\\\\\EntityRepository implements generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Doctrine/ORM/EntityRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Doctrine\\\\\\\\ORM\\\\\\\\EntityRepository\\\\:\\\\:applyCriteria\\\\(\\\\) has parameter \\\\$criteria with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Doctrine/ORM/EntityRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Doctrine\\\\\\\\ORM\\\\\\\\EntityRepository\\\\:\\\\:applySorting\\\\(\\\\) has parameter \\\\$sorting with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Doctrine/ORM/EntityRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Doctrine\\\\\\\\ORM\\\\\\\\EntityRepository\\\\:\\\\:getArrayPaginator\\\\(\\\\) has parameter \\\\$objects with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Doctrine/ORM/EntityRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Doctrine\\\\\\\\ORM\\\\\\\\EntityRepository\\\\:\\\\:getArrayPaginator\\\\(\\\\) return type with generic interface Pagerfanta\\\\\\\\PagerfantaInterface does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Doctrine/ORM/EntityRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Doctrine\\\\\\\\ORM\\\\\\\\EntityRepository\\\\:\\\\:getPaginator\\\\(\\\\) return type with generic interface Pagerfanta\\\\\\\\PagerfantaInterface does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Doctrine/ORM/EntityRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Doctrine\\\\\\\\ORM\\\\\\\\Form\\\\\\\\Builder\\\\\\\\DefaultFormBuilder\\\\:\\\\:build\\\\(\\\\) has parameter \\\\$options with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Doctrine/ORM/Form/Builder/DefaultFormBuilder.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Doctrine\\\\\\\\ORM\\\\\\\\Form\\\\\\\\Builder\\\\\\\\DefaultFormBuilder\\\\:\\\\:doBuild\\\\(\\\\) has parameter \\\\$classMetadata with generic class Doctrine\\\\\\\\ORM\\\\\\\\Mapping\\\\\\\\ClassMetadata but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Doctrine/ORM/Form/Builder/DefaultFormBuilder.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Doctrine\\\\\\\\ResourceMappingDriverChain\\\\:\\\\:convertResourceMappedSuperclass\\\\(\\\\) has parameter \\\\$metadata with generic interface Doctrine\\\\\\\\Persistence\\\\\\\\Mapping\\\\\\\\ClassMetadata but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Doctrine/ResourceMappingDriverChain.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\EventListener\\\\\\\\AbstractDoctrineListener\\\\:\\\\:isResource\\\\(\\\\) has parameter \\\\$metadata with generic interface Doctrine\\\\\\\\Persistence\\\\\\\\Mapping\\\\\\\\ClassMetadata but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/EventListener/AbstractDoctrineListener.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\EventListener\\\\\\\\ORMMappedSuperClassSubscriber\\\\:\\\\:setAssociationMappings\\\\(\\\\) has parameter \\\\$metadata with generic class Doctrine\\\\\\\\ORM\\\\\\\\Mapping\\\\\\\\ClassMetadata but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/EventListener/ORMMappedSuperClassSubscriber.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\EventListener\\\\\\\\ORMMappedSuperClassSubscriber\\\\:\\\\:unsetAssociationMappings\\\\(\\\\) has parameter \\\\$metadata with generic class Doctrine\\\\\\\\ORM\\\\\\\\Mapping\\\\\\\\ClassMetadata but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/EventListener/ORMMappedSuperClassSubscriber.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\EventListener\\\\\\\\ORMRepositoryClassSubscriber\\\\:\\\\:setCustomRepositoryClass\\\\(\\\\) has parameter \\\\$metadata with generic class Doctrine\\\\\\\\ORM\\\\\\\\Mapping\\\\\\\\ClassMetadata but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/EventListener/ORMRepositoryClassSubscriber.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$repository contains generic class Doctrine\\\\\\\\ORM\\\\\\\\EntityRepository but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/EventListener/ORMRepositoryClassSubscriber.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\EventListener\\\\\\\\ORMTranslatableListener\\\\:\\\\:hasUniqueConstraint\\\\(\\\\) has parameter \\\\$columns with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/EventListener/ORMTranslatableListener.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\EventListener\\\\\\\\ORMTranslatableListener\\\\:\\\\:hasUniqueConstraint\\\\(\\\\) has parameter \\\\$metadata with generic class Doctrine\\\\\\\\ORM\\\\\\\\Mapping\\\\\\\\ClassMetadata but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/EventListener/ORMTranslatableListener.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\EventListener\\\\\\\\ORMTranslatableListener\\\\:\\\\:mapTranslatable\\\\(\\\\) has parameter \\\\$metadata with generic class Doctrine\\\\\\\\ORM\\\\\\\\Mapping\\\\\\\\ClassMetadata but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/EventListener/ORMTranslatableListener.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\EventListener\\\\\\\\ORMTranslatableListener\\\\:\\\\:mapTranslation\\\\(\\\\) has parameter \\\\$metadata with generic class Doctrine\\\\\\\\ORM\\\\\\\\Mapping\\\\\\\\ClassMetadata but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/EventListener/ORMTranslatableListener.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\ExpressionLanguage\\\\\\\\ExpressionLanguage\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$providers with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/ExpressionLanguage/ExpressionLanguage.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\Builder\\\\\\\\DefaultFormBuilderInterface\\\\:\\\\:build\\\\(\\\\) has parameter \\\\$options with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/Builder/DefaultFormBuilderInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Class Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\DataTransformer\\\\\\\\CollectionToStringTransformer implements generic interface Symfony\\\\\\\\Component\\\\\\\\Form\\\\\\\\DataTransformerInterface but does not specify its types\\\\: TValue, TTransformedValue$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/DataTransformer/CollectionToStringTransformer.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\DataTransformer\\\\\\\\CollectionToStringTransformer\\\\:\\\\:reverseTransform\\\\(\\\\) return type with generic interface Doctrine\\\\\\\\Common\\\\\\\\Collections\\\\\\\\Collection does not specify its types\\\\: TKey, T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/DataTransformer/CollectionToStringTransformer.php\n\n\t\t-\n\t\t\tmessage: \"#^Class Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\DataTransformer\\\\\\\\RecursiveTransformer implements generic interface Symfony\\\\\\\\Component\\\\\\\\Form\\\\\\\\DataTransformerInterface but does not specify its types\\\\: TValue, TTransformedValue$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/DataTransformer/RecursiveTransformer.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\DataTransformer\\\\\\\\RecursiveTransformer\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$decoratedTransformer with generic interface Symfony\\\\\\\\Component\\\\\\\\Form\\\\\\\\DataTransformerInterface but does not specify its types\\\\: TValue, TTransformedValue$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/DataTransformer/RecursiveTransformer.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\DataTransformer\\\\\\\\RecursiveTransformer\\\\:\\\\:reverseTransform\\\\(\\\\) has parameter \\\\$value with generic interface Doctrine\\\\\\\\Common\\\\\\\\Collections\\\\\\\\Collection but does not specify its types\\\\: TKey, T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/DataTransformer/RecursiveTransformer.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\DataTransformer\\\\\\\\RecursiveTransformer\\\\:\\\\:reverseTransform\\\\(\\\\) return type with generic interface Doctrine\\\\\\\\Common\\\\\\\\Collections\\\\\\\\ReadableCollection does not specify its types\\\\: TKey, T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/DataTransformer/RecursiveTransformer.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\DataTransformer\\\\\\\\RecursiveTransformer\\\\:\\\\:transform\\\\(\\\\) has parameter \\\\$value with generic interface Doctrine\\\\\\\\Common\\\\\\\\Collections\\\\\\\\Collection but does not specify its types\\\\: TKey, T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/DataTransformer/RecursiveTransformer.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\DataTransformer\\\\\\\\RecursiveTransformer\\\\:\\\\:transform\\\\(\\\\) return type with generic interface Doctrine\\\\\\\\Common\\\\\\\\Collections\\\\\\\\ReadableCollection does not specify its types\\\\: TKey, T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/DataTransformer/RecursiveTransformer.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\DataTransformer\\\\\\\\RecursiveTransformer\\\\:\\\\:\\\\$decoratedTransformer with generic interface Symfony\\\\\\\\Component\\\\\\\\Form\\\\\\\\DataTransformerInterface does not specify its types\\\\: TValue, TTransformedValue$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/DataTransformer/RecursiveTransformer.php\n\n\t\t-\n\t\t\tmessage: \"#^Class Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\DataTransformer\\\\\\\\ResourceToIdentifierTransformer implements generic interface Symfony\\\\\\\\Component\\\\\\\\Form\\\\\\\\DataTransformerInterface but does not specify its types\\\\: TValue, TTransformedValue$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/DataTransformer/ResourceToIdentifierTransformer.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\DataTransformer\\\\\\\\ResourceToIdentifierTransformer\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repository with generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/DataTransformer/ResourceToIdentifierTransformer.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#4 \\\\.\\\\.\\\\.\\\\$values of function sprintf expects bool\\\\|float\\\\|int\\\\|string\\\\|null, mixed given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/DataTransformer/ResourceToIdentifierTransformer.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\DataTransformer\\\\\\\\ResourceToIdentifierTransformer\\\\:\\\\:\\\\$repository with generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/DataTransformer/ResourceToIdentifierTransformer.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\EventSubscriber\\\\\\\\AddCodeFormSubscriber\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$options with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/EventSubscriber/AddCodeFormSubscriber.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\EventSubscriber\\\\\\\\AddCodeFormSubscriber\\\\:\\\\:\\\\$options type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/EventSubscriber/AddCodeFormSubscriber.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$default has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\Registry\\\\\\\\FormTypeRegistry\\\\:\\\\:\\\\$formTypes type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/Registry/FormTypeRegistry.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\Type\\\\\\\\ResourceToIdentifierType\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repository with generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/Type/ResourceToIdentifierType.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Form\\\\\\\\Type\\\\\\\\ResourceToIdentifierType\\\\:\\\\:\\\\$repository with generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Form/Type/ResourceToIdentifierType.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Grid\\\\\\\\Controller\\\\\\\\ResourcesResolver\\\\:\\\\:getResources\\\\(\\\\) has no return type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Grid/Controller/ResourcesResolver.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Grid\\\\\\\\Controller\\\\\\\\ResourcesResolver\\\\:\\\\:getResources\\\\(\\\\) has parameter \\\\$repository with generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Grid/Controller/ResourcesResolver.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Grid\\\\\\\\Parser\\\\\\\\OptionsParser\\\\:\\\\:parseOption\\\\(\\\\) has parameter \\\\$data with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Grid/Parser/OptionsParser.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Grid\\\\\\\\Parser\\\\\\\\OptionsParser\\\\:\\\\:parseOptionResourceField\\\\(\\\\) has parameter \\\\$data with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Grid/Parser/OptionsParser.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Grid\\\\\\\\Parser\\\\\\\\OptionsParser\\\\:\\\\:parseOptions\\\\(\\\\) has parameter \\\\$data with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Grid/Parser/OptionsParser.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Grid\\\\\\\\Parser\\\\\\\\OptionsParser\\\\:\\\\:parseOptions\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Grid/Parser/OptionsParser.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Grid\\\\\\\\Parser\\\\\\\\OptionsParser\\\\:\\\\:parseOptions\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Grid/Parser/OptionsParser.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#1 \\\\$objectOrArray of method Symfony\\\\\\\\Component\\\\\\\\PropertyAccess\\\\\\\\PropertyAccessorInterface\\\\:\\\\:getValue\\\\(\\\\) expects array\\\\|object, array\\\\|object\\\\|null given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Grid/Parser/OptionsParser.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#2 \\\\$callback of function preg_replace_callback expects callable\\\\(array\\\\<int\\\\|string, string\\\\>\\\\)\\\\: string, Closure\\\\(array\\\\)\\\\: mixed given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Grid/Parser/OptionsParser.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Grid\\\\\\\\Parser\\\\\\\\OptionsParserInterface\\\\:\\\\:parseOptions\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Grid/Parser/OptionsParserInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Grid\\\\\\\\Parser\\\\\\\\OptionsParserInterface\\\\:\\\\:parseOptions\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Grid/Parser/OptionsParserInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Grid\\\\\\\\Renderer\\\\\\\\TwigBulkActionGridRenderer\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$bulkActionTemplates with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Grid/Renderer/TwigBulkActionGridRenderer.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Grid\\\\\\\\Renderer\\\\\\\\TwigBulkActionGridRenderer\\\\:\\\\:\\\\$bulkActionTemplates type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Grid/Renderer/TwigBulkActionGridRenderer.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Grid\\\\\\\\Renderer\\\\\\\\TwigGridRenderer\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$actionTemplates with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Grid/Renderer/TwigGridRenderer.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Grid\\\\\\\\Renderer\\\\\\\\TwigGridRenderer\\\\:\\\\:\\\\$actionTemplates type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Grid/Renderer/TwigGridRenderer.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Grid\\\\\\\\View\\\\\\\\LegacyGridViewFactory\\\\:\\\\:create\\\\(\\\\) has parameter \\\\$driverConfiguration with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Grid/View/LegacyGridViewFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\ResourceBundleInterface\\\\:\\\\:getSupportedDrivers\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/ResourceBundleInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Cannot call method scalarNode\\\\(\\\\) on Symfony\\\\\\\\Component\\\\\\\\Config\\\\\\\\Definition\\\\\\\\Builder\\\\\\\\NodeParentInterface\\\\|null\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/Configuration.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\CrudRoutesAttributesLoader\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$mapping with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/CrudRoutesAttributesLoader.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\CrudRoutesAttributesLoader\\\\:\\\\:\\\\$mapping type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/CrudRoutesAttributesLoader.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\ResourceLoader\\\\:\\\\:createRoute\\\\(\\\\) has parameter \\\\$configuration with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/ResourceLoader.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\ResourceLoader\\\\:\\\\:createRoute\\\\(\\\\) has parameter \\\\$methods with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/ResourceLoader.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\ResourceLoader\\\\:\\\\:getRouteName\\\\(\\\\) has parameter \\\\$configuration with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/ResourceLoader.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\ResourceLoader\\\\:\\\\:load\\\\(\\\\) has parameter \\\\$resource with no type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/ResourceLoader.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\ResourceLoader\\\\:\\\\:load\\\\(\\\\) has parameter \\\\$type with no type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/ResourceLoader.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\ResourceLoader\\\\:\\\\:supports\\\\(\\\\) has parameter \\\\$type with no type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/ResourceLoader.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\RouteFactory\\\\:\\\\:createRoute\\\\(\\\\) has parameter \\\\$defaults with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/RouteFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\RouteFactory\\\\:\\\\:createRoute\\\\(\\\\) has parameter \\\\$methods with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/RouteFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\RouteFactory\\\\:\\\\:createRoute\\\\(\\\\) has parameter \\\\$options with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/RouteFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\RouteFactory\\\\:\\\\:createRoute\\\\(\\\\) has parameter \\\\$requirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/RouteFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\RouteFactory\\\\:\\\\:createRoute\\\\(\\\\) has parameter \\\\$schemes with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/RouteFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\RouteFactoryInterface\\\\:\\\\:createRoute\\\\(\\\\) has parameter \\\\$defaults with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/RouteFactoryInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\RouteFactoryInterface\\\\:\\\\:createRoute\\\\(\\\\) has parameter \\\\$methods with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/RouteFactoryInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\RouteFactoryInterface\\\\:\\\\:createRoute\\\\(\\\\) has parameter \\\\$options with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/RouteFactoryInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\RouteFactoryInterface\\\\:\\\\:createRoute\\\\(\\\\) has parameter \\\\$requirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/RouteFactoryInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\RouteFactoryInterface\\\\:\\\\:createRoute\\\\(\\\\) has parameter \\\\$schemes with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/RouteFactoryInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Routing\\\\\\\\RoutesAttributesLoader\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$mapping with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Routing/RoutesAttributesLoader.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Storage\\\\\\\\CookieStorage\\\\:\\\\:all\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Storage/CookieStorage.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Storage\\\\\\\\SessionStorage\\\\:\\\\:all\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Storage/SessionStorage.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Twig\\\\\\\\Context\\\\\\\\LegacyContextFactory\\\\:\\\\:create\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Twig/Context/LegacyContextFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Validator\\\\\\\\Constraints\\\\\\\\Disabled\\\\:\\\\:getTargets\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Validator/Constraints/Disabled.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Validator\\\\\\\\Constraints\\\\\\\\Enabled\\\\:\\\\:getTargets\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Validator/Constraints/Enabled.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Bundle\\\\\\\\ResourceBundle\\\\\\\\Validator\\\\\\\\UniqueWithinCollectionConstraintValidator\\\\:\\\\:validate\\\\(\\\\) has parameter \\\\$value with no value type specified in iterable type iterable\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Bundle/Validator/UniqueWithinCollectionConstraintValidator.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusCrudRoutes\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$criteria with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusCrudRoutes.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusCrudRoutes\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$except with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusCrudRoutes.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusCrudRoutes\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$only with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusCrudRoutes.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusCrudRoutes\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusCrudRoutes.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusCrudRoutes\\\\:\\\\:\\\\$criteria type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusCrudRoutes.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusCrudRoutes\\\\:\\\\:\\\\$except type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusCrudRoutes.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusCrudRoutes\\\\:\\\\:\\\\$only type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusCrudRoutes.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusCrudRoutes\\\\:\\\\:\\\\$vars type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusCrudRoutes.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusRoute\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$criteria with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusRoute.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusRoute\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$form with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusRoute.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusRoute\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$methods with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusRoute.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusRoute\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$options with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusRoute.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusRoute\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$redirect with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusRoute.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusRoute\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repository with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusRoute.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusRoute\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$requirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusRoute.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusRoute\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$schemes with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusRoute.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusRoute\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$serializationGroups with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusRoute.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusRoute\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$stateMachine with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusRoute.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Annotation\\\\\\\\SyliusRoute\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Annotation/SyliusRoute.php\n\n\t\t-\n\t\t\tmessage: \"#^Class Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\InMemoryRepository implements generic interface Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\RepositoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Doctrine/Persistence/InMemoryRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\InMemoryRepository\\\\:\\\\:applyCriteria\\\\(\\\\) has parameter \\\\$criteria with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Doctrine/Persistence/InMemoryRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\InMemoryRepository\\\\:\\\\:applyOrder\\\\(\\\\) has parameter \\\\$orderBy with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Doctrine/Persistence/InMemoryRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\InMemoryRepository\\\\:\\\\:createPaginator\\\\(\\\\) return type with generic interface Pagerfanta\\\\\\\\PagerfantaInterface does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Doctrine/Persistence/InMemoryRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\InMemoryRepository\\\\:\\\\:findBy\\\\(\\\\) has parameter \\\\$limit with no type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Doctrine/Persistence/InMemoryRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\InMemoryRepository\\\\:\\\\:findBy\\\\(\\\\) has parameter \\\\$offset with no type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Doctrine/Persistence/InMemoryRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$interfaceInterfaces has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Doctrine/Persistence/InMemoryRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$object has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Doctrine/Persistence/InMemoryRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^Parameter \\\\#1 \\\\$array of function array_multisort expects array, array\\\\|int given\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Doctrine/Persistence/InMemoryRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Resource\\\\\\\\Doctrine\\\\\\\\Persistence\\\\\\\\InMemoryRepository\\\\:\\\\:\\\\$arrayObject with generic class ArrayObject does not specify its types\\\\: TKey, TValue$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Doctrine/Persistence/InMemoryRepository.php\n\n\t\t-\n\t\t\tmessage: \"#^Class Sylius\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\Factory implements generic interface Sylius\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\FactoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Factory/Factory.php\n\n\t\t-\n\t\t\tmessage: \"#^Class Sylius\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\TranslatableFactory implements generic interface Sylius\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\TranslatableFactoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Factory/TranslatableFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\TranslatableFactory\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$factory with generic interface Sylius\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\FactoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Factory/TranslatableFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\TranslatableFactory\\\\:\\\\:\\\\$factory with generic interface Sylius\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\FactoryInterface does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Factory/TranslatableFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Interface Sylius\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\TranslatableFactoryInterface extends generic interface Sylius\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\FactoryInterface but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Factory/TranslatableFactoryInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Grid\\\\\\\\State\\\\\\\\RequestGridProvider\\\\:\\\\:provide\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Grid/State/RequestGridProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Grid\\\\\\\\State\\\\\\\\RequestGridProvider\\\\:\\\\:resolveMaxPerPage\\\\(\\\\) has parameter \\\\$gridLimits with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Grid/State/RequestGridProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Grid\\\\\\\\View\\\\\\\\Factory\\\\\\\\GridViewFactory\\\\:\\\\:create\\\\(\\\\) has parameter \\\\$driverConfiguration with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Grid/View/Factory/GridViewFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Grid\\\\\\\\View\\\\\\\\Factory\\\\\\\\GridViewFactoryInterface\\\\:\\\\:create\\\\(\\\\) has parameter \\\\$driverConfiguration with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Grid/View/Factory/GridViewFactoryInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Delete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$denormalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Delete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Delete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Delete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Delete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$normalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Delete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Delete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Delete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Delete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$routeRequirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Delete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Delete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Delete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Get\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$denormalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Get.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Get\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Get.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Get\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$normalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Get.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Get\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Get.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Get\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$routeRequirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Get.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Get\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Get.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\GetCollection\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$denormalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/GetCollection.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\GetCollection\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/GetCollection.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\GetCollection\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$normalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/GetCollection.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\GetCollection\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/GetCollection.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\GetCollection\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$routeRequirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/GetCollection.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\GetCollection\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/GetCollection.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Patch\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$denormalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Patch.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Patch\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Patch.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Patch\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$normalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Patch.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Patch\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Patch.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Patch\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$routeRequirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Patch.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Patch\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Patch.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Post\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$denormalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Post.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Post\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Post.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Post\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$normalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Post.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Post\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Post.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Post\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$routeRequirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Post.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Post\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Post.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Put\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$denormalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Put.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Put\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Put.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Put\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$normalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Put.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Put\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Put.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Put\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$routeRequirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Put.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Api\\\\\\\\Put\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Api/Put.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ApplyStateMachineTransition\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ApplyStateMachineTransition.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ApplyStateMachineTransition\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$methods with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ApplyStateMachineTransition.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ApplyStateMachineTransition\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$redirectArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ApplyStateMachineTransition.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ApplyStateMachineTransition\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ApplyStateMachineTransition.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\AsResource\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$denormalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/AsResource.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\AsResource\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$normalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/AsResource.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\AsResource\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$operations with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/AsResource.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\AsResource\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/AsResource.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\AsResource\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/AsResource.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\BulkDelete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/BulkDelete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\BulkDelete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$methods with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/BulkDelete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\BulkDelete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$redirectArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/BulkDelete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\BulkDelete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/BulkDelete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\BulkDelete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$routeRequirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/BulkDelete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\BulkDelete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/BulkDelete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\BulkUpdate\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/BulkUpdate.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\BulkUpdate\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$methods with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/BulkUpdate.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\BulkUpdate\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$redirectArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/BulkUpdate.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\BulkUpdate\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/BulkUpdate.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\BulkUpdate\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$routeRequirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/BulkUpdate.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\BulkUpdate\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/BulkUpdate.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\BulkUpdate\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/BulkUpdate.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Create\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$factoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Create.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Create\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Create.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Create\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$methods with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Create.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Create\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$redirectArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Create.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Create\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Create.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Create\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$routeRequirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Create.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Create\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Create.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Create\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Create.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Create\\\\:\\\\:getFactoryArguments\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Create.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Create\\\\:\\\\:withFactoryArguments\\\\(\\\\) has parameter \\\\$factoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Create.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Delete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Delete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Delete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$methods with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Delete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Delete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$redirectArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Delete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Delete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Delete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Delete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$routeRequirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Delete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Delete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Delete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Delete\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Delete.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Extractor\\\\\\\\AbstractResourceExtractor\\\\:\\\\:getResources\\\\(\\\\) should return array\\\\<Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ResourceMetadata\\\\> but returns array\\\\<Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ResourceMetadata\\\\>\\\\|null\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Extractor/AbstractResourceExtractor.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Extractor\\\\\\\\AbstractResourceExtractor\\\\:\\\\:\\\\$collectedParameters type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Extractor/AbstractResourceExtractor.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\FactoryAwareOperationInterface\\\\:\\\\:getFactoryArguments\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/FactoryAwareOperationInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\FactoryAwareOperationInterface\\\\:\\\\:withFactoryArguments\\\\(\\\\) has parameter \\\\$factoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/FactoryAwareOperationInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$denormalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$methods with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$normalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$redirectArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$routeRequirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:getMethods\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:getRedirectArguments\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:getRouteRequirements\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:getVars\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:withMethods\\\\(\\\\) has parameter \\\\$methods with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:withRedirectArguments\\\\(\\\\) has parameter \\\\$redirectArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:withRouteRequirements\\\\(\\\\) has parameter \\\\$routeRequirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\HttpOperation\\\\:\\\\:withVars\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/HttpOperation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Index\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Index.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Index\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$methods with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Index.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Index\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Index.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Index\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$routeRequirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Index.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Index\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Index.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Index\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Index.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Metadata\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Metadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Metadata\\\\:\\\\:fromAliasAndConfiguration\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Metadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Metadata\\\\:\\\\:getParameter\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Metadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Metadata\\\\:\\\\:getParameters\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Metadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Metadata\\\\:\\\\:parseAlias\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Metadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Metadata\\\\:\\\\:\\\\$parameters type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Metadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\MetadataInterface\\\\:\\\\:getParameter\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/MetadataInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\MetadataInterface\\\\:\\\\:getParameters\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/MetadataInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$denormalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$normalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\:\\\\:getDenormalizationContext\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\:\\\\:getFormOptions\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\:\\\\:getNormalizationContext\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\:\\\\:getRepositoryArguments\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\:\\\\:getValidationContext\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\:\\\\:withDenormalizationContext\\\\(\\\\) has parameter \\\\$denormalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\:\\\\:withFormOptions\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\:\\\\:withNormalizationContext\\\\(\\\\) has parameter \\\\$normalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\:\\\\:withRepositoryArguments\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\:\\\\:withValidationContext\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\\\\\HttpOperationInitiator\\\\:\\\\:resolveVars\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation/HttpOperationInitiator.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operation\\\\\\\\HttpOperationInitiator\\\\:\\\\:resolveVars\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operation/HttpOperationInitiator.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\OperationAccessCheckerInterface\\\\:\\\\:isGranted\\\\(\\\\) has parameter \\\\$extraVariables with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/OperationAccessCheckerInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Class Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operations implements generic interface IteratorAggregate but does not specify its types\\\\: TKey, TValue$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operations.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Operations\\\\:\\\\:\\\\$operations type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Operations.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Registry\\\\:\\\\:addFromAliasAndConfiguration\\\\(\\\\) has parameter \\\\$configuration with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Registry.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\RegistryInterface\\\\:\\\\:addFromAliasAndConfiguration\\\\(\\\\) has parameter \\\\$configuration with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/RegistryInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\AttributesResourceMetadataCollectionFactory\\\\:\\\\:buildFormOptions\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Resource/Factory/AttributesResourceMetadataCollectionFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\AttributesResourceMetadataCollectionFactory\\\\:\\\\:buildResourceOperations\\\\(\\\\) has parameter \\\\$attributes with generic class ReflectionAttribute but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Resource/Factory/AttributesResourceMetadataCollectionFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\AttributesResourceMetadataCollectionFactory\\\\:\\\\:getOperationWithDefaults\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Resource/Factory/AttributesResourceMetadataCollectionFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\CachedResourceMetadataCollectionFactory\\\\:\\\\:\\\\$localCache type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Resource/Factory/CachedResourceMetadataCollectionFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\PhpFileResourceMetadataCollectionFactory\\\\:\\\\:buildFormOptions\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Resource/Factory/PhpFileResourceMetadataCollectionFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\PhpFileResourceMetadataCollectionFactory\\\\:\\\\:getOperationWithDefaults\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Resource/Factory/PhpFileResourceMetadataCollectionFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Resource\\\\\\\\Factory\\\\\\\\TemplatesDirResourceMetadataCollectionFactory\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$settings with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Resource/Factory/TemplatesDirResourceMetadataCollectionFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Class Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Resource\\\\\\\\ResourceClassList implements generic interface IteratorAggregate but does not specify its types\\\\: TKey, TValue$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Resource/ResourceClassList.php\n\n\t\t-\n\t\t\tmessage: \"#^Class Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Resource\\\\\\\\ResourceMetadataCollection extends generic class ArrayObject but does not specify its types\\\\: TKey, TValue$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Resource/ResourceMetadataCollection.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ResourceMetadata\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$denormalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ResourceMetadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ResourceMetadata\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$normalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ResourceMetadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ResourceMetadata\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$operations with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ResourceMetadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ResourceMetadata\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ResourceMetadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ResourceMetadata\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ResourceMetadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ResourceMetadata\\\\:\\\\:getDenormalizationContext\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ResourceMetadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ResourceMetadata\\\\:\\\\:getNormalizationContext\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ResourceMetadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ResourceMetadata\\\\:\\\\:getValidationContext\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ResourceMetadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ResourceMetadata\\\\:\\\\:getVars\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ResourceMetadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ResourceMetadata\\\\:\\\\:withDenormalizationContext\\\\(\\\\) has parameter \\\\$denormalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ResourceMetadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ResourceMetadata\\\\:\\\\:withNormalizationContext\\\\(\\\\) has parameter \\\\$normalizationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ResourceMetadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ResourceMetadata\\\\:\\\\:withValidationContext\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ResourceMetadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\ResourceMetadata\\\\:\\\\:withVars\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/ResourceMetadata.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Show\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Show.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Show\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$methods with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Show.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Show\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Show.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Show\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$routeRequirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Show.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Show\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Show.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Show\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Show.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Update\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$formOptions with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Update.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Update\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$methods with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Update.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Update\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$redirectArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Update.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Update\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$repositoryArguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Update.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Update\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$routeRequirements with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Update.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Update\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$validationContext with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Update.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Metadata\\\\\\\\Update\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Metadata/Update.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Model\\\\\\\\ResourceInterface\\\\:\\\\:getId\\\\(\\\\) has no return type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Model/ResourceInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Class Sylius\\\\\\\\Resource\\\\\\\\Model\\\\\\\\ResourceLogEntry extends generic class Gedmo\\\\\\\\Loggable\\\\\\\\Entity\\\\\\\\MappedSuperclass\\\\\\\\AbstractLogEntry but does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Model/ResourceLogEntry.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Model\\\\\\\\TimestampableInterface\\\\:\\\\:setCreatedAt\\\\(\\\\) has no return type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Model/TimestampableInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Model\\\\\\\\TimestampableInterface\\\\:\\\\:setUpdatedAt\\\\(\\\\) has no return type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Model/TimestampableInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Reflection\\\\\\\\ClassReflection\\\\:\\\\:getClassAttributes\\\\(\\\\) return type with generic class ReflectionAttribute does not specify its types\\\\: T$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Reflection/ClassReflection.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Reflection\\\\\\\\ClassReflection\\\\:\\\\:getResourcesByPath\\\\(\\\\) return type has no value type specified in iterable type iterable\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Reflection/ClassReflection.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Reflection\\\\\\\\ClassReflection\\\\:\\\\:getResourcesByPaths\\\\(\\\\) has parameter \\\\$paths with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Reflection/ClassReflection.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Reflection\\\\\\\\Filter\\\\\\\\FunctionArgumentsFilter\\\\:\\\\:filter\\\\(\\\\) has parameter \\\\$arguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Reflection/Filter/FunctionArgumentsFilter.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Reflection\\\\\\\\Filter\\\\\\\\FunctionArgumentsFilter\\\\:\\\\:filter\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Reflection/Filter/FunctionArgumentsFilter.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Reflection\\\\\\\\Filter\\\\\\\\FunctionArgumentsFilter\\\\:\\\\:getFunctionArguments\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Reflection/Filter/FunctionArgumentsFilter.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\State\\\\\\\\Factory\\\\:\\\\:parseArgumentValues\\\\(\\\\) has parameter \\\\$arguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/State/Factory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\State\\\\\\\\Factory\\\\:\\\\:parseArgumentValues\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/State/Factory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\State\\\\\\\\Provider\\\\:\\\\:provide\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/State/Provider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\State\\\\\\\\Provider\\\\\\\\FactoryProvider\\\\:\\\\:provide\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/State/Provider/FactoryProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\State\\\\\\\\Provider\\\\\\\\ReadProvider\\\\:\\\\:provide\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/State/Provider/ReadProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\State\\\\\\\\Provider\\\\\\\\SecurityProvider\\\\:\\\\:provide\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/State/Provider/SecurityProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\State\\\\\\\\ProviderInterface\\\\:\\\\:provide\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/State/ProviderInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Storage\\\\\\\\StorageInterface\\\\:\\\\:all\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Storage/StorageInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Controller\\\\\\\\MainController\\\\:\\\\:__invoke\\\\(\\\\) should return Symfony\\\\\\\\Component\\\\\\\\HttpFoundation\\\\\\\\Response but returns mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Controller/MainController.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\EventDispatcher\\\\\\\\GenericEvent\\\\:\\\\:getMessageParameters\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/EventDispatcher/GenericEvent.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\EventDispatcher\\\\\\\\GenericEvent\\\\:\\\\:setMessageParameters\\\\(\\\\) has parameter \\\\$messageParameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/EventDispatcher/GenericEvent.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\EventDispatcher\\\\\\\\GenericEvent\\\\:\\\\:stop\\\\(\\\\) has no return type specified\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/EventDispatcher/GenericEvent.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\EventDispatcher\\\\\\\\GenericEvent\\\\:\\\\:stop\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/EventDispatcher/GenericEvent.php\n\n\t\t-\n\t\t\tmessage: \"#^Property Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\EventDispatcher\\\\\\\\GenericEvent\\\\:\\\\:\\\\$messageParameters type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/EventDispatcher/GenericEvent.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\EventDispatcher\\\\\\\\State\\\\\\\\DispatchPostReadEventProvider\\\\:\\\\:provide\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/EventDispatcher/State/DispatchPostReadEventProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\EventListener\\\\\\\\AddFormatListener\\\\:\\\\:getNotAcceptableHttpException\\\\(\\\\) has parameter \\\\$mimeTypes with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/EventListener/AddFormatListener.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\ExpressionLanguage\\\\\\\\ArgumentParser\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$providers with no value type specified in iterable type iterable\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/ExpressionLanguage/ArgumentParser.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\ExpressionLanguage\\\\\\\\ArgumentParser\\\\:\\\\:parseExpression\\\\(\\\\) has parameter \\\\$variables with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/ExpressionLanguage/ArgumentParser.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\ExpressionLanguage\\\\\\\\ArgumentParserInterface\\\\:\\\\:parseExpression\\\\(\\\\) has parameter \\\\$variables with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/ExpressionLanguage/ArgumentParserInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\ExpressionLanguage\\\\\\\\RequestVariables\\\\:\\\\:getVariables\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/ExpressionLanguage/RequestVariables.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\ExpressionLanguage\\\\\\\\SyliusRepositoriesVariables\\\\:\\\\:getVariables\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/ExpressionLanguage/SyliusRepositoriesVariables.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\ExpressionLanguage\\\\\\\\TokenVariables\\\\:\\\\:getVariables\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/ExpressionLanguage/TokenVariables.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\ExpressionLanguage\\\\\\\\VariablesCollection\\\\:\\\\:getVariables\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/ExpressionLanguage/VariablesCollection.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\ExpressionLanguage\\\\\\\\VariablesCollectionInterface\\\\:\\\\:getVariables\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/ExpressionLanguage/VariablesCollectionInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\ExpressionLanguage\\\\\\\\VariablesInterface\\\\:\\\\:getVariables\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/ExpressionLanguage/VariablesInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\ExpressionLanguage\\\\\\\\VarsResolver\\\\:\\\\:resolve\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/ExpressionLanguage/VarsResolver.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\ExpressionLanguage\\\\\\\\VarsResolver\\\\:\\\\:resolve\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/ExpressionLanguage/VarsResolver.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\ExpressionLanguage\\\\\\\\VarsResolverInterface\\\\:\\\\:resolve\\\\(\\\\) has parameter \\\\$vars with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/ExpressionLanguage/VarsResolverInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\ExpressionLanguage\\\\\\\\VarsResolverInterface\\\\:\\\\:resolve\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/ExpressionLanguage/VarsResolverInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Form\\\\\\\\State\\\\\\\\FormProvider\\\\:\\\\:provide\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Form/State/FormProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Request\\\\\\\\RepositoryArgumentResolver\\\\:\\\\:filterPrivateArguments\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Request/RepositoryArgumentResolver.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Request\\\\\\\\RepositoryArgumentResolver\\\\:\\\\:getArguments\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Request/RepositoryArgumentResolver.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Request\\\\\\\\State\\\\\\\\Provider\\\\:\\\\:parseArgumentValues\\\\(\\\\) has parameter \\\\$arguments with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Request/State/Provider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Request\\\\\\\\State\\\\\\\\Provider\\\\:\\\\:parseArgumentValues\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Request/State/Provider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Request\\\\\\\\State\\\\\\\\Provider\\\\:\\\\:provide\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Request/State/Provider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Response\\\\\\\\ApiHeadersInitiator\\\\:\\\\:initializeHeaders\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Response/ApiHeadersInitiator.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Response\\\\\\\\HeadersInitiatorInterface\\\\:\\\\:initializeHeaders\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Response/HeadersInitiatorInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Routing\\\\\\\\Factory\\\\\\\\OperationRouteFactory\\\\:\\\\:getSyliusOptions\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Routing/Factory/OperationRouteFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Routing\\\\\\\\RedirectHandler\\\\:\\\\:getRouteArguments\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Routing/RedirectHandler.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Routing\\\\\\\\RedirectHandler\\\\:\\\\:parseResourceValues\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Routing/RedirectHandler.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Routing\\\\\\\\RedirectHandler\\\\:\\\\:parseResourceValues\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Routing/RedirectHandler.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Routing\\\\\\\\RedirectHandler\\\\:\\\\:redirectToRoute\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Routing/RedirectHandler.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Routing\\\\\\\\RedirectHandlerInterface\\\\:\\\\:redirectToRoute\\\\(\\\\) has parameter \\\\$parameters with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Routing/RedirectHandlerInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Security\\\\\\\\OperationAccessChecker\\\\:\\\\:getVariables\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Security/OperationAccessChecker.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Security\\\\\\\\OperationAccessChecker\\\\:\\\\:isGranted\\\\(\\\\) has parameter \\\\$extraVariables with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Security/OperationAccessChecker.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Serializer\\\\\\\\State\\\\\\\\DeserializeProvider\\\\:\\\\:provide\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Serializer/State/DeserializeProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Serializer\\\\\\\\State\\\\\\\\DeserializeProvider\\\\:\\\\:provide\\\\(\\\\) should return array\\\\|object\\\\|null but returns mixed\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Serializer/State/DeserializeProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Session\\\\\\\\Flash\\\\\\\\FlashHelper\\\\:\\\\:getTranslationParameters\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Session/Flash/FlashHelper.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Symfony\\\\\\\\Validator\\\\\\\\State\\\\\\\\ValidateProvider\\\\:\\\\:provide\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Validator/State/ValidateProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^PHPDoc tag @var for variable \\\\$data has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Symfony/Validator/State/ValidateProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Translation\\\\\\\\Provider\\\\\\\\ImmutableTranslationLocaleProvider\\\\:\\\\:__construct\\\\(\\\\) has parameter \\\\$definedLocalesCodes with no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Translation/Provider/ImmutableTranslationLocaleProvider.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Twig\\\\\\\\Context\\\\\\\\Factory\\\\\\\\ContextFactory\\\\:\\\\:create\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Twig/Context/Factory/ContextFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Twig\\\\\\\\Context\\\\\\\\Factory\\\\\\\\ContextFactoryInterface\\\\:\\\\:create\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Twig/Context/Factory/ContextFactoryInterface.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Twig\\\\\\\\Context\\\\\\\\Factory\\\\\\\\DefaultContextFactory\\\\:\\\\:create\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Twig/Context/Factory/DefaultContextFactory.php\n\n\t\t-\n\t\t\tmessage: \"#^Method Sylius\\\\\\\\Resource\\\\\\\\Twig\\\\\\\\Context\\\\\\\\Factory\\\\\\\\RequestContextFactory\\\\:\\\\:create\\\\(\\\\) return type has no value type specified in iterable type array\\\\.$#\"\n\t\t\tcount: 1\n\t\t\tpath: src/Component/src/Twig/Context/Factory/RequestContextFactory.php\n"
  },
  {
    "path": "phpstan.neon",
    "content": "includes:\n    - phpstan-baseline.neon\n    - vendor/phpstan/phpstan-webmozart-assert/extension.neon\n    - vendor/phpstan/phpstan-phpunit/extension.neon\n\n    - vendor/phpstan/phpstan-phpunit/rules.neon\n\nparameters:\n    level: max\n\n    reportUnmatchedIgnoredErrors: false\n\n    paths:\n        - 'src/'\n\n    excludePaths:\n        # External vendor dependencies installed via composer in Component\n        # These are third-party packages that shouldn't be analyzed\n        - 'src/Component/vendor/'\n\n        # PHPSpec tests use a different syntax and structure than regular PHP code\n        # They contain specs with methods like it_*() and shouldReturn() that PHPStan doesn't understand\n        - 'src/Bundle/spec/'\n        - 'src/Component/spec/'\n\n        # PHPUnit tests - test code is not production code and has different quality requirements\n        # Tests often use mocks, stubs and test-specific patterns\n        - 'src/Bundle/Tests/'\n        - 'src/Component/tests/'\n\n        # MongoDB ODM integration - requires doctrine/mongodb-odm which is optional\n        # These files contain references to MongoDB classes that don't exist without the package\n        - 'src/Bundle/Doctrine/ODM/'\n        - 'src/Bundle/EventListener/ODM*'\n        - 'src/Bundle/DependencyInjection/Driver/Doctrine/DoctrineODMDriver.php'\n\n        # Legacy code maintained for backward compatibility\n        # Contains deprecated interfaces and implementations that will be removed in 2.0\n        - 'src/Component/legacy/'\n\n        # Parameters.php extends Symfony's ParameterBag but changes return type covariance\n        # This is a known limitation that cannot be fixed without breaking BC\n        # PHPStan reports: \"Return type mixed of method Parameters::get() is not covariant with\n        # return type mixed of method ParameterBag::get()\"\n        - 'src/Bundle/Controller/Parameters.php'\n\n        # ResourceMetadata will need to use the generic T\n        - 'src/Component/src/Metadata/ResourceMetadata.php'\n\n    ignoreErrors:\n        # Optional MongoDB ODM support - requires doctrine/mongodb-odm-bundle package\n        # These classes are only loaded when MongoDB driver is configured and the bundle is installed\n        # See: src/Bundle/AbstractResourceBundle.php:112\n        - '/Class Doctrine\\\\Bundle\\\\MongoDBBundle\\\\DependencyInjection\\\\Compiler\\\\DoctrineMongoDBMappingsPass not found/'\n        - '/Class Doctrine\\\\ODM\\\\MongoDB\\\\DocumentManager not found/'\n        - '/has invalid type Doctrine\\\\MongoDB\\\\Query\\\\Builder/'\n\n        # Optional PHPCR ODM support - requires doctrine/phpcr-bundle package\n        # PHPCR is deprecated since 1.3 and will be removed in 2.0\n        # See: src/Bundle/AbstractResourceBundle.php:120-127\n        - '/Class Doctrine\\\\Bundle\\\\PHPCRBundle\\\\DependencyInjection\\\\Compiler\\\\DoctrinePhpcrMappingsPass not found/'\n        - '/Class Doctrine\\\\ODM\\\\PHPCR\\\\Document\\\\Resource not found/'\n        - '/has invalid type Doctrine\\\\ODM\\\\PHPCR\\\\Query\\\\Builder\\\\QueryBuilder/'\n        - '/has invalid type Doctrine\\\\ODM\\\\PHPCR\\\\DocumentManagerInterface/'\n\n        # Optional HateoasBundle support - requires willdurand/hateoas-bundle\n        - '/Call to method createRepresentation\\(\\) on an unknown class Hateoas\\\\Representation\\\\Factory\\\\PagerfantaFactory/'\n        - '/Class Hateoas\\\\Representation\\\\Factory\\\\PagerfantaFactory not found/'\n        - '/Instantiated class Hateoas\\\\Configuration\\\\Route not found/'\n        - '/Parameter \\$pagerfantaRepresentationFactory of method Sylius\\\\Bundle\\\\ResourceBundle\\\\Controller\\\\ResourcesCollectionProvider::__construct\\(\\) has invalid type Hateoas\\\\Representation\\\\Factory\\\\PagerfantaFactory/'\n        - '/Property Sylius\\\\Bundle\\\\ResourceBundle\\\\Controller\\\\ResourcesCollectionProvider::\\$pagerfantaRepresentationFactory has unknown class Hateoas\\\\Representation\\\\Factory\\\\PagerfantaFactory as its type/'\n\n        # Optional FOS RestBundle support - requires friendsofsymfony/rest-bundle\n        - '/Call to method getContext\\(\\) on an unknown class FOS\\\\RestBundle\\\\View\\\\View/'\n        - '/Call to method handle\\(\\) on an unknown class FOS\\\\RestBundle\\\\View\\\\ConfigurableViewHandlerInterface/'\n        - '/Call to method setExclusionStrategyGroups\\(\\) on an unknown class FOS\\\\RestBundle\\\\View\\\\ConfigurableViewHandlerInterface/'\n        - '/Call to method setExclusionStrategyVersion\\(\\) on an unknown class FOS\\\\RestBundle\\\\View\\\\ConfigurableViewHandlerInterface/'\n        - '/Parameter \\$restViewHandler of method Sylius\\\\Bundle\\\\ResourceBundle\\\\Controller\\\\ViewHandler::__construct\\(\\) has invalid type FOS\\\\RestBundle\\\\View\\\\ConfigurableViewHandlerInterface/'\n        - '/Parameter \\$view of method Sylius\\\\Bundle\\\\ResourceBundle\\\\Controller\\\\ViewHandler::handle\\(\\) has invalid type FOS\\\\RestBundle\\\\View\\\\View/'\n        - '/Parameter \\$view of method Sylius\\\\Bundle\\\\ResourceBundle\\\\Controller\\\\ViewHandlerInterface::handle\\(\\) has invalid type FOS\\\\RestBundle\\\\View\\\\View/'\n        - '/Property Sylius\\\\Bundle\\\\ResourceBundle\\\\Controller\\\\ViewHandler::\\$restViewHandler has unknown class FOS\\\\RestBundle\\\\View\\\\ConfigurableViewHandlerInterface as its type/'\n\n        # Optional Winzou StateMachine support - requires winzou/state-machine package\n        - '/Access to an undefined property Sylius\\\\Resource\\\\StateMachine\\\\StateMachine::\\$config/'\n        - '/Call to an undefined method Sylius\\\\Resource\\\\StateMachine\\\\StateMachine::getPossibleTransitions\\(\\)/'\n        - '/Call to method get\\(\\) on an unknown class SM\\\\Factory\\\\Factory/'\n        - '/Class SM\\\\Callback\\\\CallbackFactoryInterface not found/'\n        - '/Class SM\\\\Callback\\\\CascadeTransitionCallback not found/'\n        - '/Class SM\\\\Factory\\\\FactoryInterface not found/'\n        - '/Class winzou\\\\Bundle\\\\StateMachineBundle\\\\winzouStateMachineBundle not found/'\n        - '/Method Sylius\\\\Resource\\\\Winzou\\\\StateMachine\\\\OperationStateMachine::getFactory\\(\\) has invalid return type SM\\\\Factory\\\\Factory/'\n        - '/Parameter \\$factory of method Sylius\\\\Resource\\\\Winzou\\\\StateMachine\\\\OperationStateMachine::__construct\\(\\) has invalid type SM\\\\Factory\\\\Factory/'\n        - '/Parameter \\$stateMachineFactory of method Sylius\\\\Bundle\\\\ResourceBundle\\\\Controller\\\\StateMachine::__construct\\(\\) has invalid type SM\\\\Factory\\\\FactoryInterface/'\n        - '/Property Sylius\\\\Bundle\\\\ResourceBundle\\\\Controller\\\\StateMachine::\\$stateMachineFactory has unknown class SM\\\\Factory\\\\FactoryInterface as its type/'\n        - '/Property Sylius\\\\Resource\\\\Winzou\\\\StateMachine\\\\OperationStateMachine::\\$factory has unknown class SM\\\\Factory\\\\Factory as its type/'\n\n        # Optional Symfony Workflow support - requires symfony/workflow\n        - '/Call to method get\\(\\) on an unknown class \\Symfony\\\\Component\\\\Workflow\\\\Registry/'\n        - '/Method Sylius\\\\Resource\\\\Symfony\\\\Workflow\\\\OperationStateMachine::getRegistry\\(\\) has invalid return type Symfony\\\\Component\\\\Workflow\\\\Registry/'\n        - '/Parameter \\$registry of method Sylius\\\\Bundle\\\\ResourceBundle\\\\Controller\\\\Workflow::__construct\\(\\) has invalid type Symfony\\\\Component\\\\Workflow\\\\Registry/'\n        - '/Parameter \\$registry of method Sylius\\\\Resource\\\\Symfony\\\\Workflow\\\\OperationStateMachine::__construct\\(\\) has invalid type Symfony\\\\Component\\\\Workflow\\\\Registry/'\n        - '/Property Sylius\\\\Bundle\\\\ResourceBundle\\\\Controller\\\\Workflow::\\$registry has unknown class Symfony\\\\Component\\\\Workflow\\\\Registry as its type/'\n        - '/Property Sylius\\\\Resource\\\\Symfony\\\\Workflow\\\\OperationStateMachine::\\$registry has unknown class Symfony\\\\Component\\\\Workflow\\\\Registry as its type/'\n\n        # Backward compatibility with Doctrine Common 2.x\n        # Namespace moved from Doctrine\\Common\\Persistence to Doctrine\\Persistence in 3.x\n        # Code uses both namespaces with aliases to support both versions\n        # See: src/Bundle/DependencyInjection/Driver/Doctrine/AbstractDoctrineDriver.php:46\n        - '/Class Doctrine\\\\Common\\\\Persistence\\\\ObjectManager not found/'\n\n        # Doctrine ORM 3.x introduces new mapping classes\n        # AssociationMapping class exists only in ORM 3.x, not in ORM 2.x\n        # Code supports both versions, so we need to ignore these errors when running with ORM 2.x\n        # See: src/Bundle/EventListener/ORMMappedSuperClassSubscriber.php\n        - '/Class Doctrine\\\\ORM\\\\Mapping\\\\AssociationMapping not found/'\n        - '/Call to method .* on an unknown class Doctrine\\\\ORM\\\\Mapping\\\\AssociationMapping/'\n        - '/PHPDoc tag @var for variable .* contains unknown class Doctrine\\\\ORM\\\\Mapping\\\\AssociationMapping/'\n\n        # Optional symfony/web-link component - only used when installed\n        # Code checks class_exists() before using these classes\n        # See: src/Bundle/Controller/ControllerTrait.php:443-448\n        - '/has invalid type Psr\\\\Link\\\\LinkInterface/'\n        - '/Class Symfony\\\\Component\\\\WebLink\\\\GenericLinkProvider not found/'\n        - '/Instantiated class Symfony\\\\Component\\\\WebLink\\\\GenericLinkProvider not found/'\n\n        # Backward compatibility with deprecated Symfony ExpressionLanguage cache interfaces\n        # ParserCacheInterface was removed in Symfony 4.0, replaced by PSR-6 CacheItemPoolInterface\n        # Code provides BC layer with trigger_deprecation\n        # See: src/Bundle/ExpressionLanguage/ExpressionLanguage.php:29-40\n        - '/Class Symfony\\\\Component\\\\ExpressionLanguage\\\\ParserCache\\\\ParserCacheInterface not found/'\n        - '/Instantiated class Symfony\\\\Component\\\\ExpressionLanguage\\\\ParserCache\\\\ParserCacheAdapter not found/'\n\n        # Symfony Config Component uses fluent interface with dynamic return types\n        # getRootNode() returns NodeDefinition which gets transformed to ArrayNodeDefinition\n        # when children() is called. PHPStan cannot track these runtime type transformations\n        # See: src/Bundle/DependencyInjection/Configuration.php:30-37\n        - '/Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface::(end|variableNode|scalarNode)\\(\\)/'\n\n        # Symfony Dependency Injection Component can use ReflectionClass type as second argument instead of Reflector one.\n        -  '/Parameter #2 \\$configurator of method Symfony\\\\Component\\\\DependencyInjection\\\\ContainerBuilder::registerAttributeForAutoconfiguration\\(\\)/'\n\n        # Backward compatibility for Symfony DependencyInjection Alias::setDeprecated()\n        # Method signature changed between Symfony versions:\n        # - Symfony < 5.1: setDeprecated($status, $message)\n        # - Symfony >= 5.1: setDeprecated($package, $version, $message)\n        # Code dynamically detects parameter count and calls appropriately\n        # See: src/Bundle/DependencyInjection/Compiler/PagerfantaBridgePass.php:62-73\n        - '/Method Symfony\\\\Component\\\\DependencyInjection\\\\Alias::setDeprecated\\(\\) invoked with 2 parameters, 3 required/'\n        - '/Parameter #1 \\$package of method Symfony\\\\Component\\\\DependencyInjection\\\\Alias::setDeprecated\\(\\) expects string, true given/'\n\n        # ResourceControllerEvent uses if(false) for IDE support - provides class alias hint\n        # This is intentional dead code to help IDEs understand the class_alias in GenericEvent.php\n        # See: src/Bundle/Event/ResourceControllerEvent.php:18-22\n        -\n            message: '#If condition is always false#'\n            path: src/Bundle/Event/ResourceControllerEvent.php\n        # Symfony <7.4 - TreeBuilder and ArrayNodeDefinition are not generic in Symfony < 7.4\n        # but are generic in Symfony 7.4+. We use generics for better type safety in newer versions.\n        - message: '#^PHPDoc tag .+ is not generic\\.$#'\n          identifier: generics.notGeneric\n          count: 11\n          path: src/Bundle/DependencyInjection/Configuration.php\n        - message: '#^PHPDoc tag .+ is not generic\\.$#'\n          identifier: generics.notGeneric\n          count: 5\n          path: src/Bundle/DependencyInjection/PagerfantaConfiguration.php\n        - message: '#^PHPDoc tag .+ is not generic\\.$#'\n          identifier: generics.notGeneric\n          count: 3\n          path: src/Bundle/Routing/Configuration.php\n\n        # CachedTrait returns a mixed type\n        - message: '/Method Sylius\\\\Resource\\\\Metadata\\\\Resource\\\\Factory\\\\CachedResourceClassListFactory::create\\(\\) should return Sylius\\\\Resource\\\\Metadata\\\\Resource\\\\ResourceClassList but returns mixed/'\n          identifier: return.type\n          count: 1\n          path: src/Component/src/Metadata/Resource/Factory/CachedResourceClassListFactory.php\n"
  },
  {
    "path": "phpunit.xml.dist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<phpunit xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:noNamespaceSchemaLocation=\"https://schema.phpunit.de/9.4/phpunit.xsd\"\n         colors=\"true\"\n>\n    <php>\n        <ini name=\"error_reporting\" value=\"-1\" />\n\n        <server name=\"KERNEL_CLASS\" value=\"App\\Kernel\" />\n        <server name=\"IS_DOCTRINE_ORM_SUPPORTED\" value=\"true\" />\n        <server name=\"SHELL_VERBOSITY\" value=\"-1\" />\n    </php>\n\n    <testsuites>\n        <testsuite name=\"SyliusResourceBundle Test Suite\">\n            <directory>./tests/</directory>\n            <directory>./src/Component/legacy/tests/</directory>\n            <directory>./src/Component/tests/</directory>\n        </testsuite>\n    </testsuites>\n\n    <extensions>\n        <bootstrap class=\"Zenstruck\\Foundry\\PHPUnit\\FoundryExtension\"/>\n    </extensions>\n</phpunit>\n"
  },
  {
    "path": "psalm.xml",
    "content": "<?xml version=\"1.0\"?>\n<psalm\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n    xmlns=\"https://getpsalm.org/schema/config\"\n    xsi:schemaLocation=\"https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd\"\n>\n    <projectFiles>\n        <directory name=\"src\" />\n        <ignoreFiles>\n            <directory name=\"vendor\" />\n            <directory name=\"src/Bundle/Doctrine/ODM\" />\n            <directory name=\"src/Bundle/spec\" />\n            <directory name=\"src/Component/legacy/spec\" />\n            <directory name=\"src/Component/legacy/tests\" />\n            <directory name=\"src/Component/spec\" />\n            <directory name=\"src/Component/tests\" />\n            <directory name=\"src/Component/vendor\" />\n            <file name=\"src/Component/legacy/src/Model/ArchivableTrait.php\" />\n            <file name=\"src/Component/legacy/src/Model/TimestampableTrait.php\" />\n            <file name=\"src/Component/legacy/src/Model/ToggleableTrait.php\" />\n            <file name=\"src/Component/legacy/src/Model/TranslatableTrait.php\" />\n            <file name=\"src/Component/legacy/src/ResourceActions.php\" />\n            <file name=\"src/Component/legacy/src/StateMachine/StateMachine.php\" />\n            <file name=\"src/Component/legacy/src/StateMachine/StateMachineInterface.php\" />\n            <file name=\"src/Bundle/Controller/ControllerTrait.php\" />\n            <file name=\"src/Bundle/DependencyInjection/Driver/Doctrine/DoctrineODMDriver.php\" />\n            <file name=\"src/Bundle/DependencyInjection/Driver/Doctrine/DoctrinePHPCRDriver.php\" />\n            <file name=\"src/Bundle/EventListener/ODM*.php\" />\n            <file name=\"src/Bundle/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php\" />\n            <file name=\"src/Bundle/Routing/RoutesAttributesLoader.php\" />\n            <file name=\"src/Bundle/Routing/CrudRoutesAttributesLoader.php\" />\n        </ignoreFiles>\n    </projectFiles>\n\n    <issueHandlers>\n        <ArgumentTypeCoercion>\n            <errorLevel type=\"suppress\">\n                <referencedFunction name=\"Doctrine\\Persistence\\ManagerRegistry::getManagerForClass\" />\n                <referencedFunction name=\"Doctrine\\Persistence\\ObjectManager::getClassMetadata\" />\n                <referencedFunction name=\"ReflectionClass::getAttributes\" />\n                <file name=\"src/Bundle/Form/DataTransformer/CollectionToStringTransformer.php\" />\n                <file name=\"src/Bundle/DependencyInjection/SyliusResourceExtension.php\" />\n                <file name=\"src/Component/src/Doctrine/Persistence/InMemoryRepository.php\" />\n                <file name=\"src/Component/src/Symfony/Request/State/Provider.php\" />\n            </errorLevel>\n        </ArgumentTypeCoercion>\n\n        <DeprecatedClass>\n            <errorLevel type=\"info\">\n                <referencedClass name=\"Doctrine\\ORM\\Event\\LifecycleEventArgs\" /> <!-- deprecated in doctrine/orm 2.14 -->\n                <referencedClass name=\"Gedmo\\Sluggable\\Util\\Urlizer\" /> <!-- deprecated in gedmo/doctrine-extensions 3.21 -->\n            </errorLevel>\n            <errorLevel type=\"suppress\">\n                <referencedClass name=\"Sylius\\Component\\Resource\\Exception\\VariantWithNoOptionsValuesException\" />\n                <referencedClass name=\"Sylius\\Resource\\Exception\\VariantWithNoOptionsValuesException\" />\n                <referencedClass name=\"Sylius\\Resource\\Symfony\\Routing\\Factory\\AttributesOperationRouteFactory\" />\n            </errorLevel>\n        </DeprecatedClass>\n\n        <DeprecatedInterface>\n            <errorLevel type=\"suppress\">\n                <referencedClass name=\"Sylius\\Resource\\Symfony\\Routing\\Factory\\AttributesOperationRouteFactoryInterface\" />\n            </errorLevel>\n        </DeprecatedInterface>\n\n        <DeprecatedMethod>\n            <errorLevel type=\"suppress\">\n                <referencedMethod name=\"Symfony\\Component\\EventDispatcher\\Event::isPropagationStopped\" />\n                <referencedMethod name=\"Symfony\\Component\\EventDispatcher\\Event::stopPropagation\" />\n            </errorLevel>\n        </DeprecatedMethod>\n\n        <DeprecatedTrait>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Bundle/Controller/ResourceController.php\" />\n            </errorLevel>\n        </DeprecatedTrait>\n\n        <DuplicateClass>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Bundle/Controller/Parameters.php\" />\n            </errorLevel>\n        </DuplicateClass>\n\n        <InternalClass>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Bundle/DependencyInjection/PagerfantaExtension.php\" />\n            </errorLevel>\n        </InternalClass>\n\n        <InternalMethod>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Bundle/Controller/ParametersParser.php\" />\n                <file name=\"src/Bundle/Controller/RequestConfiguration.php\" />\n                <file name=\"src/Bundle/Controller/ResourceController.php\" />\n                <file name=\"src/Bundle/Controller/Workflow.php\" />\n                <file name=\"src/Bundle/Grid/Parser/OptionsParser.php\" />\n                <file name=\"src/Component/src/Symfony/Workflow/OperationStateMachine.php\" />\n            </errorLevel>\n        </InternalMethod>\n\n        <InvalidArgument>\n            <errorLevel type=\"suppress\">\n                <referencedFunction name=\"Symfony\\Component\\DependencyInjection\\Alias::setDeprecated\" />\n                <file name=\"src/Bundle/Grid/Parser/OptionsParser.php\" />\n                <file name=\"src/Component/src/Reflection/ClassReflection.php\" />\n            </errorLevel>\n        </InvalidArgument>\n\n        <InvalidPropertyAssignmentValue>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Bundle/EventListener/ORMMappedSuperClassSubscriber.php\" />\n            </errorLevel>\n        </InvalidPropertyAssignmentValue>\n\n        <InvalidReturnStatement>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Component/src/Doctrine/Persistence/InMemoryRepository.php\" />\n                <file name=\"src/Bundle/Grid/Parser/OptionsParser.php\" />\n            </errorLevel>\n        </InvalidReturnStatement>\n\n        <InvalidReturnType>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Component/src/Doctrine/Persistence/InMemoryRepository.php\" />\n                <file name=\"src/Component/src/Metadata/Extractor/PhpFileResourceExtractor.php\" />\n            </errorLevel>\n        </InvalidReturnType>\n\n        <LessSpecificImplementedReturnType>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Component/src/Doctrine/Persistence/InMemoryRepository.php\" />\n            </errorLevel>\n        </LessSpecificImplementedReturnType>\n\n        <LessSpecificReturnStatement>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Component/src/Doctrine/Persistence/InMemoryRepository.php\" />\n            </errorLevel>\n        </LessSpecificReturnStatement>\n\n        <MethodSignatureMismatch>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Bundle/Doctrine/ResourceMappingDriverChain.php\" />\n                <file name=\"src/Bundle/Storage/CookieStorage.php\" />\n                <file name=\"src/Bundle/Controller/Parameters.php\" />\n            </errorLevel>\n        </MethodSignatureMismatch>\n\n        <MissingClassConstType>\n            <errorLevel type=\"suppress\">\n                <directory name=\"src/Bundle\" />\n                <directory name=\"src/Component\" />\n            </errorLevel>\n        </MissingClassConstType>\n\n        <MissingConstructor>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Component/src/Metadata/Mutator/ResourceMutatorCollection.php\" />\n            </errorLevel>\n        </MissingConstructor>\n\n        <MissingParamType>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Bundle/Routing/ResourceLoader.php\" />\n                <file name=\"src/Component/src/Doctrine/Persistence/InMemoryRepository.php\" />\n            </errorLevel>\n        </MissingParamType>\n\n        <MissingTemplateParam>\n            <errorLevel type=\"suppress\">\n                <directory name=\"src\" />\n            </errorLevel>\n        </MissingTemplateParam>\n\n        <MoreSpecificImplementedParamType>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Bundle/Doctrine/ResourceMappingDriverChain.php\" />\n                <file name=\"src/Bundle/Form/DataTransformer/RecursiveTransformer.php\" />\n                <file name=\"src/Bundle/Form/DataTransformer/ResourceToIdentifierTransformer.php\" />\n                <file name=\"src/Bundle/Grid/Parser/OptionsParser.php\" />\n                <file name=\"src/Bundle/Validator/UniqueWithinCollectionConstraintValidator.php\" />\n            </errorLevel>\n        </MoreSpecificImplementedParamType>\n\n        <NullableReturnStatement>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Component/src/Metadata/Extractor/PhpFileResourceExtractor.php\" />\n            </errorLevel>\n        </NullableReturnStatement>\n\n        <NullArgument>\n            <errorLevel type=\"suppress\">\n                <directory name=\"src\" />\n            </errorLevel>\n        </NullArgument>\n\n        <PossiblyFalseOperand>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Component/src/Reflection/ClassInfoTrait.php\" />\n            </errorLevel>\n        </PossiblyFalseOperand>\n\n        <PossiblyNullArgument>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Bundle/Grid/Parser/OptionsParser.php\" />\n                <file name=\"src/Component/src/Metadata/Operation/HttpOperationInitiator.php\" />\n            </errorLevel>\n        </PossiblyNullArgument>\n\n        <PossiblyNullPropertyAssignmentValue>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Bundle/Controller/ContainerAwareTrait.php\" />\n            </errorLevel>\n        </PossiblyNullPropertyAssignmentValue>\n\n        <PossiblyNullReference>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Bundle/DependencyInjection/Configuration.php\" />\n                <file name=\"src/Bundle/DependencyInjection/PagerfantaConfiguration.php\" />\n                <file name=\"src/Bundle/Routing/Configuration.php\" />\n            </errorLevel>\n        </PossiblyNullReference>\n\n        <PossiblyUndefinedArrayOffset>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Bundle/Controller/ParametersParser.php\" />\n                <file name=\"src/Bundle/DependencyInjection/Compiler/RegisterResourceRepositoryPass.php\" />\n                <file name=\"src/Bundle/DependencyInjection/Compiler/RegisterResourceStateMachinePass.php\" />\n                <file name=\"src/Bundle/Form/Type/FixedCollectionType.php\" />\n            </errorLevel>\n        </PossiblyUndefinedArrayOffset>\n\n        <PossiblyUndefinedMethod>\n            <errorLevel type=\"suppress\">\n                <referencedMethod name=\"Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::arrayNode\" />\n                <referencedMethod name=\"Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::scalarNode\" />\n                <referencedMethod name=\"Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::variableNode\" />\n                <referencedMethod name=\"Symfony\\Component\\Config\\Definition\\Builder\\NodeParentInterface::end\" />\n                <referencedMethod name=\"Symfony\\Component\\Config\\Definition\\Builder\\VariableNodeDefinition::scalarNode\" />\n                <referencedMethod name=\"Symfony\\Component\\Config\\Definition\\Builder\\VariableNodeDefinition::variableNode\" />\n            </errorLevel>\n        </PossiblyUndefinedMethod>\n\n        <PropertyNotSetInConstructor>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Bundle/Routing/ResourceLoader.php\" />\n                <file name=\"src/Bundle/Validator/Constraints/UniqueWithinCollectionConstraint.php\" />\n                <file name=\"src/Bundle/Validator/Constraints/Enabled.php\" />\n                <file name=\"src/Bundle/Validator/Constraints/Disabled.php\" />\n            </errorLevel>\n        </PropertyNotSetInConstructor>\n\n        <RedundantConditionGivenDocblockType>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Bundle/Form/DataTransformer/CollectionToStringTransformer.php\" />\n            </errorLevel>\n        </RedundantConditionGivenDocblockType>\n\n        <RiskyTruthyFalsyComparison>\n            <errorLevel type=\"suppress\">\n                <directory name=\"src\" />\n            </errorLevel>\n        </RiskyTruthyFalsyComparison>\n\n        <TooFewArguments>\n            <errorLevel type=\"suppress\">\n                <referencedFunction name=\"Symfony\\Component\\DependencyInjection\\Alias::setDeprecated\" />\n            </errorLevel>\n        </TooFewArguments>\n\n        <TooManyArguments>\n            <errorLevel type=\"suppress\">\n                <referencedFunction name=\"Symfony\\Component\\HttpFoundation\\HeaderBag::all\" />\n                <referencedFunction name=\"Symfony\\Component\\Routing\\RouteCollection::add\" />\n                <referencedFunction name=\"Symfony\\Component\\Finder\\Finder::sortByName\" />\n                <referencedFunction name=\"Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface::dispatch\" />\n            </errorLevel>\n        </TooManyArguments>\n\n        <TypeDoesNotContainType>\n            <errorLevel type=\"suppress\">\n                <directory name=\"src/Component/legacy/src/Annotation\" />\n                <directory name=\"src/Component/legacy/src/Exception\" />\n                <directory name=\"src/Component/legacy/src/Factory\" />\n                <directory name=\"src/Component/legacy/src/Generator\" />\n                <directory name=\"src/Component/legacy/src/Metadata\" />\n                <directory name=\"src/Component/legacy/src/Model\" />\n                <directory name=\"src/Component/legacy/src/Reflection\" />\n                <directory name=\"src/Component/legacy/src/Repository\" />\n                <directory name=\"src/Component/legacy/src/Storage\" />\n                <directory name=\"src/Component/legacy/src/Translation\" />\n                <file name=\"src/Bundle/Event/ResourceControllerEvent.php\" />\n                <file name=\"src/Component/src/Symfony/Request/State/TwigResponder.php\" />\n            </errorLevel>\n        </TypeDoesNotContainType>\n\n        <UndefinedClass>\n            <errorLevel type=\"suppress\">\n                <referencedClass name=\"Bazinga\\Bundle\\HateoasBundle\\BazingaHateoasBundle\" />\n                <referencedClass name=\"Doctrine\\ODM\\MongoDB\\DocumentManager\" />\n                <referencedClass name=\"Doctrine\\ODM\\PHPCR\\Document\\Resource\" />\n                <referencedClass name=\"Doctrine\\Bundle\\MongoDBBundle\\DependencyInjection\\Compiler\\DoctrineMongoDBMappingsPass\" />\n                <referencedClass name=\"Doctrine\\Bundle\\PHPCRBundle\\DependencyInjection\\Compiler\\DoctrinePhpcrMappingsPass\" />\n                <referencedClass name=\"Doctrine\\Common\\Persistence\\ObjectManager\" />\n                <referencedClass name=\"Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata\" />\n                <referencedClass name=\"Hateoas\\Configuration\\Route\" />\n                <referencedClass name=\"Hateoas\\Representation\\Factory\\PagerfantaFactory\" />\n                <referencedClass name=\"Symfony\\Component\\ExpressionLanguage\\ParserCache\\ParserCacheAdapter\" />\n                <referencedClass name=\"Symfony\\Component\\ExpressionLanguage\\ParserCache\\ParserCacheInterface\" />\n            </errorLevel>\n        </UndefinedClass>\n\n        <UndefinedDocblockClass>\n            <errorLevel type=\"suppress\">\n                <referencedClass name=\"UnitEnum\" />\n                <referencedClass name=\"Doctrine\\ORM\\Mapping\\AssociationMapping\" />\n            </errorLevel>\n        </UndefinedDocblockClass>\n\n        <UndefinedInterfaceMethod>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Bundle/DependencyInjection/Configuration.php\" />\n                <file name=\"src/Bundle/DependencyInjection/PagerfantaConfiguration.php\" />\n                <file name=\"src/Bundle/Routing/Configuration.php\" />\n            </errorLevel>\n        </UndefinedInterfaceMethod>\n\n        <UnrecognizedStatement>\n            <errorLevel type=\"suppress\">\n                <directory name=\"src/Component/legacy/src/Factory\" />\n                <directory name=\"src/Component/legacy/src/Generator\" />\n                <directory name=\"src/Component/legacy/src/Metadata\" />\n                <directory name=\"src/Component/legacy/src/Model\" />\n                <directory name=\"src/Component/legacy/src/Repository\" />\n                <directory name=\"src/Component/legacy/src/Storage\" />\n                <directory name=\"src/Component/legacy/src/Translation\" />\n            </errorLevel>\n        </UnrecognizedStatement>\n\n        <UnresolvableInclude>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Component/src/Metadata/Extractor/PhpFileResourceExtractor.php\" />\n            </errorLevel>\n        </UnresolvableInclude>\n\n        <UnsupportedReferenceUsage>\n            <errorLevel type=\"suppress\">\n                <file name=\"src/Component/src/Doctrine/Persistence/InMemoryRepository.php\" />\n            </errorLevel>\n        </UnsupportedReferenceUsage>\n    </issueHandlers>\n</psalm>\n"
  },
  {
    "path": "rector.php",
    "content": "<?php\n\ndeclare(strict_types=1);\n\nuse Rector\\Core\\Configuration\\Option;\nuse Rector\\Php74\\Rector\\Property\\TypedPropertyRector;\nuse Rector\\Set\\ValueObject\\SetList;\nuse Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ContainerConfigurator;\n\nreturn static function (ContainerConfigurator $containerConfigurator): void\n{\n    $parameters = $containerConfigurator->parameters();\n    $parameters->set(Option::AUTO_IMPORT_NAMES, true);\n    $parameters->set(Option::IMPORT_SHORT_CLASSES, false);\n\n    $services = $containerConfigurator->services();\n    $services->set(TypedPropertyRector::class);\n};\n"
  },
  {
    "path": "src/Bundle/.gitignore",
    "content": "/test/app/cache\n/test/app/db.sql\n/test/app/logs\n/test/config/db.sql\n/test/var\n/test/vendor/\n"
  },
  {
    "path": "src/Bundle/AbstractResourceBundle.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle;\n\nuse Doctrine\\Bundle\\DoctrineBundle\\DependencyInjection\\Compiler\\DoctrineOrmMappingsPass;\nuse Doctrine\\Bundle\\MongoDBBundle\\DependencyInjection\\Compiler\\DoctrineMongoDBMappingsPass;\nuse Doctrine\\Bundle\\PHPCRBundle\\DependencyInjection\\Compiler\\DoctrinePhpcrMappingsPass;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Exception\\UnknownDriverException;\nuse Symfony\\Component\\Config\\Definition\\Exception\\InvalidConfigurationException;\nuse Symfony\\Component\\DependencyInjection\\Container;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\HttpKernel\\Bundle\\Bundle;\n\nabstract class AbstractResourceBundle extends Bundle implements ResourceBundleInterface\n{\n    /**\n     * Configure format of mapping files.\n     */\n    protected string $mappingFormat = ResourceBundleInterface::MAPPING_XML;\n\n    public function build(ContainerBuilder $container): void\n    {\n        if (null !== $this->getModelNamespace()) {\n            foreach ($this->getSupportedDrivers() as $driver) {\n                [$compilerPassClassName, $compilerPassMethod] = $this->getMappingCompilerPassInfo($driver);\n\n                if (class_exists($compilerPassClassName)) {\n                    if (!method_exists($compilerPassClassName, $compilerPassMethod)) {\n                        throw new InvalidConfigurationException(\n                            \"The 'mappingFormat' value is invalid, must be 'xml', 'yaml' or 'annotation'.\",\n                        );\n                    }\n\n                    switch ($this->mappingFormat) {\n                        case ResourceBundleInterface::MAPPING_XML:\n                        case ResourceBundleInterface::MAPPING_YAML:\n                            $container->addCompilerPass($compilerPassClassName::$compilerPassMethod(\n                                [$this->getConfigFilesPath() => $this->getModelNamespace()],\n                                [$this->getObjectManagerParameter()],\n                                sprintf('%s.driver.%s', $this->getBundlePrefix(), $driver),\n                            ));\n\n                            break;\n                        case ResourceBundleInterface::MAPPING_ANNOTATION:\n                            $container->addCompilerPass($compilerPassClassName::$compilerPassMethod(\n                                [$this->getModelNamespace()],\n                                [$this->getConfigFilesPath()],\n                                [sprintf('%s.object_manager', $this->getBundlePrefix())],\n                                sprintf('%s.driver.%s', $this->getBundlePrefix(), $driver),\n                            ));\n\n                            break;\n                    }\n                }\n            }\n        }\n    }\n\n    /**\n     * Return the prefix of the bundle.\n     */\n    protected function getBundlePrefix(): string\n    {\n        return Container::underscore(substr((string) strrchr(static::class, '\\\\'), 1, -6));\n    }\n\n    /**\n     * Return the directory where are stored the doctrine mapping.\n     */\n    protected function getDoctrineMappingDirectory(): string\n    {\n        return 'model';\n    }\n\n    /**\n     * Return the entity namespace.\n     */\n    protected function getModelNamespace(): ?string\n    {\n        return (new \\ReflectionClass($this))->getNamespaceName() . '\\\\Model';\n    }\n\n    /**\n     * Return mapping compiler pass class depending on driver.\n     *\n     *\n     *\n     * @throws UnknownDriverException\n     */\n    protected function getMappingCompilerPassInfo(string $driverType): array\n    {\n        switch ($driverType) {\n            case SyliusResourceBundle::DRIVER_DOCTRINE_MONGODB_ODM:\n                trigger_deprecation(\n                    'sylius/resource-bundle',\n                    '1.3',\n                    'The \"%s\" driver is deprecated. Doctrine MongoDB and PHPCR will no longer be supported in 2.0.',\n                    SyliusResourceBundle::DRIVER_DOCTRINE_MONGODB_ODM,\n                );\n\n                $mappingsPassClassname = DoctrineMongoDBMappingsPass::class;\n\n                break;\n            case SyliusResourceBundle::DRIVER_DOCTRINE_ORM:\n                $mappingsPassClassname = DoctrineOrmMappingsPass::class;\n\n                break;\n            case SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM:\n                trigger_deprecation(\n                    'sylius/resource-bundle',\n                    '1.3',\n                    'The \"%s\" driver is deprecated. Doctrine MongoDB and PHPCR will no longer be supported in 2.0.',\n                    SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM,\n                );\n\n                $mappingsPassClassname = DoctrinePhpcrMappingsPass::class;\n\n                break;\n            default:\n                throw new UnknownDriverException($driverType);\n        }\n\n        $compilerPassMethod = sprintf('create%sMappingDriver', ucfirst($this->mappingFormat));\n\n        return [$mappingsPassClassname, $compilerPassMethod];\n    }\n\n    /**\n     * Return the absolute path where are stored the doctrine mapping.\n     */\n    protected function getConfigFilesPath(): string\n    {\n        return sprintf(\n            '%s/Resources/config/doctrine/%s',\n            $this->getPath(),\n            strtolower($this->getDoctrineMappingDirectory()),\n        );\n    }\n\n    protected function getObjectManagerParameter(): string\n    {\n        return sprintf('%s.object_manager', $this->getBundlePrefix());\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Command/DebugResourceCommand.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Command;\n\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Symfony\\Component\\Console\\Command\\Command;\nuse Symfony\\Component\\Console\\Helper\\Dumper;\nuse Symfony\\Component\\Console\\Input\\InputArgument;\nuse Symfony\\Component\\Console\\Input\\InputInterface;\nuse Symfony\\Component\\Console\\Input\\InputOption;\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;\nuse Symfony\\Component\\PropertyAccess\\PropertyAccess;\n\nfinal class DebugResourceCommand extends Command\n{\n    public function __construct(\n        private RegistryInterface $registry,\n        private ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory,\n    ) {\n        parent::__construct();\n    }\n\n    public function configure(): void\n    {\n        $this->setName('sylius:debug:resource');\n        $this->setDescription('Debug resource metadata.');\n        $this->setHelp(\n            <<<'EOT'\nList or show resource metadata.\n\nTo list run the command without an argument:\n\n    $ php %command.full_name%\n\nTo show the metadata for a resource, pass its alias:\n\n    $ php %command.full_name% sylius.user\nEOT\n        );\n        $this->addArgument('resource', InputArgument::OPTIONAL, 'Resource to debug');\n        $this->addArgument('operation', InputArgument::OPTIONAL, 'Operation to debug');\n        $this->addOption('legacy', null, InputOption::VALUE_NONE, 'Show legacy resource metadata.');\n    }\n\n    public function execute(InputInterface $input, OutputInterface $output): int\n    {\n        /** @var string|null $resource */\n        $resource = $input->getArgument('resource');\n\n        $io = new SymfonyStyle($input, $output);\n\n        $dumper = new Dumper($output);\n\n        if (null === $resource) {\n            $this->listResources($io);\n\n            return Command::SUCCESS;\n        }\n\n        if (str_contains($resource, '.')) {\n            $metadata = $this->registry->get($resource);\n        } else {\n            $metadata = $this->registry->getByClass($resource);\n        }\n\n        $resourceMetadataCollection = $this->getResourceMetadataCollection($metadata);\n\n        /** @var string|null $operationName */\n        $operationName = $input->getArgument('operation');\n\n        if (null !== $operationName) {\n            $operation = $resourceMetadataCollection->getOperation($metadata->getAlias(), $operationName);\n\n            $this->debugOperation($operation, $io, $dumper);\n\n            return Command::SUCCESS;\n        }\n\n        if ($input->getOption('legacy')) {\n            $this->debugLegacyResourceMetadata($metadata, $input, $io, $dumper);\n\n            return Command::SUCCESS;\n        }\n\n        $this->debugResource($metadata, $input, $io, $dumper);\n\n        return Command::SUCCESS;\n    }\n\n    private function listResources(SymfonyStyle $io): void\n    {\n        /** @var iterable<MetadataInterface> $resources */\n        $resources = $this->registry->getAll();\n        $resources = is_array($resources) ? $resources : iterator_to_array($resources);\n        ksort($resources);\n\n        $rows = [];\n\n        foreach ($resources as $resource) {\n            $rows[] = [$resource->getAlias()];\n        }\n\n        $io->table(['Alias'], $rows);\n    }\n\n    private function debugResource(MetadataInterface $metadata, InputInterface $input, SymfonyStyle $io, Dumper $dumper): void\n    {\n        $resourceMetadataCollection = $this->getResourceMetadataCollection($metadata);\n\n        $this->debugResourceMetadata($resourceMetadataCollection, $io, $dumper);\n\n        $this->debugResourceCollectionOperation($metadata, $input, $io, $dumper);\n    }\n\n    private function debugLegacyResourceMetadata(\n        MetadataInterface $metadata,\n        InputInterface $input,\n        SymfonyStyle $io,\n        Dumper $dumper,\n    ): void {\n        $io->section('Configuration');\n\n        $values = $this->configurationToArray($metadata);\n\n        $rows = [];\n\n        foreach ($values as $key => $value) {\n            $rows[] = [$key, $dumper($value)];\n        }\n\n        $io->table(['Option', 'Value'], $rows);\n    }\n\n    private function getResourceMetadataCollection(MetadataInterface $resourceConfiguration): ResourceMetadataCollection\n    {\n        return $this->resourceMetadataCollectionFactory->create($resourceConfiguration->getClass('model'));\n    }\n\n    private function debugOperation(Operation $operation, SymfonyStyle $io, Dumper $dumper): void\n    {\n        $io->section('Operation Metadata');\n\n        $values = $this->operationToArray($operation);\n\n        $rows = [];\n\n        foreach ($values as $key => $value) {\n            $rows[] = [$key, $dumper($value)];\n        }\n\n        $io->table(['Option', 'Value'], $rows);\n    }\n\n    private function debugResourceMetadata(ResourceMetadataCollection $resourceMetadataCollection, SymfonyStyle $io, Dumper $dumper): void\n    {\n        $io->section('Resource Metadata');\n\n        if (0 === $resourceMetadataCollection->count()) {\n            $io->info('This resource has no metadata.');\n\n            return;\n        }\n\n        /** @var ResourceMetadata $resourceMetadata */\n        foreach ($resourceMetadataCollection as $resourceMetadata) {\n            $rows = [];\n\n            $values = $this->resourceToArray($resourceMetadata);\n            foreach ($values as $key => $value) {\n                $rows[] = [$key, $dumper($value)];\n            }\n\n            $io->table(['Option', 'Value'], $rows);\n        }\n    }\n\n    private function debugResourceCollectionOperation(MetadataInterface $metadata, InputInterface $input, SymfonyStyle $io, Dumper $dumper): void\n    {\n        $io->section('Operations');\n\n        $resourceMetadataCollection = $this->resourceMetadataCollectionFactory->create($metadata->getClass('model'));\n\n        $rows = [];\n\n        /** @var ResourceMetadata $resourceMetadata */\n        foreach ($resourceMetadataCollection as $resourceMetadata) {\n            $rows = $this->addResourceOperationsRows($resourceMetadata, $rows, $input);\n        }\n\n        if ($rows === []) {\n            $io->info('This resource has no defined operations.');\n\n            return;\n        }\n\n        $io->table(['Name', 'Details'], $rows);\n    }\n\n    private function addResourceOperationsRows(ResourceMetadata $resourceMetadata, array $rows, InputInterface $input): array\n    {\n        /** @var string $resourceName */\n        $resourceName = $input->getArgument('resource');\n\n        /** @var Operation $operation */\n        foreach ($resourceMetadata->getOperations() ?? new Operations() as $operation) {\n            $rows[] = [\n                $operation->getName(),\n                sprintf(\n                    '<comment>bin/console %s %s %s</comment>',\n                    $this->getName() ?? '',\n                    $resourceName,\n                    $operation->getName() ?? '',\n                ),\n            ];\n        }\n\n        return $rows;\n    }\n\n    private function configurationToArray(MetadataInterface $metadata): array\n    {\n        $values = $this->objectToArray($metadata);\n\n        $values = array_merge($values, $values['parameters']);\n        unset($values['parameters']);\n\n        return $values;\n    }\n\n    private function resourceToArray(ResourceMetadata $resource): array\n    {\n        $values = $this->objectToArray($resource);\n\n        unset($values['operations']);\n\n        return $values;\n    }\n\n    private function operationToArray(Operation $operation): array\n    {\n        return $this->objectToArray($operation);\n    }\n\n    private function objectToArray(object $object): array\n    {\n        $accessor = PropertyAccess::createPropertyAccessor();\n        $reflection = new \\ReflectionClass($object);\n\n        $values = [];\n\n        foreach ($reflection->getProperties() as $property) {\n            $propertyName = $property->getName();\n\n            if ($accessor->isReadable($object, $propertyName)) {\n                $values[$property->getName()] = $accessor->getValue($object, $propertyName);\n            }\n        }\n\n        return $values;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Context/Initiator/LegacyRequestContextInitiator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Context\\Initiator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Context\\Option\\RequestConfigurationOption;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfigurationFactoryInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Initiator\\RequestContextInitiatorInterface;\nuse Sylius\\Resource\\Context\\Option\\MetadataOption;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\VarsResolverInterface;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class LegacyRequestContextInitiator implements RequestContextInitiatorInterface\n{\n    public function __construct(\n        private RegistryInterface $resourceRegistry,\n        private RequestConfigurationFactoryInterface $requestConfigurationFactory,\n        private RequestContextInitiatorInterface $decorated,\n        private ?VarsResolverInterface $varsResolver = null,\n    ) {\n        if (null === $varsResolver) {\n            trigger_deprecation(\n                'sylius/resource-bundle',\n                '1.14',\n                'Not passing an instance of \"%s\" as the fourth constructor argument for \"%s\" is deprecated and will not be supported in 2.0.',\n                VarsResolverInterface::class,\n                self::class,\n            );\n        }\n    }\n\n    public function initializeContext(Request $request): Context\n    {\n        $context = $this->decorated->initializeContext($request);\n\n        if ([] === $attributes = $request->attributes->all('_sylius')) {\n            return $context;\n        }\n\n        /** @var string|class-string|null $resource */\n        $resource = $attributes['resource'] ?? null;\n\n        if (null === $resource) {\n            return $context;\n        }\n\n        if (str_contains($resource, '.')) {\n            $metadata = $this->resourceRegistry->get($resource);\n        } else {\n            $metadata = $this->resourceRegistry->getByClass($resource);\n        }\n\n        $configuration = $this->requestConfigurationFactory->create($metadata, $request);\n        $configurationVars = $this->resolveVars($configuration->getVars());\n\n        $configuration->getParameters()->set('vars', $configurationVars);\n\n        return $context->with(new MetadataOption($metadata), new RequestConfigurationOption($configuration));\n    }\n\n    private function resolveVars(array $vars): array\n    {\n        if (null === $this->varsResolver) {\n            return $vars;\n        }\n\n        return $this->varsResolver->resolve($vars);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Context/Option/RequestConfigurationOption.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Context\\Option;\n\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\n\nfinal class RequestConfigurationOption\n{\n    public function __construct(private RequestConfiguration $requestConfiguration)\n    {\n    }\n\n    public function requestConfiguration(): RequestConfiguration\n    {\n        return $this->requestConfiguration;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/AuthorizationCheckerInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\ninterface AuthorizationCheckerInterface\n{\n    /**\n     * Checks if user is authorized based on the current request configuration and specific permission.\n     *\n     * Sample permissions:\n     *\n     * - create\n     * - show\n     * - delete\n     * - custom_action\n     */\n    public function isGranted(RequestConfiguration $configuration, string $permission): bool;\n}\n"
  },
  {
    "path": "src/Bundle/Controller/BcLayerRequestTrait.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Symfony\\Component\\HttpFoundation\\Request;\n\n/**\n * Copied from symfony/http-request 7.4.\n * It's only used as bc-layer for the ParametersParser.\n *\n * @internal\n */\ntrait BcLayerRequestTrait\n{\n    public function getFromRequest(Request $request, string $key, mixed $default = null): mixed\n    {\n        if ($request->attributes->has($key)) {\n            return $request->attributes->get($key, $default);\n        }\n\n        if ($request->query->has($key)) {\n            return $request->query->all()[$key];\n        }\n\n        if ($request->request->has($key)) {\n            return $request->request->all()[$key];\n        }\n\n        return $default;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ContainerAwareTrait.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Symfony\\Component\\DependencyInjection\\ContainerInterface;\n\n/**\n * Copied from Symfony to keep using ResourceController as this trait has been removed in Symfony 7.\n * Do not use this trait on your projects, use dependency injection instead.\n *\n * @see https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/DependencyInjection/ContainerAwareTrait.php\n *\n * @internal\n */\ntrait ContainerAwareTrait\n{\n    protected ?ContainerInterface $container = null;\n\n    public function setContainer(?ContainerInterface $container = null): void\n    {\n        $this->container = $container;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ControllerTrait.php",
    "content": "<?php\n\n/*\n * This file is part of the Symfony package.\n *\n * (c) Fabien Potencier <fabien@symfony.com>\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Doctrine\\Persistence\\ManagerRegistry;\nuse Psr\\Container\\ContainerInterface;\nuse Psr\\Link\\LinkInterface;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Symfony\\Component\\Form\\FormInterface;\nuse Symfony\\Component\\HttpFoundation\\BinaryFileResponse;\nuse Symfony\\Component\\HttpFoundation\\Exception\\SessionNotFoundException;\nuse Symfony\\Component\\HttpFoundation\\JsonResponse;\nuse Symfony\\Component\\HttpFoundation\\RedirectResponse;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\HttpFoundation\\ResponseHeaderBag;\nuse Symfony\\Component\\HttpFoundation\\Session\\FlashBagAwareSessionInterface;\nuse Symfony\\Component\\HttpFoundation\\StreamedResponse;\nuse Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException;\nuse Symfony\\Component\\HttpKernel\\HttpKernelInterface;\nuse Symfony\\Component\\Messenger\\Envelope;\nuse Symfony\\Component\\Messenger\\Stamp\\StampInterface;\nuse Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface;\nuse Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException;\nuse Symfony\\Component\\Security\\Core\\User\\UserInterface;\nuse Symfony\\Component\\Security\\Csrf\\CsrfToken;\nuse Symfony\\Component\\WebLink\\EventListener\\AddLinkHeaderListener;\nuse Symfony\\Component\\WebLink\\GenericLinkProvider;\n\n/**\n * Common features needed in controllers.\n *\n * @author Fabien Potencier <fabien@symfony.com>\n *\n * @internal\n *\n * @property ContainerInterface $container\n */\ntrait ControllerTrait\n{\n    /**\n     * Returns true if the service id is defined.\n     *\n     * @final\n     */\n    protected function has(string $id): bool\n    {\n        return $this->container->has($id);\n    }\n\n    /**\n     * Gets a container service by its id.\n     *\n     * @return object The service\n     *\n     * @final\n     */\n    protected function get(string $id)\n    {\n        return $this->container->get($id);\n    }\n\n    /**\n     * Generates a URL from the given parameters.\n     *\n     * @see UrlGeneratorInterface\n     *\n     * @final\n     */\n    protected function generateUrl(string $route, array $parameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH): string\n    {\n        return $this->container->get('router')->generate($route, $parameters, $referenceType);\n    }\n\n    /**\n     * Forwards the request to another controller.\n     *\n     * @param string $controller The controller name (a string like Bundle\\BlogBundle\\Controller\\PostController::indexAction)\n     *\n     * @final\n     */\n    protected function forward(string $controller, array $path = [], array $query = []): Response\n    {\n        $request = $this->container->get('request_stack')->getCurrentRequest();\n        $path['_controller'] = $controller;\n        $subRequest = $request->duplicate($query, null, $path);\n\n        return $this->container->get('http_kernel')->handle($subRequest, HttpKernelInterface::SUB_REQUEST);\n    }\n\n    /**\n     * Returns a RedirectResponse to the given URL.\n     *\n     * @final\n     */\n    protected function redirect(string $url, int $status = 302): RedirectResponse\n    {\n        return new RedirectResponse($url, $status);\n    }\n\n    /**\n     * Returns a RedirectResponse to the given route with the given parameters.\n     *\n     * @final\n     */\n    protected function redirectToRoute(string $route, array $parameters = [], int $status = 302): RedirectResponse\n    {\n        return $this->redirect($this->generateUrl($route, $parameters), $status);\n    }\n\n    /**\n     * Returns a JsonResponse that uses the serializer component if enabled, or json_encode.\n     *\n     * @final\n     */\n    protected function json($data, int $status = 200, array $headers = [], array $context = []): JsonResponse\n    {\n        if ($this->container->has('serializer')) {\n            $json = $this->container->get('serializer')->serialize($data, 'json', array_merge([\n                'json_encode_options' => JsonResponse::DEFAULT_ENCODING_OPTIONS,\n            ], $context));\n\n            return new JsonResponse($json, $status, $headers, true);\n        }\n\n        return new JsonResponse($data, $status, $headers);\n    }\n\n    /**\n     * Returns a BinaryFileResponse object with original or customized file name and disposition header.\n     *\n     * @param \\SplFileInfo|string $file File object or path to file to be sent as response\n     *\n     * @final\n     */\n    protected function file($file, ?string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT): BinaryFileResponse\n    {\n        $response = new BinaryFileResponse($file);\n        $response->setContentDisposition($disposition, null === $fileName ? $response->getFile()->getFilename() : $fileName);\n\n        return $response;\n    }\n\n    /**\n     * Adds a flash message to the current session for type.\n     *\n     * @throws \\LogicException\n     *\n     * @final\n     */\n    protected function addFlash(string $type, $message)\n    {\n        try {\n            $session = $this->container->get('request_stack')->getSession();\n        } catch (SessionNotFoundException $e) {\n            throw new \\LogicException('You cannot use the addFlash method if sessions are disabled. Enable them in \"config/packages/framework.yaml\".', 0, $e);\n        }\n\n        if (!$session instanceof FlashBagAwareSessionInterface) {\n            trigger_deprecation('symfony/framework-bundle', '6.2', 'Calling \"addFlash()\" method when the session does not implement %s is deprecated.', FlashBagAwareSessionInterface::class);\n        }\n\n        $session->getFlashBag()->add($type, $message);\n    }\n\n    /**\n     * Checks if the attributes are granted against the current authentication token and optionally supplied subject.\n     *\n     * @throws \\LogicException\n     *\n     * @final\n     */\n    protected function isGranted($attributes, $subject = null): bool\n    {\n        if (!$this->container->has('security.authorization_checker')) {\n            throw new \\LogicException('The SecurityBundle is not registered in your application. Try running \"composer require symfony/security-bundle\".');\n        }\n\n        return $this->container->get('security.authorization_checker')->isGranted($attributes, $subject);\n    }\n\n    /**\n     * Throws an exception unless the attributes are granted against the current authentication token and optionally\n     * supplied subject.\n     *\n     * @throws AccessDeniedException\n     *\n     * @final\n     */\n    protected function denyAccessUnlessGranted($attributes, $subject = null, string $message = 'Access Denied.')\n    {\n        if (!$this->isGranted($attributes, $subject)) {\n            $exception = $this->createAccessDeniedException($message);\n            $exception->setAttributes($attributes);\n            $exception->setSubject($subject);\n\n            throw $exception;\n        }\n    }\n\n    /**\n     * Returns a rendered view.\n     *\n     * @final\n     */\n    protected function renderView(string $view, array $parameters = []): string\n    {\n        if ($this->container->has('templating')) {\n            @trigger_error('Using the \"templating\" service is deprecated since Symfony 4.3 and will be removed in 5.0; use Twig instead.', \\E_USER_DEPRECATED);\n\n            return $this->container->get('templating')->render($view, $parameters);\n        }\n\n        if (!$this->container->has('twig')) {\n            throw new \\LogicException('You can not use the \"renderView\" method if the Templating Component or the Twig Bundle are not available. Try running \"composer require symfony/twig-bundle\".');\n        }\n\n        return $this->container->get('twig')->render($view, $parameters);\n    }\n\n    /**\n     * Renders a view.\n     *\n     * @final\n     */\n    protected function render(\n        string $view,\n        array $parameters = [],\n        ?Response $response = null,\n        ?int $responseCode = null\n    ): Response {\n        if ($this->container->has('templating')) {\n            @trigger_error('Using the \"templating\" service is deprecated since Symfony 4.3 and will be removed in 5.0; use Twig instead.', \\E_USER_DEPRECATED);\n\n            $content = $this->container->get('templating')->render($view, $parameters);\n        } elseif ($this->container->has('twig')) {\n            $content = $this->container->get('twig')->render($view, $parameters);\n        } else {\n            throw new \\LogicException('You can not use the \"render\" method if the Templating Component or the Twig Bundle are not available. Try running \"composer require symfony/twig-bundle\".');\n        }\n\n        if (null === $response) {\n            $response = new Response();\n        }\n\n        $response->setContent($content);\n        if ($responseCode !== null) {\n            $response->setStatusCode($responseCode);\n        }\n\n        return $response;\n    }\n\n    /**\n     * Streams a view.\n     *\n     * @final\n     */\n    protected function stream(string $view, array $parameters = [], ?StreamedResponse $response = null): StreamedResponse\n    {\n        if ($this->container->has('templating')) {\n            @trigger_error('Using the \"templating\" service is deprecated since Symfony 4.3 and will be removed in 5.0; use Twig instead.', \\E_USER_DEPRECATED);\n\n            $templating = $this->container->get('templating');\n\n            $callback = function () use ($templating, $view, $parameters) {\n                $templating->stream($view, $parameters);\n            };\n        } elseif ($this->container->has('twig')) {\n            $twig = $this->container->get('twig');\n\n            $callback = function () use ($twig, $view, $parameters) {\n                $twig->display($view, $parameters);\n            };\n        } else {\n            throw new \\LogicException('You can not use the \"stream\" method if the Templating Component or the Twig Bundle are not available. Try running \"composer require symfony/twig-bundle\".');\n        }\n\n        if (null === $response) {\n            return new StreamedResponse($callback);\n        }\n\n        $response->setCallback($callback);\n\n        return $response;\n    }\n\n    /**\n     * Returns a NotFoundHttpException.\n     *\n     * This will result in a 404 response code. Usage example:\n     *\n     *     throw $this->createNotFoundException('Page not found!');\n     *\n     * @final\n     */\n    protected function createNotFoundException(string $message = 'Not Found', ?\\Throwable $previous = null): NotFoundHttpException\n    {\n        return new NotFoundHttpException($message, $previous);\n    }\n\n    /**\n     * Returns an AccessDeniedException.\n     *\n     * This will result in a 403 response code. Usage example:\n     *\n     *     throw $this->createAccessDeniedException('Unable to access this page!');\n     *\n     * @throws \\LogicException If the Security component is not available\n     *\n     * @final\n     */\n    protected function createAccessDeniedException(string $message = 'Access Denied.', ?\\Throwable $previous = null): AccessDeniedException\n    {\n        if (!class_exists(AccessDeniedException::class)) {\n            throw new \\LogicException('You can not use the \"createAccessDeniedException\" method if the Security component is not available. Try running \"composer require symfony/security-bundle\".');\n        }\n\n        return new AccessDeniedException($message, $previous);\n    }\n\n    /**\n     * Creates and returns a Form instance from the type of the form.\n     *\n     * @final\n     */\n    protected function createForm(string $type, $data = null, array $options = []): FormInterface\n    {\n        return $this->container->get('form.factory')->create($type, $data, $options);\n    }\n\n    /**\n     * Creates and returns a form builder instance.\n     *\n     * @final\n     */\n    protected function createFormBuilder($data = null, array $options = []): FormBuilderInterface\n    {\n        return $this->container->get('form.factory')->createBuilder(FormType::class, $data, $options);\n    }\n\n    /**\n     * Shortcut to return the Doctrine Registry service.\n     *\n     * @return ManagerRegistry\n     *\n     * @throws \\LogicException If DoctrineBundle is not available\n     *\n     * @final\n     */\n    protected function getDoctrine()\n    {\n        if (!$this->container->has('doctrine')) {\n            throw new \\LogicException('The DoctrineBundle is not registered in your application. Try running \"composer require symfony/orm-pack\".');\n        }\n\n        return $this->container->get('doctrine');\n    }\n\n    /**\n     * Get a user from the Security Token Storage.\n     *\n     * @return UserInterface|object|null\n     *\n     * @throws \\LogicException If SecurityBundle is not available\n     *\n     * @see TokenInterface::getUser()\n     *\n     * @final\n     */\n    protected function getUser()\n    {\n        if (!$this->container->has('security.token_storage')) {\n            throw new \\LogicException('The SecurityBundle is not registered in your application. Try running \"composer require symfony/security-bundle\".');\n        }\n\n        if (null === $token = $this->container->get('security.token_storage')->getToken()) {\n            return null;\n        }\n\n        if (!\\is_object($user = $token->getUser())) {\n            // e.g. anonymous authentication\n            return null;\n        }\n\n        return $user;\n    }\n\n    /**\n     * Checks the validity of a CSRF token.\n     *\n     * @param string      $id    The id used when generating the token\n     * @param string|null $token The actual token sent with the request that should be validated\n     *\n     * @final\n     */\n    protected function isCsrfTokenValid(string $id, ?string $token): bool\n    {\n        if (!$this->container->has('security.csrf.token_manager')) {\n            throw new \\LogicException('CSRF protection is not enabled in your application. Enable it with the \"csrf_protection\" key in \"config/packages/framework.yaml\".');\n        }\n\n        return $this->container->get('security.csrf.token_manager')->isTokenValid(new CsrfToken($id, $token));\n    }\n\n    /**\n     * Dispatches a message to the bus.\n     *\n     * @param object|Envelope  $message The message or the message pre-wrapped in an envelope\n     * @param StampInterface[] $stamps\n     *\n     * @final\n     */\n    protected function dispatchMessage($message, array $stamps = []): Envelope\n    {\n        if (!$this->container->has('messenger.default_bus')) {\n            $message = class_exists(Envelope::class) ? 'You need to define the \"messenger.default_bus\" configuration option.' : 'Try running \"composer require symfony/messenger\".';\n            throw new \\LogicException('The message bus is not enabled in your application. '.$message);\n        }\n\n        return $this->container->get('messenger.default_bus')->dispatch($message, $stamps);\n    }\n\n    /**\n     * Adds a Link HTTP header to the current response.\n     *\n     * @see https://tools.ietf.org/html/rfc5988\n     *\n     * @final\n     */\n    protected function addLink(Request $request, LinkInterface $link)\n    {\n        if (!class_exists(AddLinkHeaderListener::class)) {\n            throw new \\LogicException('You can not use the \"addLink\" method if the WebLink component is not available. Try running \"composer require symfony/web-link\".');\n        }\n\n        if (null === $linkProvider = $request->attributes->get('_links')) {\n            $request->attributes->set('_links', new GenericLinkProvider([$link]));\n\n            return;\n        }\n\n        $request->attributes->set('_links', $linkProvider->withLink($link));\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/DisabledAuthorizationChecker.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\n/**\n * This authorization checker always returns true. Useful if you don't want to have authorization checks at all.\n */\nfinal class DisabledAuthorizationChecker implements AuthorizationCheckerInterface\n{\n    public function isGranted(RequestConfiguration $configuration, string $permission): bool\n    {\n        return true;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/EventDispatcher.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface as SymfonyEventDispatcherInterface;\n\nfinal class EventDispatcher implements EventDispatcherInterface\n{\n    private SymfonyEventDispatcherInterface $eventDispatcher;\n\n    public function __construct(SymfonyEventDispatcherInterface $eventDispatcher)\n    {\n        $this->eventDispatcher = $eventDispatcher;\n    }\n\n    public function dispatch(\n        string $eventName,\n        RequestConfiguration $requestConfiguration,\n        ResourceInterface $resource,\n    ): ResourceControllerEvent {\n        $eventName = $requestConfiguration->getEvent() ?: $eventName;\n        $metadata = $requestConfiguration->getMetadata();\n        $event = new ResourceControllerEvent($resource);\n\n        $this->eventDispatcher->dispatch($event, sprintf('%s.%s.%s', $metadata->getApplicationName(), $metadata->getName(), $eventName));\n\n        return $event;\n    }\n\n    public function dispatchMultiple(\n        string $eventName,\n        RequestConfiguration $requestConfiguration,\n        $resources,\n    ): ResourceControllerEvent {\n        $eventName = $requestConfiguration->getEvent() ?: $eventName;\n        $metadata = $requestConfiguration->getMetadata();\n        $event = new ResourceControllerEvent($resources);\n\n        $this->eventDispatcher->dispatch($event, sprintf('%s.%s.%s', $metadata->getApplicationName(), $metadata->getName(), $eventName));\n\n        return $event;\n    }\n\n    public function dispatchPreEvent(\n        string $eventName,\n        RequestConfiguration $requestConfiguration,\n        ResourceInterface $resource,\n    ): ResourceControllerEvent {\n        $eventName = $requestConfiguration->getEvent() ?: $eventName;\n        $metadata = $requestConfiguration->getMetadata();\n        $event = new ResourceControllerEvent($resource);\n\n        $this->eventDispatcher->dispatch($event, sprintf('%s.%s.pre_%s', $metadata->getApplicationName(), $metadata->getName(), $eventName));\n\n        return $event;\n    }\n\n    public function dispatchPostEvent(\n        string $eventName,\n        RequestConfiguration $requestConfiguration,\n        ResourceInterface $resource,\n    ): ResourceControllerEvent {\n        $eventName = $requestConfiguration->getEvent() ?: $eventName;\n        $metadata = $requestConfiguration->getMetadata();\n        $event = new ResourceControllerEvent($resource);\n\n        $this->eventDispatcher->dispatch($event, sprintf('%s.%s.post_%s', $metadata->getApplicationName(), $metadata->getName(), $eventName));\n\n        return $event;\n    }\n\n    public function dispatchInitializeEvent(\n        string $eventName,\n        RequestConfiguration $requestConfiguration,\n        ResourceInterface $resource,\n    ): ResourceControllerEvent {\n        $eventName = $requestConfiguration->getEvent() ?: $eventName;\n        $metadata = $requestConfiguration->getMetadata();\n        $event = new ResourceControllerEvent($resource);\n\n        $this->eventDispatcher->dispatch(\n            $event,\n            sprintf('%s.%s.initialize_%s', $metadata->getApplicationName(), $metadata->getName(), $eventName),\n        );\n\n        return $event;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/EventDispatcherInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\ninterface EventDispatcherInterface\n{\n    public function dispatch(\n        string $eventName,\n        RequestConfiguration $requestConfiguration,\n        ResourceInterface $resource,\n    ): ResourceControllerEvent;\n\n    /** @param mixed $resources */\n    public function dispatchMultiple(\n        string $eventName,\n        RequestConfiguration $requestConfiguration,\n        $resources,\n    ): ResourceControllerEvent;\n\n    public function dispatchPreEvent(\n        string $eventName,\n        RequestConfiguration $requestConfiguration,\n        ResourceInterface $resource,\n    ): ResourceControllerEvent;\n\n    public function dispatchPostEvent(\n        string $eventName,\n        RequestConfiguration $requestConfiguration,\n        ResourceInterface $resource,\n    ): ResourceControllerEvent;\n\n    public function dispatchInitializeEvent(\n        string $eventName,\n        RequestConfiguration $requestConfiguration,\n        ResourceInterface $resource,\n    ): ResourceControllerEvent;\n}\n"
  },
  {
    "path": "src/Bundle/Controller/FlashHelper.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\HttpFoundation\\RequestStack;\nuse Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface;\nuse Symfony\\Component\\HttpFoundation\\Session\\SessionInterface;\nuse function Symfony\\Component\\String\\u;\nuse Symfony\\Component\\Translation\\TranslatorBagInterface;\nuse Symfony\\Contracts\\Translation\\TranslatorInterface;\n\nfinal class FlashHelper implements FlashHelperInterface\n{\n    /** @var RequestStack|SessionInterface */\n    private $requestStack;\n\n    private TranslatorInterface $translator;\n\n    private string $defaultLocale;\n\n    /**\n     * @param RequestStack|SessionInterface $requestStack\n     */\n    public function __construct(/* RequestStack */ $requestStack, TranslatorInterface $translator, string $defaultLocale)\n    {\n        /** @phpstan-ignore-next-line */\n        if (!$requestStack instanceof SessionInterface && !$requestStack instanceof RequestStack) {\n            throw new \\InvalidArgumentException(sprintf('The first argument of \"%s\" should be instance of \"%s\" or \"%s\"', __METHOD__, SessionInterface::class, RequestStack::class));\n        }\n\n        if ($requestStack instanceof SessionInterface) {\n            trigger_deprecation(\n                'sylius/resource-bundle',\n                '1.10',\n                'Passing an instance of \"%s\" as the first constructor argument for \"%s\" is deprecated and will not be supported in 2.0. Pass an instance of \"%s\" instead.',\n                SessionInterface::class,\n                self::class,\n                RequestStack::class,\n            );\n        }\n\n        $this->requestStack = $requestStack;\n        $this->translator = $translator;\n        $this->defaultLocale = $defaultLocale;\n    }\n\n    public function addSuccessFlash(\n        RequestConfiguration $requestConfiguration,\n        string $actionName,\n        ?ResourceInterface $resource = null,\n    ): void {\n        $this->addFlashWithType($requestConfiguration, $actionName, 'success');\n    }\n\n    public function addErrorFlash(RequestConfiguration $requestConfiguration, string $actionName): void\n    {\n        $this->addFlashWithType($requestConfiguration, $actionName, 'error');\n    }\n\n    public function addFlashFromEvent(RequestConfiguration $requestConfiguration, ResourceControllerEvent $event): void\n    {\n        $this->addFlash($event->getMessageType(), $event->getMessage(), $event->getMessageParameters());\n    }\n\n    private function addFlashWithType(RequestConfiguration $requestConfiguration, string $actionName, string $type): void\n    {\n        $metadata = $requestConfiguration->getMetadata();\n        $parameters = $this->getParametersWithName($metadata, $actionName);\n\n        $message = (string) $requestConfiguration->getFlashMessage($actionName);\n        if (empty($message)) {\n            return;\n        }\n\n        if ($this->isTranslationDefined($message, $this->defaultLocale, $parameters)) {\n            if (!$this->translator instanceof TranslatorBagInterface) {\n                $this->addFlash($type, $message, $parameters);\n\n                return;\n            }\n\n            $this->addFlash($type, $message);\n\n            return;\n        }\n\n        $this->addFlash(\n            $type,\n            $this->getResourceMessage($actionName),\n            $parameters,\n        );\n    }\n\n    private function addFlash(string $type, string $message, array $parameters = []): void\n    {\n        if (!empty($parameters)) {\n            $message = $this->prepareMessage($message, $parameters);\n        }\n\n        if ($this->requestStack instanceof SessionInterface) {\n            $session = $this->requestStack;\n        } else {\n            $session = $this->requestStack->getSession();\n        }\n\n        /** @var FlashBagInterface $flashBag */\n        $flashBag = $session->getBag('flashes');\n        $flashBag->add($type, $message);\n    }\n\n    private function prepareMessage(string $message, array $parameters): array\n    {\n        return [\n            'message' => $message,\n            'parameters' => $parameters,\n        ];\n    }\n\n    private function getResourceMessage(string $actionName): string\n    {\n        return sprintf('sylius.resource.%s', $actionName);\n    }\n\n    private function isTranslationDefined(string $message, string $locale, array $parameters): bool\n    {\n        if ($this->translator instanceof TranslatorBagInterface) {\n            $defaultCatalogue = $this->translator->getCatalogue($locale);\n\n            return $defaultCatalogue->has($message, 'flashes');\n        }\n\n        return $message !== $this->translator->trans($message, $parameters, 'flashes');\n    }\n\n    private function getParametersWithName(MetadataInterface $metadata, string $actionName): array\n    {\n        $applicationName = $metadata->getApplicationName();\n\n        if (stripos($actionName, 'bulk') !== false) {\n            $resourceName = $metadata->getPluralName();\n            $fallback = ucfirst($resourceName);\n\n            return ['%resources%' => $this->translateResourceName($applicationName, $resourceName, $fallback)];\n        }\n\n        $resourceName = $metadata->getName();\n        $fallback = ucfirst($metadata->getHumanizedName());\n\n        return ['%resource%' => $this->translateResourceName($applicationName, $resourceName, $fallback)];\n    }\n\n    private function translateResourceName(string $applicationName, string $resourceName, string $fallback): string\n    {\n        $snakeCaseName = u($resourceName)->snake()->toString();\n        $translationKey = sprintf('%s.ui.%s', $applicationName, $snakeCaseName);\n        $translated = $this->translator->trans($translationKey, [], 'messages');\n\n        return $translated === $translationKey ? $fallback : $translated;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/FlashHelperInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\ninterface FlashHelperInterface\n{\n    public function addSuccessFlash(\n        RequestConfiguration $requestConfiguration,\n        string $actionName,\n        ?ResourceInterface $resource = null,\n    ): void;\n\n    public function addErrorFlash(RequestConfiguration $requestConfiguration, string $actionName): void;\n\n    public function addFlashFromEvent(RequestConfiguration $requestConfiguration, ResourceControllerEvent $event): void;\n}\n"
  },
  {
    "path": "src/Bundle/Controller/NewResourceFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Factory\\FactoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\nfinal class NewResourceFactory implements NewResourceFactoryInterface\n{\n    public function create(RequestConfiguration $requestConfiguration, FactoryInterface $factory): ResourceInterface\n    {\n        if (null === $method = $requestConfiguration->getFactoryMethod()) {\n            /** @var ResourceInterface $resource */\n            $resource = $factory->createNew();\n\n            return $resource;\n        }\n\n        if (is_array($method) && 2 === count($method)) {\n            $factory = $method[0];\n            $method = $method[1];\n        }\n\n        $arguments = array_values($requestConfiguration->getFactoryArguments());\n\n        return $factory->$method(...$arguments);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/NewResourceFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Factory\\FactoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\ninterface NewResourceFactoryInterface\n{\n    public function create(RequestConfiguration $requestConfiguration, FactoryInterface $factory): ResourceInterface;\n}\n"
  },
  {
    "path": "src/Bundle/Controller/Parameters.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpKernel\\Kernel;\n\nif (Kernel::MAJOR_VERSION >= 6) {\n    class Parameters extends ParameterBag\n    {\n        /**\n         * @param mixed $default\n         */\n        public function get(string $key, $default = null): mixed\n        {\n            $result = parent::get($key, $default);\n\n            if (null === $result && $default !== null && $this->has($key)) {\n                $result = $default;\n            }\n\n            return $result;\n        }\n    }\n} else {\n    class Parameters extends ParameterBag\n    {\n        /**\n         * @param mixed $default\n         *\n         * @return mixed\n         */\n        public function get(string $key, $default = null)\n        {\n            $result = parent::get($key, $default);\n\n            if (null === $result && $default !== null && $this->has($key)) {\n                $result = $default;\n            }\n\n            return $result;\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ParametersParser.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Bundle\\ResourceBundle\\Provider\\RequestParameterProvider;\nuse Symfony\\Component\\DependencyInjection\\ContainerInterface;\nuse Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Webmozart\\Assert\\Assert;\n\nfinal class ParametersParser implements ParametersParserInterface\n{\n    use BcLayerRequestTrait;\n\n    private ContainerInterface $container;\n\n    private ExpressionLanguage $expression;\n\n    public function __construct(ContainerInterface $container, ExpressionLanguage $expression)\n    {\n        $this->container = $container;\n        $this->expression = $expression;\n    }\n\n    public function parseRequestValues(array $parameters, Request $request): array\n    {\n        return array_map(\n            /**\n             * @param mixed $parameter\n             *\n             * @return mixed\n             */\n            function ($parameter) use ($request) {\n                if (is_array($parameter)) {\n                    return $this->parseRequestValues($parameter, $request);\n                }\n\n                return $this->parseRequestValue($parameter, $request);\n            },\n            $parameters,\n        );\n    }\n\n    /**\n     * @param mixed $parameter\n     *\n     * @return mixed\n     */\n    private function parseRequestValue($parameter, Request $request)\n    {\n        if (!is_string($parameter)) {\n            return $parameter;\n        }\n\n        if (0 === strpos($parameter, '$')) {\n            return RequestParameterProvider::provide($request, substr($parameter, 1));\n        }\n\n        if (0 === strpos($parameter, 'expr:')) {\n            return $this->parseRequestValueExpression(substr($parameter, 5), $request);\n        }\n\n        if (0 === strpos($parameter, '!!')) {\n            return $this->parseRequestValueTypecast($parameter, $request);\n        }\n\n        return $parameter;\n    }\n\n    /** @return mixed */\n    private function parseRequestValueExpression(string $expression, Request $request)\n    {\n        $expression = (string) preg_replace_callback(\n            '/(\\$\\w+)/',\n            /**\n             * @return mixed\n             */\n            function (array $matches) use ($request) {\n                $variable = $this->getFromRequest($request, substr($matches[1], 1));\n\n                if (is_array($variable) || is_object($variable)) {\n                    throw new \\InvalidArgumentException(sprintf(\n                        'Cannot use %s ($%s) as parameter in expression.',\n                        gettype($variable),\n                        $matches[1],\n                    ));\n                }\n\n                return is_string($variable) ? sprintf('\"%s\"', addslashes($variable)) : $variable;\n            },\n            $expression,\n        );\n\n        return $this->expression->evaluate($expression, ['container' => $this->container]);\n    }\n\n    /** @return mixed */\n    private function parseRequestValueTypecast(string $parameter, Request $request)\n    {\n        [$typecast, $castedValue] = explode(' ', $parameter, 2);\n\n        /** @var callable $castFunctionName */\n        $castFunctionName = substr($typecast, 2) . 'val';\n\n        Assert::oneOf($castFunctionName, ['intval', 'floatval', 'boolval'], 'Variable can be casted only to int, float or bool.');\n\n        return $castFunctionName($this->parseRequestValue($castedValue, $request));\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ParametersParserInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Symfony\\Component\\HttpFoundation\\Request;\n\ninterface ParametersParserInterface\n{\n    public function parseRequestValues(array $parameters, Request $request): array;\n}\n"
  },
  {
    "path": "src/Bundle/Controller/RedirectHandler.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Sylius\\Resource\\ResourceActions;\nuse Symfony\\Component\\HttpFoundation\\RedirectResponse;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Routing\\Exception\\RouteNotFoundException;\nuse Symfony\\Component\\Routing\\RouterInterface;\n\nfinal class RedirectHandler implements RedirectHandlerInterface\n{\n    private RouterInterface $router;\n\n    public function __construct(RouterInterface $router)\n    {\n        $this->router = $router;\n    }\n\n    public function redirectToResource(RequestConfiguration $configuration, ResourceInterface $resource): Response\n    {\n        try {\n            return $this->redirectToRoute(\n                $configuration,\n                (string) $configuration->getRedirectRoute(ResourceActions::SHOW),\n                $configuration->getRedirectParameters($resource),\n            );\n        } catch (RouteNotFoundException $exception) {\n            return $this->redirectToRoute(\n                $configuration,\n                (string) $configuration->getRedirectRoute(ResourceActions::INDEX),\n                $configuration->getRedirectParameters($resource),\n            );\n        }\n    }\n\n    public function redirectToIndex(RequestConfiguration $configuration, ?ResourceInterface $resource = null): Response\n    {\n        return $this->redirectToRoute(\n            $configuration,\n            (string) $configuration->getRedirectRoute('index'),\n            $configuration->getRedirectParameters($resource),\n        );\n    }\n\n    public function redirectToRoute(RequestConfiguration $configuration, string $route, array $parameters = []): Response\n    {\n        if ('referer' === $route) {\n            return $this->redirectToReferer($configuration);\n        }\n\n        return $this->redirect($configuration, $this->router->generate($route, $parameters));\n    }\n\n    public function redirect(RequestConfiguration $configuration, string $url, int $status = 302): Response\n    {\n        if ($configuration->isHeaderRedirection()) {\n            return new Response('', 200, [\n                'X-SYLIUS-LOCATION' => $url . $configuration->getRedirectHash(),\n            ]);\n        }\n\n        return new RedirectResponse($url . $configuration->getRedirectHash(), $status);\n    }\n\n    public function redirectToReferer(RequestConfiguration $configuration): Response\n    {\n        return $this->redirect($configuration, (string) $configuration->getRedirectReferer());\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/RedirectHandlerInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\ninterface RedirectHandlerInterface\n{\n    public function redirectToResource(RequestConfiguration $configuration, ResourceInterface $resource): Response;\n\n    public function redirectToIndex(RequestConfiguration $configuration, ?ResourceInterface $resource = null): Response;\n\n    public function redirectToRoute(RequestConfiguration $configuration, string $route, array $parameters = []): Response;\n\n    public function redirect(RequestConfiguration $configuration, string $url, int $status = 302): Response;\n\n    public function redirectToReferer(RequestConfiguration $configuration): Response;\n}\n"
  },
  {
    "path": "src/Bundle/Controller/RequestConfiguration.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Bundle\\ResourceBundle\\Provider\\RequestParameterProvider;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\PropertyAccess\\PropertyAccess;\n\nclass RequestConfiguration\n{\n    private Request $request;\n\n    private MetadataInterface $metadata;\n\n    private Parameters $parameters;\n\n    public function __construct(MetadataInterface $metadata, Request $request, Parameters $parameters)\n    {\n        $this->metadata = $metadata;\n        $this->request = $request;\n        $this->parameters = $parameters;\n    }\n\n    /**\n     * @return Request\n     */\n    public function getRequest()\n    {\n        return $this->request;\n    }\n\n    /**\n     * @return MetadataInterface\n     */\n    public function getMetadata()\n    {\n        return $this->metadata;\n    }\n\n    /**\n     * @return Parameters\n     */\n    public function getParameters()\n    {\n        return $this->parameters;\n    }\n\n    /**\n     * @return string|null\n     */\n    public function getSection()\n    {\n        return $this->parameters->get('section');\n    }\n\n    /**\n     * @return bool\n     */\n    public function isHtmlRequest()\n    {\n        return 'html' === $this->request->getRequestFormat();\n    }\n\n    /**\n     * @param string $name\n     *\n     * @return string|null\n     */\n    public function getDefaultTemplate($name)\n    {\n        $templatesNamespace = (string) $this->metadata->getTemplatesNamespace();\n\n        if (false !== strpos($templatesNamespace, ':')) {\n            return sprintf('%s:%s.%s', $templatesNamespace, $name, 'twig');\n        }\n\n        return sprintf('%s/%s.%s', $templatesNamespace, $name, 'twig');\n    }\n\n    /**\n     * @param string $name\n     *\n     * @return mixed\n     */\n    public function getTemplate($name)\n    {\n        $template = $this->parameters->get('template', $this->getDefaultTemplate($name));\n\n        if (null === $template) {\n            throw new \\RuntimeException(sprintf('Could not resolve template for resource \"%s\".', $this->metadata->getAlias()));\n        }\n\n        return $template;\n    }\n\n    /**\n     * @return string|null\n     */\n    public function getFormType()\n    {\n        $form = $this->parameters->get('form');\n        if (isset($form['type'])) {\n            return $form['type'];\n        }\n\n        if (is_string($form)) {\n            return $form;\n        }\n\n        return $this->metadata->getClass('form');\n    }\n\n    /**\n     * @return array\n     */\n    public function getFormOptions()\n    {\n        $form = $this->parameters->get('form');\n        if (isset($form['options'])) {\n            return $form['options'];\n        }\n\n        return [];\n    }\n\n    /**\n     * @param string $name\n     *\n     * @return string\n     */\n    public function getRouteName($name)\n    {\n        $section = $this->getSection();\n        $sectionPrefix = $section ? $section . '_' : '';\n\n        return sprintf('%s_%s%s_%s', $this->metadata->getApplicationName(), $sectionPrefix, $this->metadata->getName(), $name);\n    }\n\n    /**\n     * @param string $name\n     *\n     * @return mixed|string|null\n     */\n    public function getRedirectRoute($name)\n    {\n        $redirect = $this->parameters->get('redirect');\n\n        if (null === $redirect) {\n            return $this->getRouteName($name);\n        }\n\n        if (is_array($redirect)) {\n            if (!empty($redirect['referer'])) {\n                return 'referer';\n            }\n\n            return $redirect['route'];\n        }\n\n        return $redirect;\n    }\n\n    /**\n     * Get url hash fragment (#text) which is you configured.\n     *\n     * @return string\n     */\n    public function getRedirectHash()\n    {\n        $redirect = $this->parameters->get('redirect');\n\n        if (!is_array($redirect) || empty($redirect['hash'])) {\n            return '';\n        }\n\n        return '#' . $redirect['hash'];\n    }\n\n    /**\n     * Get redirect referer, This will detected by configuration\n     * If not exists, The `referrer` from headers will be used.\n     *\n     * @return string|null\n     */\n    public function getRedirectReferer()\n    {\n        /** @var array|null $redirect */\n        $redirect = $this->parameters->get('redirect');\n        /** @var string|null $referer */\n        $referer = $this->request->headers->get('referer');\n\n        if (!is_array($redirect) || empty($redirect['referer'])) {\n            return $referer;\n        }\n\n        if ($redirect['referer'] === true) {\n            return $referer;\n        }\n\n        return $redirect['referer'];\n    }\n\n    /**\n     * @param object|null $resource\n     *\n     * @return array\n     */\n    public function getRedirectParameters($resource = null)\n    {\n        $redirect = $this->parameters->get('redirect');\n\n        if (isset($redirect['parameters']) && $redirect['parameters'] === []) {\n            return [];\n        }\n\n        if (!is_array($redirect)) {\n            $redirect = ['parameters' => []];\n        }\n\n        $parameters = $redirect['parameters'] ?? [];\n        $parameters = $this->addExtraRedirectParameters($parameters);\n\n        if (null !== $resource) {\n            $parameters = $this->parseResourceValues($parameters, $resource);\n        }\n\n        return $parameters;\n    }\n\n    /**\n     * @param array $parameters\n     */\n    private function addExtraRedirectParameters($parameters): array\n    {\n        $vars = $this->getVars();\n        $accessor = PropertyAccess::createPropertyAccessor();\n\n        if ($accessor->isReadable($vars, '[redirect][parameters]')) {\n            $extraParameters = $accessor->getValue($vars, '[redirect][parameters]');\n\n            if (is_array($extraParameters)) {\n                $parameters = array_merge($parameters, $extraParameters);\n            }\n        }\n\n        return $parameters;\n    }\n\n    /**\n     * @return bool\n     */\n    public function isLimited()\n    {\n        return (bool) $this->parameters->get('limit', false);\n    }\n\n    /**\n     * @return int|null\n     */\n    public function getLimit()\n    {\n        $limit = null;\n\n        if ($this->isLimited()) {\n            $limit = (int) $this->parameters->get('limit', 10);\n        }\n\n        return $limit;\n    }\n\n    /**\n     * @return bool\n     */\n    public function isPaginated()\n    {\n        $pagination = $this->parameters->get('paginate', true);\n\n        return $pagination !== false && $pagination !== null;\n    }\n\n    /**\n     * @return int\n     */\n    public function getPaginationMaxPerPage()\n    {\n        return (int) $this->parameters->get('paginate', 10);\n    }\n\n    /**\n     * @return bool\n     */\n    public function isFilterable()\n    {\n        return (bool) $this->parameters->get('filterable', false);\n    }\n\n    /**\n     * @return array\n     */\n    public function getCriteria(array $criteria = [])\n    {\n        $defaultCriteria = array_merge($this->parameters->get('criteria', []), $criteria);\n\n        if ($this->isFilterable()) {\n            return $this->getRequestParameter('criteria', $defaultCriteria);\n        }\n\n        return $defaultCriteria;\n    }\n\n    /**\n     * @return bool\n     */\n    public function isSortable()\n    {\n        return (bool) $this->parameters->get('sortable', false);\n    }\n\n    /**\n     * @return array\n     */\n    public function getSorting(array $sorting = [])\n    {\n        $defaultSorting = array_merge($this->parameters->get('sorting', []), $sorting);\n\n        if ($this->isSortable()) {\n            $sorting = $this->getRequestParameter('sorting');\n            foreach ($defaultSorting as $key => $value) {\n                if (!isset($sorting[$key])) {\n                    $sorting[$key] = $value;\n                }\n            }\n\n            return $sorting;\n        }\n\n        return $defaultSorting;\n    }\n\n    /**\n     * @param string $parameter\n     * @param array $defaults\n     *\n     * @return array\n     */\n    public function getRequestParameter($parameter, $defaults = [])\n    {\n        return array_replace_recursive(\n            $defaults,\n            RequestParameterProvider::provide($this->request, $parameter, []),\n        );\n    }\n\n    /**\n     * @return array|string|null\n     */\n    public function getRepositoryMethod()\n    {\n        if (!$this->parameters->has('repository')) {\n            return null;\n        }\n\n        $repository = $this->parameters->get('repository');\n\n        return is_array($repository) ? $repository['method'] : $repository;\n    }\n\n    /**\n     * @return array\n     */\n    public function getRepositoryArguments()\n    {\n        if (!$this->parameters->has('repository')) {\n            return [];\n        }\n\n        $repository = $this->parameters->get('repository');\n\n        if (!isset($repository['arguments'])) {\n            return [];\n        }\n\n        return is_array($repository['arguments']) ? $repository['arguments'] : [$repository['arguments']];\n    }\n\n    /**\n     * @return array|string|null\n     */\n    public function getFactoryMethod()\n    {\n        if (!$this->parameters->has('factory')) {\n            return null;\n        }\n\n        $factory = $this->parameters->get('factory');\n\n        return is_array($factory) ? $factory['method'] : $factory;\n    }\n\n    /**\n     * @return array\n     */\n    public function getFactoryArguments()\n    {\n        if (!$this->parameters->has('factory')) {\n            return [];\n        }\n\n        $factory = $this->parameters->get('factory');\n\n        if (!isset($factory['arguments'])) {\n            return [];\n        }\n\n        return is_array($factory['arguments']) ? $factory['arguments'] : [$factory['arguments']];\n    }\n\n    /**\n     * @param string $message\n     *\n     * @return mixed|null\n     */\n    public function getFlashMessage($message)\n    {\n        return $this->parameters->get('flash', sprintf('%s.%s.%s', $this->metadata->getApplicationName(), $this->metadata->getName(), $message));\n    }\n\n    /**\n     * @return mixed|null\n     */\n    public function getSortablePosition()\n    {\n        return $this->parameters->get('sortable_position', 'position');\n    }\n\n    /**\n     * @return array|null\n     */\n    public function getSerializationGroups()\n    {\n        return $this->parameters->get('serialization_groups', []);\n    }\n\n    /**\n     * @return mixed|null\n     */\n    public function getSerializationVersion()\n    {\n        return $this->parameters->get('serialization_version');\n    }\n\n    /**\n     * @return string|null\n     */\n    public function getEvent()\n    {\n        return $this->parameters->get('event');\n    }\n\n    /**\n     * @return bool\n     */\n    public function hasPermission()\n    {\n        return false !== $this->parameters->get('permission', false);\n    }\n\n    /**\n     * @param string $name\n     *\n     * @return string\n     *\n     * @throws \\LogicException\n     */\n    public function getPermission($name)\n    {\n        $permission = $this->parameters->get('permission');\n\n        if (null === $permission) {\n            throw new \\LogicException('Current action does not require any authorization.');\n        }\n\n        if (true === $permission) {\n            return sprintf('%s.%s.%s', $this->metadata->getApplicationName(), $this->metadata->getName(), $name);\n        }\n\n        return $permission;\n    }\n\n    /**\n     * @return bool\n     */\n    public function isHeaderRedirection()\n    {\n        $redirect = $this->parameters->get('redirect');\n\n        if (!is_array($redirect) || !isset($redirect['header'])) {\n            return false;\n        }\n\n        if ('xhr' === $redirect['header']) {\n            return $this->getRequest()->isXmlHttpRequest();\n        }\n\n        return (bool) $redirect['header'];\n    }\n\n    /**\n     * @return array\n     */\n    public function getVars()\n    {\n        return $this->parameters->get('vars', []);\n    }\n\n    /**\n     * @param object $resource\n     */\n    private function parseResourceValues(array $parameters, $resource): array\n    {\n        $accessor = PropertyAccess::createPropertyAccessor();\n\n        if (empty($parameters)) {\n            return ['id' => $accessor->getValue($resource, 'id')];\n        }\n\n        foreach ($parameters as $key => $value) {\n            if (is_array($value)) {\n                $parameters[$key] = $this->parseResourceValues($value, $resource);\n            }\n\n            if (is_string($value) && 0 === strpos($value, 'resource.')) {\n                $parameters[$key] = $accessor->getValue($resource, substr($value, 9));\n            }\n        }\n\n        return $parameters;\n    }\n\n    /**\n     * @return bool\n     */\n    public function hasGrid()\n    {\n        return $this->parameters->has('grid');\n    }\n\n    /**\n     * @return string\n     *\n     * @throws \\LogicException\n     */\n    public function getGrid()\n    {\n        if (!$this->hasGrid()) {\n            throw new \\LogicException('Current action does not use grid.');\n        }\n\n        return $this->parameters->get('grid');\n    }\n\n    /**\n     * @return bool\n     */\n    public function hasStateMachine()\n    {\n        return $this->parameters->has('state_machine');\n    }\n\n    /**\n     * @return string|null\n     */\n    public function getStateMachineGraph()\n    {\n        $options = $this->parameters->get('state_machine');\n\n        return $options['graph'] ?? null;\n    }\n\n    /**\n     * @return string|null\n     */\n    public function getStateMachineTransition()\n    {\n        $options = $this->parameters->get('state_machine');\n\n        return $options['transition'] ?? null;\n    }\n\n    /**\n     * @return bool\n     */\n    public function isCsrfProtectionEnabled()\n    {\n        return $this->parameters->get('csrf_protection', true);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/RequestConfigurationFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class RequestConfigurationFactory implements RequestConfigurationFactoryInterface\n{\n    private const API_VERSION_HEADER = 'Accept';\n\n    private const API_GROUPS_HEADER = 'Accept';\n\n    private const API_VERSION_REGEXP = '/(v|version)=(?P<version>[0-9\\.]+)/i';\n\n    private const API_GROUPS_REGEXP = '/(g|groups)=(?P<groups>[a-z,_\\s]+)/i';\n\n    private ParametersParserInterface $parametersParser;\n\n    /**\n     * @var string\n     * @psalm-var class-string<RequestConfiguration>\n     */\n    private $configurationClass;\n\n    private array $defaultParameters;\n\n    /**\n     * @psalm-param class-string<RequestConfiguration> $configurationClass\n     */\n    public function __construct(ParametersParserInterface $parametersParser, string $configurationClass, array $defaultParameters = [])\n    {\n        $this->parametersParser = $parametersParser;\n        $this->configurationClass = $configurationClass;\n        $this->defaultParameters = $defaultParameters;\n    }\n\n    public function create(MetadataInterface $metadata, Request $request): RequestConfiguration\n    {\n        $parameters = array_merge($this->defaultParameters, $this->parseApiParameters($request));\n        $parameters = $this->parametersParser->parseRequestValues($parameters, $request);\n\n        /** @psalm-suppress UnsafeInstantiation */\n        return new $this->configurationClass($metadata, $request, new Parameters($parameters));\n    }\n\n    /**\n     * @throws \\InvalidArgumentException\n     */\n    private function parseApiParameters(Request $request): array\n    {\n        $parameters = $request->attributes->get('_sylius', []);\n\n        /** @var string[] $apiVersionHeaders */\n        $apiVersionHeaders = $request->headers->all(self::API_VERSION_HEADER);\n        foreach ($apiVersionHeaders as $apiVersionHeader) {\n            if (preg_match(self::API_VERSION_REGEXP, $apiVersionHeader, $matches)) {\n                $parameters['serialization_version'] = $matches['version'];\n            }\n        }\n\n        $allowedSerializationGroups = array_merge(\n            $parameters['allowed_serialization_groups'] ?? [],\n            $parameters['serialization_groups'] ?? [],\n        );\n\n        /** @var string[] $apiGroupsHeaders */\n        $apiGroupsHeaders = $request->headers->all(self::API_GROUPS_HEADER);\n        foreach ($apiGroupsHeaders as $apiGroupsHeader) {\n            if (preg_match(self::API_GROUPS_REGEXP, $apiGroupsHeader, $matches)) {\n                $parameters['serialization_groups'] = array_intersect($allowedSerializationGroups, array_map('trim', explode(',', $matches['groups'])));\n            }\n        }\n\n        return $parameters;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/RequestConfigurationFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\ninterface RequestConfigurationFactoryInterface\n{\n    /**\n     * @throws \\InvalidArgumentException\n     */\n    public function create(MetadataInterface $metadata, Request $request): RequestConfiguration;\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ResourceController.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Doctrine\\Persistence\\ObjectManager;\nuse FOS\\RestBundle\\View\\View;\nuse Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Exception\\DeleteHandlingException;\nuse Sylius\\Resource\\Exception\\LogicException;\nuse Sylius\\Resource\\Exception\\UpdateHandlingException;\nuse Sylius\\Resource\\Factory\\FactoryInterface;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Sylius\\Resource\\ResourceActions;\nuse Symfony\\Component\\DependencyInjection\\ContainerInterface;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException;\nuse Symfony\\Component\\HttpKernel\\Exception\\HttpException;\nuse Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException;\nuse Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException;\n\nclass ResourceController\n{\n    use ControllerTrait;\n    use ContainerAwareTrait;\n    use BcLayerRequestTrait;\n\n    protected MetadataInterface $metadata;\n\n    protected RequestConfigurationFactoryInterface $requestConfigurationFactory;\n\n    protected ?ViewHandlerInterface $viewHandler;\n\n    protected RepositoryInterface $repository;\n\n    protected FactoryInterface $factory;\n\n    protected NewResourceFactoryInterface $newResourceFactory;\n\n    protected ObjectManager $manager;\n\n    protected SingleResourceProviderInterface $singleResourceProvider;\n\n    protected ResourcesCollectionProviderInterface $resourcesCollectionProvider;\n\n    protected ResourceFormFactoryInterface $resourceFormFactory;\n\n    protected RedirectHandlerInterface $redirectHandler;\n\n    protected FlashHelperInterface $flashHelper;\n\n    protected AuthorizationCheckerInterface $authorizationChecker;\n\n    protected EventDispatcherInterface $eventDispatcher;\n\n    protected ?StateMachineInterface $stateMachine;\n\n    protected ResourceUpdateHandlerInterface $resourceUpdateHandler;\n\n    protected ResourceDeleteHandlerInterface $resourceDeleteHandler;\n\n    public function __construct(\n        MetadataInterface $metadata,\n        RequestConfigurationFactoryInterface $requestConfigurationFactory,\n        ?ViewHandlerInterface $viewHandler,\n        RepositoryInterface $repository,\n        FactoryInterface $factory,\n        NewResourceFactoryInterface $newResourceFactory,\n        ObjectManager $manager,\n        SingleResourceProviderInterface $singleResourceProvider,\n        ResourcesCollectionProviderInterface $resourcesFinder,\n        ResourceFormFactoryInterface $resourceFormFactory,\n        RedirectHandlerInterface $redirectHandler,\n        FlashHelperInterface $flashHelper,\n        AuthorizationCheckerInterface $authorizationChecker,\n        EventDispatcherInterface $eventDispatcher,\n        ?StateMachineInterface $stateMachine,\n        ResourceUpdateHandlerInterface $resourceUpdateHandler,\n        ResourceDeleteHandlerInterface $resourceDeleteHandler,\n    ) {\n        $this->metadata = $metadata;\n        $this->requestConfigurationFactory = $requestConfigurationFactory;\n        $this->viewHandler = $viewHandler;\n        $this->repository = $repository;\n        $this->factory = $factory;\n        $this->newResourceFactory = $newResourceFactory;\n        $this->manager = $manager;\n        $this->singleResourceProvider = $singleResourceProvider;\n        $this->resourcesCollectionProvider = $resourcesFinder;\n        $this->resourceFormFactory = $resourceFormFactory;\n        $this->redirectHandler = $redirectHandler;\n        $this->flashHelper = $flashHelper;\n        $this->authorizationChecker = $authorizationChecker;\n        $this->eventDispatcher = $eventDispatcher;\n        $this->stateMachine = $stateMachine;\n        $this->resourceUpdateHandler = $resourceUpdateHandler;\n        $this->resourceDeleteHandler = $resourceDeleteHandler;\n    }\n\n    public function showAction(Request $request): Response\n    {\n        $configuration = $this->requestConfigurationFactory->create($this->metadata, $request);\n\n        $this->isGrantedOr403($configuration, ResourceActions::SHOW);\n        $resource = $this->findOr404($configuration);\n\n        $event = $this->eventDispatcher->dispatch(ResourceActions::SHOW, $configuration, $resource);\n        $eventResponse = $event->getResponse();\n        if (null !== $eventResponse) {\n            return $eventResponse;\n        }\n\n        if ($configuration->isHtmlRequest()) {\n            return $this->render($configuration->getTemplate(ResourceActions::SHOW . '.html'), [\n                'configuration' => $configuration,\n                'metadata' => $this->metadata,\n                'resource' => $resource,\n                $this->metadata->getName() => $resource,\n            ]);\n        }\n\n        return $this->createRestView($configuration, $resource);\n    }\n\n    public function indexAction(Request $request): Response\n    {\n        $configuration = $this->requestConfigurationFactory->create($this->metadata, $request);\n\n        $this->isGrantedOr403($configuration, ResourceActions::INDEX);\n        $resources = $this->resourcesCollectionProvider->get($configuration, $this->repository);\n\n        $event = $this->eventDispatcher->dispatchMultiple(ResourceActions::INDEX, $configuration, $resources);\n        $eventResponse = $event->getResponse();\n        if (null !== $eventResponse) {\n            return $eventResponse;\n        }\n\n        if ($configuration->isHtmlRequest()) {\n            return $this->render($configuration->getTemplate(ResourceActions::INDEX . '.html'), [\n                'configuration' => $configuration,\n                'metadata' => $this->metadata,\n                'resources' => $resources,\n                $this->metadata->getPluralName() => $resources,\n            ]);\n        }\n\n        return $this->createRestView($configuration, $resources);\n    }\n\n    public function createAction(Request $request): Response\n    {\n        $configuration = $this->requestConfigurationFactory->create($this->metadata, $request);\n\n        $this->isGrantedOr403($configuration, ResourceActions::CREATE);\n        $newResource = $this->newResourceFactory->create($configuration, $this->factory);\n\n        $form = $this->resourceFormFactory->create($configuration, $newResource);\n        $form->handleRequest($request);\n\n        if ($request->isMethod('POST') && $form->isSubmitted() && $form->isValid()) {\n            $newResource = $form->getData();\n\n            $event = $this->eventDispatcher->dispatchPreEvent(ResourceActions::CREATE, $configuration, $newResource);\n\n            if ($event->isStopped() && !$configuration->isHtmlRequest()) {\n                throw new HttpException($event->getErrorCode(), $event->getMessage());\n            }\n            if ($event->isStopped()) {\n                $this->flashHelper->addFlashFromEvent($configuration, $event);\n\n                $eventResponse = $event->getResponse();\n                if (null !== $eventResponse) {\n                    return $eventResponse;\n                }\n\n                return $this->redirectHandler->redirectToIndex($configuration, $newResource);\n            }\n\n            if ($configuration->hasStateMachine()) {\n                $stateMachine = $this->getStateMachine();\n                $stateMachine->apply($configuration, $newResource);\n            }\n\n            $this->repository->add($newResource);\n\n            if ($configuration->isHtmlRequest()) {\n                $this->flashHelper->addSuccessFlash($configuration, ResourceActions::CREATE, $newResource);\n            }\n\n            $postEvent = $this->eventDispatcher->dispatchPostEvent(ResourceActions::CREATE, $configuration, $newResource);\n\n            if (!$configuration->isHtmlRequest()) {\n                return $this->createRestView($configuration, $newResource, Response::HTTP_CREATED);\n            }\n\n            $postEventResponse = $postEvent->getResponse();\n            if (null !== $postEventResponse) {\n                return $postEventResponse;\n            }\n\n            return $this->redirectHandler->redirectToResource($configuration, $newResource);\n        }\n        if ($request->isMethod('POST') && $form->isSubmitted() && !$form->isValid()) {\n            $responseCode = Response::HTTP_UNPROCESSABLE_ENTITY;\n        }\n\n        if (!$configuration->isHtmlRequest()) {\n            return $this->createRestView($configuration, $form, Response::HTTP_BAD_REQUEST);\n        }\n\n        $initializeEvent = $this->eventDispatcher->dispatchInitializeEvent(ResourceActions::CREATE, $configuration, $newResource);\n        $initializeEventResponse = $initializeEvent->getResponse();\n        if (null !== $initializeEventResponse) {\n            return $initializeEventResponse;\n        }\n\n        return $this->render($configuration->getTemplate(ResourceActions::CREATE . '.html'), [\n            'configuration' => $configuration,\n            'metadata' => $this->metadata,\n            'resource' => $newResource,\n            $this->metadata->getName() => $newResource,\n            'form' => $form->createView(),\n        ], null, $responseCode ?? Response::HTTP_OK);\n    }\n\n    public function updateAction(Request $request): Response\n    {\n        $configuration = $this->requestConfigurationFactory->create($this->metadata, $request);\n\n        $this->isGrantedOr403($configuration, ResourceActions::UPDATE);\n        $resource = $this->findOr404($configuration);\n\n        $form = $this->resourceFormFactory->create($configuration, $resource);\n        $form->handleRequest($request);\n\n        if (\n            in_array($request->getMethod(), ['POST', 'PUT', 'PATCH'], true) &&\n            $form->isSubmitted() &&\n            $form->isValid()\n        ) {\n            $resource = $form->getData();\n\n            /** @var ResourceControllerEvent $event */\n            $event = $this->eventDispatcher->dispatchPreEvent(ResourceActions::UPDATE, $configuration, $resource);\n\n            if ($event->isStopped() && !$configuration->isHtmlRequest()) {\n                throw new HttpException($event->getErrorCode(), $event->getMessage());\n            }\n            if ($event->isStopped()) {\n                $this->flashHelper->addFlashFromEvent($configuration, $event);\n\n                $eventResponse = $event->getResponse();\n                if (null !== $eventResponse) {\n                    return $eventResponse;\n                }\n\n                return $this->redirectHandler->redirectToResource($configuration, $resource);\n            }\n\n            try {\n                $this->resourceUpdateHandler->handle($resource, $configuration, $this->manager);\n            } catch (UpdateHandlingException $exception) {\n                if (!$configuration->isHtmlRequest()) {\n                    return $this->createRestView($configuration, $form, $exception->getApiResponseCode());\n                }\n\n                $this->flashHelper->addErrorFlash($configuration, $exception->getFlash());\n\n                return $this->redirectHandler->redirectToReferer($configuration);\n            }\n\n            if ($configuration->isHtmlRequest()) {\n                $this->flashHelper->addSuccessFlash($configuration, ResourceActions::UPDATE, $resource);\n            }\n\n            $postEvent = $this->eventDispatcher->dispatchPostEvent(ResourceActions::UPDATE, $configuration, $resource);\n\n            if (!$configuration->isHtmlRequest()) {\n                if ($configuration->getParameters()->get('return_content', false)) {\n                    return $this->createRestView($configuration, $resource, Response::HTTP_OK);\n                }\n\n                return $this->createRestView($configuration, null, Response::HTTP_NO_CONTENT);\n            }\n\n            $postEventResponse = $postEvent->getResponse();\n            if (null !== $postEventResponse) {\n                return $postEventResponse;\n            }\n\n            return $this->redirectHandler->redirectToResource($configuration, $resource);\n        }\n        if (in_array($request->getMethod(), ['POST', 'PUT', 'PATCH'], true) && $form->isSubmitted() && !$form->isValid()) {\n            $responseCode = Response::HTTP_UNPROCESSABLE_ENTITY;\n        }\n\n        if (!$configuration->isHtmlRequest()) {\n            return $this->createRestView($configuration, $form, Response::HTTP_BAD_REQUEST);\n        }\n\n        $initializeEvent = $this->eventDispatcher->dispatchInitializeEvent(ResourceActions::UPDATE, $configuration, $resource);\n        $initializeEventResponse = $initializeEvent->getResponse();\n        if (null !== $initializeEventResponse) {\n            return $initializeEventResponse;\n        }\n\n        return $this->render($configuration->getTemplate(ResourceActions::UPDATE . '.html'), [\n            'configuration' => $configuration,\n            'metadata' => $this->metadata,\n            'resource' => $resource,\n            $this->metadata->getName() => $resource,\n            'form' => $form->createView(),\n        ], null, $responseCode ?? Response::HTTP_OK);\n    }\n\n    public function deleteAction(Request $request): Response\n    {\n        $configuration = $this->requestConfigurationFactory->create($this->metadata, $request);\n\n        $this->isGrantedOr403($configuration, ResourceActions::DELETE);\n        $resource = $this->findOr404($configuration);\n\n        if ($configuration->isCsrfProtectionEnabled() && !$this->isCsrfTokenValid((string) $resource->getId(), (string) $request->request->get('_csrf_token'))) {\n            throw new HttpException(Response::HTTP_FORBIDDEN, 'Invalid csrf token.');\n        }\n\n        $event = $this->eventDispatcher->dispatchPreEvent(ResourceActions::DELETE, $configuration, $resource);\n\n        if ($event->isStopped() && !$configuration->isHtmlRequest()) {\n            throw new HttpException($event->getErrorCode(), $event->getMessage());\n        }\n        if ($event->isStopped()) {\n            $this->flashHelper->addFlashFromEvent($configuration, $event);\n\n            $eventResponse = $event->getResponse();\n            if (null !== $eventResponse) {\n                return $eventResponse;\n            }\n\n            return $this->redirectHandler->redirectToIndex($configuration, $resource);\n        }\n\n        try {\n            $this->resourceDeleteHandler->handle($resource, $this->repository);\n        } catch (DeleteHandlingException $exception) {\n            if (!$configuration->isHtmlRequest()) {\n                return $this->createRestView($configuration, null, $exception->getApiResponseCode());\n            }\n\n            $this->flashHelper->addErrorFlash($configuration, $exception->getFlash());\n\n            return $this->redirectHandler->redirectToReferer($configuration);\n        }\n\n        if ($configuration->isHtmlRequest()) {\n            $this->flashHelper->addSuccessFlash($configuration, ResourceActions::DELETE, $resource);\n        }\n\n        $postEvent = $this->eventDispatcher->dispatchPostEvent(ResourceActions::DELETE, $configuration, $resource);\n\n        if (!$configuration->isHtmlRequest()) {\n            return $this->createRestView($configuration, null, Response::HTTP_NO_CONTENT);\n        }\n\n        $postEventResponse = $postEvent->getResponse();\n        if (null !== $postEventResponse) {\n            return $postEventResponse;\n        }\n\n        return $this->redirectHandler->redirectToIndex($configuration, $resource);\n    }\n\n    public function bulkDeleteAction(Request $request): Response\n    {\n        $configuration = $this->requestConfigurationFactory->create($this->metadata, $request);\n\n        $this->isGrantedOr403($configuration, ResourceActions::BULK_DELETE);\n        $resources = $this->resourcesCollectionProvider->get($configuration, $this->repository);\n\n        if (\n            $configuration->isCsrfProtectionEnabled() &&\n            !$this->isCsrfTokenValid(ResourceActions::BULK_DELETE, (string) $request->request->get('_csrf_token'))\n        ) {\n            throw new HttpException(Response::HTTP_FORBIDDEN, 'Invalid csrf token.');\n        }\n\n        $this->eventDispatcher->dispatchMultiple(ResourceActions::BULK_DELETE, $configuration, $resources);\n\n        foreach ($resources as $resource) {\n            $event = $this->eventDispatcher->dispatchPreEvent(ResourceActions::DELETE, $configuration, $resource);\n\n            if ($event->isStopped() && !$configuration->isHtmlRequest()) {\n                throw new HttpException($event->getErrorCode(), $event->getMessage());\n            }\n            if ($event->isStopped()) {\n                $this->flashHelper->addFlashFromEvent($configuration, $event);\n\n                $eventResponse = $event->getResponse();\n                if (null !== $eventResponse) {\n                    return $eventResponse;\n                }\n\n                return $this->redirectHandler->redirectToIndex($configuration, $resource);\n            }\n\n            try {\n                $this->resourceDeleteHandler->handle($resource, $this->repository);\n            } catch (DeleteHandlingException $exception) {\n                if (!$configuration->isHtmlRequest()) {\n                    return $this->createRestView($configuration, null, $exception->getApiResponseCode());\n                }\n\n                $this->flashHelper->addErrorFlash($configuration, $exception->getFlash());\n\n                return $this->redirectHandler->redirectToReferer($configuration);\n            }\n\n            $postEvent = $this->eventDispatcher->dispatchPostEvent(ResourceActions::DELETE, $configuration, $resource);\n        }\n\n        if (!$configuration->isHtmlRequest()) {\n            return $this->createRestView($configuration, null, Response::HTTP_NO_CONTENT);\n        }\n\n        $this->flashHelper->addSuccessFlash($configuration, ResourceActions::BULK_DELETE);\n\n        if (isset($postEvent)) {\n            $postEventResponse = $postEvent->getResponse();\n            if (null !== $postEventResponse) {\n                return $postEventResponse;\n            }\n        }\n\n        return $this->redirectHandler->redirectToIndex($configuration);\n    }\n\n    public function applyStateMachineTransitionAction(Request $request): Response\n    {\n        $stateMachine = $this->getStateMachine();\n        $configuration = $this->requestConfigurationFactory->create($this->metadata, $request);\n\n        $this->isGrantedOr403($configuration, ResourceActions::UPDATE);\n        $resource = $this->findOr404($configuration);\n\n        if ($configuration->isCsrfProtectionEnabled() && !$this->isCsrfTokenValid((string) $resource->getId(), $this->getFromRequest($request, '_csrf_token'))) {\n            throw new HttpException(Response::HTTP_FORBIDDEN, 'Invalid CSRF token.');\n        }\n\n        $event = $this->eventDispatcher->dispatchPreEvent(ResourceActions::UPDATE, $configuration, $resource);\n\n        if ($event->isStopped() && !$configuration->isHtmlRequest()) {\n            throw new HttpException($event->getErrorCode(), $event->getMessage());\n        }\n        if ($event->isStopped()) {\n            $this->flashHelper->addFlashFromEvent($configuration, $event);\n\n            $eventResponse = $event->getResponse();\n            if (null !== $eventResponse) {\n                return $eventResponse;\n            }\n\n            return $this->redirectHandler->redirectToResource($configuration, $resource);\n        }\n\n        if (!$stateMachine->can($configuration, $resource)) {\n            throw new BadRequestHttpException();\n        }\n\n        try {\n            $this->resourceUpdateHandler->handle($resource, $configuration, $this->manager);\n        } catch (UpdateHandlingException $exception) {\n            if (!$configuration->isHtmlRequest()) {\n                return $this->createRestView($configuration, $resource, $exception->getApiResponseCode());\n            }\n\n            $this->flashHelper->addErrorFlash($configuration, $exception->getFlash());\n\n            return $this->redirectHandler->redirectToReferer($configuration);\n        }\n\n        if ($configuration->isHtmlRequest()) {\n            $this->flashHelper->addSuccessFlash($configuration, ResourceActions::UPDATE, $resource);\n        }\n\n        $postEvent = $this->eventDispatcher->dispatchPostEvent(ResourceActions::UPDATE, $configuration, $resource);\n\n        if (!$configuration->isHtmlRequest()) {\n            if ($configuration->getParameters()->get('return_content', true)) {\n                return $this->createRestView($configuration, $resource, Response::HTTP_OK);\n            }\n\n            return $this->createRestView($configuration, null, Response::HTTP_NO_CONTENT);\n        }\n\n        $postEventResponse = $postEvent->getResponse();\n        if (null !== $postEventResponse) {\n            return $postEventResponse;\n        }\n\n        return $this->redirectHandler->redirectToResource($configuration, $resource);\n    }\n\n    /**\n     * @return mixed\n     */\n    protected function getParameter(string $name)\n    {\n        if (!$this->container instanceof ContainerInterface) {\n            throw new \\RuntimeException(sprintf(\n                'Container passed to \"%s\" has to implements \"%s\".',\n                self::class,\n                ContainerInterface::class,\n            ));\n        }\n\n        return $this->container->getParameter($name);\n    }\n\n    /**\n     * @throws AccessDeniedException\n     */\n    protected function isGrantedOr403(RequestConfiguration $configuration, string $permission): void\n    {\n        if (!$configuration->hasPermission()) {\n            return;\n        }\n\n        $permission = $configuration->getPermission($permission);\n\n        if (!$this->authorizationChecker->isGranted($configuration, $permission)) {\n            throw new AccessDeniedException();\n        }\n    }\n\n    /**\n     * @throws NotFoundHttpException\n     */\n    protected function findOr404(RequestConfiguration $configuration): ResourceInterface\n    {\n        if (null === $resource = $this->singleResourceProvider->get($configuration, $this->repository)) {\n            throw new NotFoundHttpException(sprintf('The \"%s\" has not been found', $this->metadata->getHumanizedName()));\n        }\n\n        return $resource;\n    }\n\n    /**\n     * @param mixed $data\n     */\n    protected function createRestView(RequestConfiguration $configuration, $data, ?int $statusCode = null): Response\n    {\n        if (!class_exists(View::class) || null === $this->viewHandler) {\n            throw new LogicException('You can not use the \"non-html\" request if FriendsOfSymfony Rest Bundle is not available. Try running \"composer require friendsofsymfony/rest-bundle\".');\n        }\n\n        $view = View::create($data, $statusCode);\n\n        return $this->viewHandler->handle($configuration, $view);\n    }\n\n    protected function getStateMachine(): StateMachineInterface\n    {\n        if (null === $this->stateMachine) {\n            throw new LogicException('You can not use the \"state-machine\" if Winzou State Machine Bundle is not available. Try running \"composer require winzou/state-machine-bundle\".');\n        }\n\n        return $this->stateMachine;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ResourceDeleteHandler.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\nfinal class ResourceDeleteHandler implements ResourceDeleteHandlerInterface\n{\n    public function handle(ResourceInterface $resource, RepositoryInterface $repository): void\n    {\n        $repository->remove($resource);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ResourceDeleteHandlerInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\ninterface ResourceDeleteHandlerInterface\n{\n    public function handle(ResourceInterface $resource, RepositoryInterface $repository): void;\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ResourceFormFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\Form\\FormFactoryInterface;\nuse Symfony\\Component\\Form\\FormInterface;\n\nfinal class ResourceFormFactory implements ResourceFormFactoryInterface\n{\n    private FormFactoryInterface $formFactory;\n\n    public function __construct(FormFactoryInterface $formFactory)\n    {\n        $this->formFactory = $formFactory;\n    }\n\n    public function create(RequestConfiguration $requestConfiguration, ResourceInterface $resource): FormInterface\n    {\n        $formType = (string) $requestConfiguration->getFormType();\n        $formOptions = $requestConfiguration->getFormOptions();\n\n        if ($requestConfiguration->isHtmlRequest()) {\n            return $this->formFactory->create($formType, $resource, $formOptions);\n        }\n\n        return $this->formFactory->createNamed('', $formType, $resource, array_merge($formOptions, ['csrf_protection' => false]));\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ResourceFormFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\Form\\FormInterface;\n\ninterface ResourceFormFactoryInterface\n{\n    public function create(RequestConfiguration $requestConfiguration, ResourceInterface $resource): FormInterface;\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ResourceUpdateHandler.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Doctrine\\Persistence\\ObjectManager;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\nfinal class ResourceUpdateHandler implements ResourceUpdateHandlerInterface\n{\n    private ?StateMachineInterface $stateMachine;\n\n    public function __construct(?StateMachineInterface $stateMachine)\n    {\n        $this->stateMachine = $stateMachine;\n    }\n\n    public function handle(\n        ResourceInterface $resource,\n        RequestConfiguration $requestConfiguration,\n        ObjectManager $manager,\n    ): void {\n        if (null !== $this->stateMachine && $requestConfiguration->hasStateMachine()) {\n            $this->stateMachine->apply($requestConfiguration, $resource);\n        }\n\n        $manager->flush();\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ResourceUpdateHandlerInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Doctrine\\Persistence\\ObjectManager;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\ninterface ResourceUpdateHandlerInterface\n{\n    public function handle(\n        ResourceInterface $resource,\n        RequestConfiguration $requestConfiguration,\n        ObjectManager $manager,\n    ): void;\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ResourcesCollectionProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Hateoas\\Configuration\\Route;\nuse Hateoas\\Representation\\Factory\\PagerfantaFactory;\nuse Pagerfanta\\Pagerfanta;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridView;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\n\nfinal class ResourcesCollectionProvider implements ResourcesCollectionProviderInterface\n{\n    public function __construct(\n        private ResourcesResolverInterface $resourcesResolver,\n        private ?PagerfantaFactory $pagerfantaRepresentationFactory = null,\n    ) {\n    }\n\n    /**\n     * @psalm-suppress MissingReturnType\n     */\n    public function get(RequestConfiguration $requestConfiguration, RepositoryInterface $repository)\n    {\n        $resources = $this->resourcesResolver->getResources($requestConfiguration, $repository);\n        $paginationLimits = [];\n\n        if ($resources instanceof ResourceGridView) {\n            $paginator = $resources->getData();\n            $paginationLimits = $resources->getDefinition()->getLimits();\n        } else {\n            $paginator = $resources;\n        }\n\n        if ($paginator instanceof Pagerfanta) {\n            $request = $requestConfiguration->getRequest();\n\n            $paginator->setMaxPerPage($this->resolveMaxPerPage(\n                $request->query->has('limit') ? $request->query->getInt('limit') : null,\n                $requestConfiguration->getPaginationMaxPerPage(),\n                $paginationLimits,\n            ));\n            $currentPage = (int) $request->query->get('page', '1');\n            $paginator->setCurrentPage($currentPage);\n\n            // This prevents Pagerfanta from querying database from a template\n            $paginator->getCurrentPageResults();\n\n            if (!$requestConfiguration->isHtmlRequest()) {\n                if (null === $this->pagerfantaRepresentationFactory) {\n                    throw new \\LogicException('The \"willdurand/hateoas-bundle\" must be installed and configured to render a resource collection on non-HTML request. Try running \"composer require willdurand/hateoas-bundle\"');\n                }\n\n                $route = new Route($request->attributes->get('_route'), array_merge($request->attributes->get('_route_params'), $request->query->all()));\n\n                return $this->pagerfantaRepresentationFactory->createRepresentation($paginator, $route);\n            }\n        }\n\n        return $resources;\n    }\n\n    /**\n     * @param int[] $gridLimits\n     */\n    private function resolveMaxPerPage(?int $requestLimit, int $configurationLimit, array $gridLimits = []): int\n    {\n        if (null === $requestLimit) {\n            return reset($gridLimits) ?: $configurationLimit;\n        }\n\n        if (!empty($gridLimits)) {\n            $maxGridLimit = max($gridLimits);\n\n            return $requestLimit > $maxGridLimit ? $maxGridLimit : $requestLimit;\n        }\n\n        return $requestLimit;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ResourcesCollectionProviderInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\n\ninterface ResourcesCollectionProviderInterface\n{\n    /** @psalm-suppress MissingReturnType */\n    public function get(RequestConfiguration $requestConfiguration, RepositoryInterface $repository);\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ResourcesResolver.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\n\nfinal class ResourcesResolver implements ResourcesResolverInterface\n{\n    /**\n     * @psalm-suppress MissingReturnType\n     */\n    public function getResources(RequestConfiguration $requestConfiguration, RepositoryInterface $repository)\n    {\n        $method = $requestConfiguration->getRepositoryMethod();\n        if (null !== $method) {\n            if (is_array($method) && 2 === count($method)) {\n                $repository = $method[0];\n                $method = $method[1];\n            }\n\n            $arguments = array_values($requestConfiguration->getRepositoryArguments());\n\n            return $repository->$method(...$arguments);\n        }\n\n        $criteria = [];\n        if ($requestConfiguration->isFilterable()) {\n            $criteria = $requestConfiguration->getCriteria();\n        }\n\n        $sorting = [];\n        if ($requestConfiguration->isSortable()) {\n            $sorting = $requestConfiguration->getSorting();\n        }\n\n        if ($requestConfiguration->isPaginated()) {\n            return $repository->createPaginator($criteria, $sorting);\n        }\n\n        return $repository->findBy($criteria, $sorting, $requestConfiguration->getLimit());\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ResourcesResolverInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\n\ninterface ResourcesResolverInterface\n{\n    /** @psalm-suppress MissingReturnType */\n    public function getResources(RequestConfiguration $requestConfiguration, RepositoryInterface $repository);\n}\n"
  },
  {
    "path": "src/Bundle/Controller/SingleResourceProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\nfinal class SingleResourceProvider implements SingleResourceProviderInterface\n{\n    public function get(RequestConfiguration $requestConfiguration, RepositoryInterface $repository): ?ResourceInterface\n    {\n        $method = $requestConfiguration->getRepositoryMethod();\n        if (null !== $method) {\n            if (is_array($method) && 2 === count($method)) {\n                $repository = $method[0];\n                $method = $method[1];\n            }\n\n            $arguments = array_values($requestConfiguration->getRepositoryArguments());\n\n            return $repository->$method(...$arguments);\n        }\n\n        $criteria = [];\n        $request = $requestConfiguration->getRequest();\n\n        if ($request->attributes->has('id')) {\n            /** @var ResourceInterface|null $resource */\n            $resource = $repository->find($request->attributes->get('id'));\n\n            return $resource;\n        }\n\n        if ($request->attributes->has('slug')) {\n            $criteria = ['slug' => $request->attributes->get('slug')];\n        }\n\n        $criteria = array_merge($criteria, $requestConfiguration->getCriteria());\n\n        /** @var ResourceInterface|null $resource */\n        $resource = $repository->findOneBy($criteria);\n\n        return $resource;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/SingleResourceProviderInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\ninterface SingleResourceProviderInterface\n{\n    public function get(RequestConfiguration $requestConfiguration, RepositoryInterface $repository): ?ResourceInterface;\n}\n"
  },
  {
    "path": "src/Bundle/Controller/StateMachine.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse SM\\Factory\\FactoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\nfinal class StateMachine implements StateMachineInterface\n{\n    private FactoryInterface $stateMachineFactory;\n\n    public function __construct(FactoryInterface $stateMachineFactory)\n    {\n        $this->stateMachineFactory = $stateMachineFactory;\n    }\n\n    public function can(RequestConfiguration $configuration, ResourceInterface $resource): bool\n    {\n        if (!$configuration->hasStateMachine()) {\n            throw new \\InvalidArgumentException('State machine must be configured to apply transition, check your routing.');\n        }\n\n        $graph = $configuration->getStateMachineGraph() ?? 'default';\n\n        /** @var string $transition */\n        $transition = $configuration->getStateMachineTransition();\n\n        return $this->stateMachineFactory->get($resource, $graph)->can($transition);\n    }\n\n    public function apply(RequestConfiguration $configuration, ResourceInterface $resource): void\n    {\n        if (!$configuration->hasStateMachine()) {\n            throw new \\InvalidArgumentException('State machine must be configured to apply transition, check your routing.');\n        }\n\n        $graph = $configuration->getStateMachineGraph() ?? 'default';\n\n        /** @var string $transition */\n        $transition = $configuration->getStateMachineTransition();\n\n        $this->stateMachineFactory->get($resource, $graph)->apply($transition);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/StateMachineInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\ninterface StateMachineInterface\n{\n    public function can(RequestConfiguration $configuration, ResourceInterface $resource): bool;\n\n    public function apply(RequestConfiguration $configuration, ResourceInterface $resource): void;\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ViewHandler.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse FOS\\RestBundle\\View\\ConfigurableViewHandlerInterface;\nuse FOS\\RestBundle\\View\\View;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nfinal class ViewHandler implements ViewHandlerInterface\n{\n    public function __construct(private ConfigurableViewHandlerInterface $restViewHandler)\n    {\n    }\n\n    public function handle(RequestConfiguration $requestConfiguration, View $view): Response\n    {\n        if (!$requestConfiguration->isHtmlRequest()) {\n            $this->restViewHandler->setExclusionStrategyGroups($requestConfiguration->getSerializationGroups() ?? []);\n\n            $version = $requestConfiguration->getSerializationVersion();\n            if (null !== $version) {\n                $this->restViewHandler->setExclusionStrategyVersion($version);\n            }\n\n            $view->getContext()->enableMaxDepth();\n        }\n\n        return $this->restViewHandler->handle($view);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Controller/ViewHandlerInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse FOS\\RestBundle\\View\\View;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\ninterface ViewHandlerInterface\n{\n    public function handle(RequestConfiguration $requestConfiguration, View $view): Response;\n}\n"
  },
  {
    "path": "src/Bundle/Controller/Workflow.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Controller;\n\nuse Sylius\\Resource\\Exception\\RuntimeException;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\Workflow\\Registry;\nuse Webmozart\\Assert\\Assert;\n\nif (!class_exists(Registry::class)) {\n    throw new RuntimeException(sprintf('Cannot use the \"%s\" class when the \"symfony/workflow\" package is not installed.', Workflow::class));\n}\n\nfinal class Workflow implements StateMachineInterface\n{\n    /** @var Registry */\n    private $registry;\n\n    public function __construct(Registry $registry)\n    {\n        $this->registry = $registry;\n    }\n\n    /**\n     * @inheritdoc\n     */\n    public function can(RequestConfiguration $configuration, ResourceInterface $resource): bool\n    {\n        Assert::true($configuration->hasStateMachine(), 'State machine must be configured to apply transition, check your routing.');\n\n        $graph = $configuration->getStateMachineGraph();\n\n        /** @var string $transitionName */\n        $transitionName = $configuration->getStateMachineTransition();\n\n        return $this->registry->get($resource, $graph)->can($resource, $transitionName);\n    }\n\n    /**\n     * @inheritdoc\n     */\n    public function apply(RequestConfiguration $configuration, ResourceInterface $resource): void\n    {\n        Assert::true($configuration->hasStateMachine(), 'State machine must be configured to apply transition, check your routing.');\n\n        $graph = $configuration->getStateMachineGraph();\n\n        /** @var string $transitionName */\n        $transitionName = $configuration->getStateMachineTransition();\n\n        $this->registry->get($resource, $graph)->apply($resource, $transitionName);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/CsrfTokenManagerPass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler;\n\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\n\n/**\n * TODO Remove on sylius/resource-bundle 2.0\n */\nfinal class CsrfTokenManagerPass implements CompilerPassInterface\n{\n    public function process(ContainerBuilder $container): void\n    {\n        if (!$container->hasDefinition('security.csrf.token_manager')) {\n            return;\n        }\n\n        $csrdTokenManagerDefinition = $container->getDefinition('security.csrf.token_manager');\n        $csrdTokenManagerDefinition->setPublic(true);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/DoctrineContainerRepositoryFactoryPass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler;\n\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Doctrine\\DoctrineORMDriver;\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\n\n/**\n * Resolves given target entities with container parameters.\n * Usable only with *doctrine/orm* driver.\n */\nfinal class DoctrineContainerRepositoryFactoryPass implements CompilerPassInterface\n{\n    public function process(ContainerBuilder $container): void\n    {\n        if (!$container->hasParameter(DoctrineORMDriver::GENERIC_ENTITIES_PARAMETER)) {\n            $container->setParameter(DoctrineORMDriver::GENERIC_ENTITIES_PARAMETER, []);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/DoctrineTargetEntitiesResolverPass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler;\n\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\Helper\\TargetEntitiesResolverInterface;\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException;\n\n/**\n * Resolves given target entities with container parameters.\n * Usable only with *doctrine/orm* driver.\n */\nfinal class DoctrineTargetEntitiesResolverPass implements CompilerPassInterface\n{\n    private TargetEntitiesResolverInterface $targetEntitiesResolver;\n\n    public function __construct(TargetEntitiesResolverInterface $targetEntitiesResolver)\n    {\n        $this->targetEntitiesResolver = $targetEntitiesResolver;\n    }\n\n    public function process(ContainerBuilder $container): void\n    {\n        try {\n            /** @var array $resources */\n            $resources = $container->getParameter('sylius.resources');\n            $resolveTargetEntityListener = $container->findDefinition('doctrine.orm.listeners.resolve_target_entity');\n        } catch (InvalidArgumentException $exception) {\n            return;\n        }\n\n        $interfaces = $this->targetEntitiesResolver->resolve($resources);\n        foreach ($interfaces as $interface => $model) {\n            $resolveTargetEntityListener->addMethodCall('addResolveTargetEntity', [$interface, $model, []]);\n        }\n\n        if (!$resolveTargetEntityListener->hasTag('doctrine.event_listener')) {\n            $resolveTargetEntityListener->addTag('doctrine.event_listener', ['event' => 'loadClassMetadata']);\n            $resolveTargetEntityListener->addTag('doctrine.event_listener', ['event' => 'onClassMetadataNotFound']);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/Helper/TargetEntitiesResolver.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\Helper;\n\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\nfinal class TargetEntitiesResolver implements TargetEntitiesResolverInterface\n{\n    public function resolve(array $resourcesConfiguration): array\n    {\n        $interfaces = [];\n\n        foreach ($resourcesConfiguration as $alias => $configuration) {\n            $model = $this->getModel($alias, $configuration);\n\n            $modelInterfaces = class_implements($model) ?: [];\n\n            foreach ($modelInterfaces as $interface) {\n                if ($interface === ResourceInterface::class) {\n                    continue;\n                }\n\n                if (isset($interfaces[$interface]) && in_array($model, $interfaces[$interface], true)) {\n                    continue;\n                }\n\n                $interfaces[$interface][] = $model;\n            }\n        }\n\n        $interfaces = array_filter($interfaces, static function (array $classes): bool {\n            return count($classes) === 1;\n        });\n\n        $interfaces = array_map(static function (array $classes): string {\n            return current($classes);\n        }, $interfaces);\n\n        foreach ($resourcesConfiguration as $alias => $configuration) {\n            if (isset($configuration['classes']['interface'])) {\n                $model = $this->getModel($alias, $configuration);\n                $interface = $configuration['classes']['interface'];\n\n                trigger_deprecation(\n                    'sylius/resource-bundle',\n                    '1.6',\n                    'Specifying the interface for resources is deprecated and will be removed in 2.0. Please rely on auto-discovering interfaces instead. Triggered by resource \"%s\" with model \"%s\" and interface \"%s\".',\n                    $alias,\n                    $model,\n                    $interface,\n                );\n\n                $interfaces[$interface] = $model;\n            }\n        }\n\n        return $interfaces;\n    }\n\n    private function getModel(string $alias, array $configuration): string\n    {\n        if (!isset($configuration['classes']['model'])) {\n            throw new \\InvalidArgumentException(sprintf('Could not get model class from resource \"%s\".', $alias));\n        }\n\n        return $configuration['classes']['model'];\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/Helper/TargetEntitiesResolverInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\Helper;\n\ninterface TargetEntitiesResolverInterface\n{\n    /**\n     * @return array Interface to class map.\n     */\n    public function resolve(array $resourcesConfiguration): array;\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/PagerfantaBridgePass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler;\n\nuse Symfony\\Component\\DependencyInjection\\Alias;\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\n\n/**\n * Compiler pass to bridge the configuration from WhiteOctoberPagerfantaBundle to BabDevPagerfantaBundle\n *\n * @internal\n */\nfinal class PagerfantaBridgePass implements CompilerPassInterface\n{\n    public function __construct(private bool $internalUse = false)\n    {\n    }\n\n    public function process(ContainerBuilder $container): void\n    {\n        if (false === $this->internalUse) {\n            trigger_deprecation(\n                'sylius/resource-bundle',\n                '1.7',\n                'The \"%s\" class is deprecated. Migrate your Pagerfanta configuration from WhiteOctoberPagerfantaBundle to BabDevPagerfantaBundle, the configuration bridge will be removed in 2.0.',\n                self::class,\n            );\n        }\n\n        $this->changeViewFactoryClass($container);\n        $this->aliasRenamedServices($container);\n    }\n\n    private function changeViewFactoryClass(ContainerBuilder $container): void\n    {\n        if (!$container->hasParameter('white_october_pagerfanta.view_factory.class') || !$container->hasDefinition('pagerfanta.view_factory')) {\n            return;\n        }\n\n        /** @var string $viewFactoryClass */\n        $viewFactoryClass = $container->getParameter('white_october_pagerfanta.view_factory.class');\n\n        $container->getDefinition('pagerfanta.view_factory')\n            ->setClass($viewFactoryClass)\n        ;\n    }\n\n    private function aliasRenamedServices(ContainerBuilder $container): void\n    {\n        $setDeprecatedMethod = (new \\ReflectionClass(Alias::class))->getMethod('setDeprecated');\n\n        if ($container->hasDefinition('pagerfanta.twig_extension')) {\n            if (2 === $setDeprecatedMethod->getNumberOfParameters()) {\n                $container->setAlias('twig.extension.pagerfanta', 'pagerfanta.twig_extension')\n                    ->setDeprecated(true, 'The \"%alias_id%\" service alias is deprecated since Sylius 1.8, use the \"pagerfanta.twig_extension\" service ID instead.')\n                ;\n            } else {\n                $container->setAlias('twig.extension.pagerfanta', 'pagerfanta.twig_extension')\n                    ->setDeprecated('sylius/resource-bundle', '1.8', 'The \"%alias_id%\" service alias is deprecated since Sylius 1.8, use the \"pagerfanta.twig_extension\" service ID instead.')\n                ;\n            }\n        }\n\n        if ($container->hasDefinition('pagerfanta.view_factory')) {\n            if (2 === $setDeprecatedMethod->getNumberOfParameters()) {\n                $container->setAlias('white_october_pagerfanta.view_factory', 'pagerfanta.view_factory')\n                    ->setDeprecated(true, 'The \"%alias_id%\" service alias is deprecated since Sylius 1.8, use the \"pagerfanta.view_factory\" service ID instead.')\n                ;\n            } else {\n                $container->setAlias('white_october_pagerfanta.view_factory', 'pagerfanta.view_factory')\n                    ->setDeprecated('sylius/resource-bundle', '1.8', 'The \"%alias_id%\" service alias is deprecated since Sylius 1.8, use the \"pagerfanta.view_factory\" service ID instead.')\n                ;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/PrioritizedCompositeServicePass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler;\n\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Definition;\nuse Symfony\\Component\\DependencyInjection\\Reference;\n\nabstract class PrioritizedCompositeServicePass implements CompilerPassInterface\n{\n    private string $serviceId;\n\n    private string $compositeId;\n\n    private string $tagName;\n\n    private string $methodName;\n\n    public function __construct(string $serviceId, string $compositeId, string $tagName, string $methodName)\n    {\n        $this->serviceId = $serviceId;\n        $this->compositeId = $compositeId;\n        $this->tagName = $tagName;\n        $this->methodName = $methodName;\n    }\n\n    public function process(ContainerBuilder $container): void\n    {\n        if (!$container->has($this->compositeId)) {\n            return;\n        }\n\n        $this->injectTaggedServicesIntoComposite($container);\n        $this->addAliasForCompositeIfServiceDoesNotExist($container);\n    }\n\n    private function injectTaggedServicesIntoComposite(ContainerBuilder $container): void\n    {\n        $contextDefinition = $container->findDefinition($this->compositeId);\n\n        $taggedServices = $container->findTaggedServiceIds($this->tagName);\n        foreach ($taggedServices as $id => $tags) {\n            $this->addMethodCalls($contextDefinition, $id, $tags);\n        }\n    }\n\n    private function addAliasForCompositeIfServiceDoesNotExist(ContainerBuilder $container): void\n    {\n        if ($container->has($this->serviceId)) {\n            return;\n        }\n\n        $container->setAlias($this->serviceId, $this->compositeId)->setPublic(true);\n    }\n\n    private function addMethodCalls(Definition $contextDefinition, string $id, array $tags): void\n    {\n        foreach ($tags as $attributes) {\n            $this->addMethodCall($contextDefinition, $id, $attributes);\n        }\n    }\n\n    private function addMethodCall(Definition $contextDefinition, string $id, array $attributes): void\n    {\n        $contextDefinition->addMethodCall($this->methodName, [new Reference($id), $attributes['priority'] ?? 0]);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/RegisterFormBuilderPass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler;\n\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Reference;\n\nfinal class RegisterFormBuilderPass implements CompilerPassInterface\n{\n    public function process(ContainerBuilder $container): void\n    {\n        if (!$container->hasDefinition('sylius.registry.form_builder')) {\n            return;\n        }\n\n        $registry = $container->findDefinition('sylius.registry.form_builder');\n\n        foreach ($container->findTaggedServiceIds('sylius.default_resource_form.builder') as $id => $attributes) {\n            foreach ($attributes as $attribute) {\n                if (!isset($attribute['type'])) {\n                    throw new \\InvalidArgumentException('Tagged grid drivers needs to have \"type\" attribute.');\n                }\n\n                $registry->addMethodCall('register', [$attribute['type'], new Reference($id)]);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/RegisterFqcnControllersPass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler;\n\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceController;\nuse Sylius\\Resource\\Metadata\\Metadata;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException;\n\n/** @internal */\nfinal class RegisterFqcnControllersPass implements CompilerPassInterface\n{\n    public function process(ContainerBuilder $container): void\n    {\n        try {\n            /** @var array $resources */\n            $resources = $container->getParameter('sylius.resources');\n        } catch (InvalidArgumentException $exception) {\n            return;\n        }\n\n        foreach ($resources as $alias => $configuration) {\n            $metadata = Metadata::fromAliasAndConfiguration($alias, $configuration);\n\n            if (!$metadata->hasClass('controller')) {\n                continue;\n            }\n\n            $this->validateSyliusResource($metadata->getClass('model'));\n            $controllerFqcn = $metadata->getClass('controller');\n\n            if ($controllerFqcn !== ResourceController::class) {\n                $definition = $container->getDefinition($metadata->getServiceId('controller'));\n\n                // TODO: Change to alias definition after bumping to > Symfony 5.1\n                $container->setDefinition($metadata->getClass('controller'), $definition);\n            }\n        }\n    }\n\n    private function validateSyliusResource(string $class): void\n    {\n        if (!in_array(ResourceInterface::class, class_implements($class) ?: [], true)) {\n            throw new InvalidArgumentException(sprintf(\n                'Class \"%s\" must implement \"%s\" to be registered as a Sylius resource.',\n                $class,\n                ResourceInterface::class,\n            ));\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/RegisterResourceRepositoryPass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler;\n\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Reference;\n\nfinal class RegisterResourceRepositoryPass implements CompilerPassInterface\n{\n    public function process(ContainerBuilder $container): void\n    {\n        if (!$container->hasParameter('sylius.resources') || !$container->has('sylius.registry.resource_repository')) {\n            return;\n        }\n\n        /** @var array $resources */\n        $resources = $container->getParameter('sylius.resources');\n\n        $repositoryRegistry = $container->findDefinition('sylius.registry.resource_repository');\n\n        foreach ($resources as $alias => $configuration) {\n            [$applicationName, $resourceName] = explode('.', $alias, 2);\n            $repositoryId = sprintf('%s.repository.%s', $applicationName, $resourceName);\n\n            if ($container->has($repositoryId)) {\n                $repositoryRegistry->addMethodCall('register', [$alias, new Reference($repositoryId)]);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/RegisterResourceStateMachinePass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler;\n\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\n\nfinal class RegisterResourceStateMachinePass implements CompilerPassInterface\n{\n    public function process(ContainerBuilder $container): void\n    {\n        if (!$container->hasParameter('sylius.resources')) {\n            return;\n        }\n\n        /** @var array $resources */\n        $resources = $container->getParameter('sylius.resources');\n\n        foreach ($resources as $alias => $configuration) {\n            [$applicationName, $resourceName] = explode('.', $alias, 2);\n            $stateMachineId = sprintf('%s.controller_state_machine.%s', $applicationName, $resourceName);\n\n            $stateMachineComponent = $configuration['state_machine_component'] ?? null;\n\n            if (null === $stateMachineComponent) {\n                $container->setAlias($stateMachineId, 'sylius.resource_controller.state_machine');\n\n                continue;\n            }\n\n            $specificStateMachineId = sprintf('sylius.resource_controller.state_machine.%s', $stateMachineComponent);\n\n            if (!$container->hasDefinition($specificStateMachineId)) {\n                throw new \\LogicException(sprintf('State machine \"%s\" is not available.', $stateMachineComponent));\n            }\n\n            $container->setAlias($stateMachineId, $specificStateMachineId);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/RegisterResourcesPass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler;\n\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException;\n\nfinal class RegisterResourcesPass implements CompilerPassInterface\n{\n    public function process(ContainerBuilder $container): void\n    {\n        try {\n            /** @var array $resources */\n            $resources = $container->getParameter('sylius.resources');\n            $registry = $container->findDefinition('sylius.resource_registry');\n        } catch (InvalidArgumentException $exception) {\n            return;\n        }\n\n        foreach ($resources as $alias => $configuration) {\n            $this->validateSyliusResource($configuration['classes']['model']);\n            $registry->addMethodCall('addFromAliasAndConfiguration', [$alias, $configuration]);\n        }\n    }\n\n    private function validateSyliusResource(string $class): void\n    {\n        /** @var array $interfaces */\n        $interfaces = class_implements($class);\n\n        if (!in_array(ResourceInterface::class, $interfaces, true)) {\n            throw new InvalidArgumentException(sprintf(\n                'Class \"%s\" must implement \"%s\" to be registered as a Sylius resource.',\n                $class,\n                ResourceInterface::class,\n            ));\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/RegisterStateMachinePass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler;\n\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\StateMachine;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\Workflow;\nuse Sylius\\Bundle\\ResourceBundle\\ResourceBundleInterface;\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Reference;\nuse Symfony\\Component\\Workflow\\Workflow as SymfonyWorkflow;\nuse winzou\\Bundle\\StateMachineBundle\\winzouStateMachineBundle;\n\nfinal class RegisterStateMachinePass implements CompilerPassInterface\n{\n    /**\n     * @inheritdoc\n     */\n    public function process(ContainerBuilder $container): void\n    {\n        /** @var array $settings */\n        $settings = $container->getParameter('sylius.resource.settings');\n        $stateMachine = $settings['state_machine_component'];\n        $container->setParameter('sylius.state_machine_component.default', null);\n\n        $this->registerWinzouStateMachine($container);\n        $this->registerSymfonyWorkflowStateMachine($container);\n\n        $this->registerWinzouStateMachine($container);\n        $this->registerSymfonyWorkflowStateMachine($container);\n\n        if (null !== $stateMachine) {\n            $this->setStateMachine($container, $stateMachine);\n\n            return;\n        }\n\n        // No state machine enabled\n        if (\n            !$this->isSymfonyWorkflowEnabled($container) &&\n            !$this->isWinzouStateMachineEnabled($container)\n        ) {\n            return;\n        }\n\n        if ($this->isWinzouStateMachineEnabled($container)) {\n            $this->setStateMachine($container, ResourceBundleInterface::STATE_MACHINE_WINZOU);\n\n            return;\n        }\n\n        $this->setStateMachine($container, ResourceBundleInterface::STATE_MACHINE_SYMFONY);\n    }\n\n    private function setStateMachine(ContainerBuilder $container, string $stateMachine): void\n    {\n        if (ResourceBundleInterface::STATE_MACHINE_SYMFONY === $stateMachine) {\n            $this->setSymfonyWorkflowAsStateMachine($container);\n\n            return;\n        }\n\n        if (ResourceBundleInterface::STATE_MACHINE_WINZOU === $stateMachine) {\n            $this->setWinzouAsStateMachine($container);\n\n            return;\n        }\n    }\n\n    private function setWinzouAsStateMachine(ContainerBuilder $container): void\n    {\n        if (!$this->isWinzouStateMachineEnabled($container)) {\n            throw new \\LogicException('You can not use \"Winzou\" for your state machine if it is not available. Try running \"composer require winzou/state-machine-bundle\".');\n        }\n\n        $container->setParameter('sylius.state_machine_component.default', 'winzou');\n        $stateMachineDefinition = $container->register('sylius.resource_controller.state_machine', StateMachine::class);\n        $stateMachineDefinition->setPublic(false);\n        $stateMachineDefinition->addArgument(new Reference('sm.factory'));\n\n        $container->setAlias('sylius.state_machine.operation.default', 'sylius.state_machine.operation.winzou');\n    }\n\n    private function registerWinzouStateMachine(ContainerBuilder $container): void\n    {\n        if (!$this->isWinzouStateMachineEnabled($container)) {\n            return;\n        }\n\n        $stateMachineDefinition = $container->register('sylius.resource_controller.state_machine.winzou', StateMachine::class);\n        $stateMachineDefinition->setPublic(false);\n        $stateMachineDefinition->addArgument(new Reference('sm.factory'));\n    }\n\n    private function registerSymfonyWorkflowStateMachine(ContainerBuilder $container): void\n    {\n        if (!$this->isSymfonyWorkflowEnabled($container)) {\n            return;\n        }\n\n        $stateMachineDefinition = $container->register('sylius.resource_controller.state_machine.symfony', Workflow::class);\n        $stateMachineDefinition->setPublic(false);\n        $stateMachineDefinition->addArgument(new Reference('workflow.registry'));\n    }\n\n    private function setSymfonyWorkflowAsStateMachine(ContainerBuilder $container): void\n    {\n        if (!$this->isSymfonyWorkflowEnabled($container)) {\n            if (class_exists(SymfonyWorkflow::class)) {\n                throw new \\LogicException('You can not use \"Symfony\" for your state machine if it is not enabled on framework bundle.');\n            }\n\n            throw new \\LogicException('You can not use \"Symfony\" for your state machine if it is not available. Try running \"composer require symfony/workflow\".');\n        }\n\n        $container->setParameter('sylius.state_machine_component.default', 'symfony');\n        $stateMachineDefinition = $container->register('sylius.resource_controller.state_machine', Workflow::class);\n        $stateMachineDefinition->setPublic(false);\n        $stateMachineDefinition->addArgument(new Reference('workflow.registry'));\n\n        $container->setAlias('sylius.state_machine.operation.default', 'sylius.state_machine.operation.symfony');\n    }\n\n    private function isSymfonyWorkflowEnabled(ContainerBuilder $container): bool\n    {\n        return $container->hasDefinition('workflow.registry') || $container->hasAlias('workflow.registry');\n    }\n\n    private function isWinzouStateMachineEnabled(ContainerBuilder $container): bool\n    {\n        /** @var array $bundles */\n        $bundles = $container->getParameter('kernel.bundles');\n\n        return in_array(winzouStateMachineBundle::class, $bundles, true);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/TwigPass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler;\n\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\n\n/**\n * TODO Remove on sylius/resource-bundle 2.0\n */\nfinal class TwigPass implements CompilerPassInterface\n{\n    public function process(ContainerBuilder $container): void\n    {\n        if (!$container->hasDefinition('twig')) {\n            return;\n        }\n\n        $twigDefinition = $container->getDefinition('twig');\n        $twigDefinition->setPublic(true);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/UnregisterFosRestDefinitionsPass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler;\n\nuse FOS\\RestBundle\\FOSRestBundle;\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\n\nfinal class UnregisterFosRestDefinitionsPass implements CompilerPassInterface\n{\n    public function process(ContainerBuilder $container): void\n    {\n        /** @var array $bundles */\n        $bundles = $container->getParameter('kernel.bundles');\n\n        if (class_exists(FOSRestBundle::class) && in_array(FOSRestBundle::class, $bundles, true)) {\n            return;\n        }\n\n        $container->removeDefinition('sylius.resource_controller.view_handler');\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/UnregisterHateoasDefinitionsPass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler;\n\nuse Bazinga\\Bundle\\HateoasBundle\\BazingaHateoasBundle;\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\n\nfinal class UnregisterHateoasDefinitionsPass implements CompilerPassInterface\n{\n    public function process(ContainerBuilder $container): void\n    {\n        /** @var array $bundles */\n        $bundles = $container->getParameter('kernel.bundles');\n\n        if (class_exists(BazingaHateoasBundle::class) && in_array(BazingaHateoasBundle::class, $bundles, true)) {\n            return;\n        }\n\n        $container->removeDefinition('sylius.resource_controller.pagerfanta_representation_factory');\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Compiler/WinzouStateMachinePass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler;\n\nuse SM\\Callback\\CallbackFactoryInterface;\nuse SM\\Callback\\CascadeTransitionCallback;\nuse SM\\Factory\\FactoryInterface;\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse winzou\\Bundle\\StateMachineBundle\\winzouStateMachineBundle;\n\n/**\n * Marks WinzouStateMachineBundle's services as public for compatibility with both Symfony 3.4 and 4.0+.\n * Aliases FQCN-based services for backwards compatibility of Winzou/StateMachineBundle 0.4 with 0.3\n *\n * @see https://github.com/winzou/StateMachineBundle/pull/44\n * @see https://github.com/winzou/StateMachineBundle/commit/f515c9302783ef2575570d33b20aefa1eb265afb\n */\nfinal class WinzouStateMachinePass implements CompilerPassInterface\n{\n    public function process(ContainerBuilder $container): void\n    {\n        /** @var array $bundles */\n        $bundles = $container->getParameter('kernel.bundles');\n        $winzouStateMachineEnabled = in_array(winzouStateMachineBundle::class, $bundles, true);\n\n        if (!$winzouStateMachineEnabled) {\n            return;\n        }\n\n        if ($container->hasDefinition('sm.factory') && !$container->hasDefinition(FactoryInterface::class)) {\n            $container->setAlias(FactoryInterface::class, 'sm.factory');\n        } else {\n            $container->setAlias('sm.factory', FactoryInterface::class);\n        }\n\n        if ($container->hasDefinition('sm.callback_factory') && !$container->hasDefinition(CallbackFactoryInterface::class)) {\n            $container->setAlias(CallbackFactoryInterface::class, 'sm.callback_factory');\n        } else {\n            $container->setAlias('sm.callback_factory', CallbackFactoryInterface::class);\n        }\n\n        if ($container->hasDefinition('sm.callback.cascade_transition') && !$container->hasDefinition(CascadeTransitionCallback::class)) {\n            $container->setAlias(CascadeTransitionCallback::class, 'sm.callback.cascade_transition');\n        } else {\n            $container->setAlias('sm.callback.cascade_transition', CascadeTransitionCallback::class);\n        }\n\n        $services = [\n            'sm.factory',\n            'sm.callback_factory',\n            'sm.callback.cascade_transition',\n            FactoryInterface::class,\n            CallbackFactoryInterface::class,\n            CascadeTransitionCallback::class,\n        ];\n\n        foreach ($services as $id) {\n            if ($container->hasAlias($id)) {\n                $container->getAlias($id)->setPublic(true);\n            }\n\n            if ($container->hasDefinition($id)) {\n                $container->getDefinition($id)->setPublic(true);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Configuration.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection;\n\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceController;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\DefaultResourceType;\nuse Sylius\\Bundle\\ResourceBundle\\SyliusResourceBundle;\nuse Sylius\\Resource\\Factory\\Factory;\nuse Symfony\\Component\\Config\\Definition\\Builder\\ArrayNodeDefinition;\nuse Symfony\\Component\\Config\\Definition\\Builder\\TreeBuilder;\nuse Symfony\\Component\\Config\\Definition\\ConfigurationInterface;\n\nfinal class Configuration implements ConfigurationInterface\n{\n    /**\n     * @return TreeBuilder<'array'>\n     */\n    public function getConfigTreeBuilder(): TreeBuilder\n    {\n        $treeBuilder = new TreeBuilder('sylius_resource');\n\n        /** @var ArrayNodeDefinition<TreeBuilder<'array'>> $rootNode */\n        $rootNode = $treeBuilder->getRootNode();\n\n        $this->addResourcesSection($rootNode);\n        $this->addSettingsSection($rootNode);\n        $this->addTranslationsSection($rootNode);\n        $this->addDriversSection($rootNode);\n\n        $rootNode\n            ->children()\n                ->arrayNode('mapping')\n                    ->addDefaultsIfNotSet()\n                    ->children()\n                        ->arrayNode('imports')\n                            ->prototype('scalar')->end()\n                        ->end()\n                        ->arrayNode('paths')\n                            ->prototype('scalar')->end()\n                        ->end()\n                    ->end()\n                ->end()\n                ->scalarNode('authorization_checker')\n                    ->defaultValue('sylius.resource_controller.authorization_checker.disabled')\n                    ->cannotBeEmpty()\n                ->end()\n                ->booleanNode('routing_path_bc_layer')->end()\n                ->scalarNode('path_segment_name_generator')\n                    ->defaultValue('sylius.metadata.path_segment_name_generator.dash')\n                    ->info('Specify a path name generator to use.')\n                ->end()\n            ->end()\n        ;\n\n        return $treeBuilder;\n    }\n\n    /**\n     * @param ArrayNodeDefinition<TreeBuilder<'array'>> $node\n     */\n    private function addResourcesSection(ArrayNodeDefinition $node): void\n    {\n        $node\n            ->children()\n                ->arrayNode('resources')\n                    ->useAttributeAsKey('name')\n                    ->arrayPrototype()\n                        ->children()\n                            ->scalarNode('driver')->defaultValue(SyliusResourceBundle::DRIVER_DOCTRINE_ORM)->end()\n                            ->variableNode('options')\n                                ->setDeprecated('sylius/resource-bundle', '1.12', 'The \"%node%\" node at \"%path%\" is deprecated and will be removed in 2.0.')\n                            ->end()\n                            ->scalarNode('templates')->cannotBeEmpty()->end()\n                            ->scalarNode('state_machine_component')->defaultNull()->end()\n                            ->arrayNode('classes')\n                                ->isRequired()\n                                ->addDefaultsIfNotSet()\n                                ->children()\n                                    ->scalarNode('model')->isRequired()->cannotBeEmpty()->end()\n                                    ->scalarNode('interface')->cannotBeEmpty()->end()\n                                    ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end()\n                                    ->scalarNode('repository')->cannotBeEmpty()->end()\n                                    ->scalarNode('factory')->defaultValue(Factory::class)->end()\n                                    ->scalarNode('form')->defaultValue(DefaultResourceType::class)->cannotBeEmpty()->end()\n                                ->end()\n                            ->end()\n                            ->arrayNode('translation')\n                                ->children()\n                                    ->variableNode('options')\n                                        ->setDeprecated('sylius/resource-bundle', '1.12', 'The \"%node%\" node at \"%path%\" is deprecated and will be removed in 2.0.')\n                                    ->end()\n                                    ->arrayNode('classes')\n                                        ->isRequired()\n                                        ->addDefaultsIfNotSet()\n                                        ->children()\n                                            ->scalarNode('model')->isRequired()->cannotBeEmpty()->end()\n                                            ->scalarNode('interface')->cannotBeEmpty()->end()\n                                            ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end()\n                                            ->scalarNode('repository')->cannotBeEmpty()->end()\n                                            ->scalarNode('factory')->defaultValue(Factory::class)->end()\n                                            ->scalarNode('form')->defaultValue(DefaultResourceType::class)->cannotBeEmpty()->end()\n                                        ->end()\n                                    ->end()\n                                ->end()\n                            ->end()\n                        ->end()\n                    ->end()\n                ->end()\n            ->end()\n        ;\n    }\n\n    /**\n     * @param ArrayNodeDefinition<TreeBuilder<'array'>> $node\n     */\n    private function addSettingsSection(ArrayNodeDefinition $node): void\n    {\n        $node\n            ->children()\n                ->arrayNode('settings')\n                    ->addDefaultsIfNotSet()\n                    ->children()\n                        ->variableNode('paginate')->defaultNull()->end()\n                        ->variableNode('limit')->defaultNull()->end()\n                        ->arrayNode('allowed_paginate')\n                            ->integerPrototype()->end()\n                            ->defaultValue([10, 20, 30])\n                        ->end()\n                        ->integerNode('default_page_size')->defaultValue(10)->end()\n                        ->scalarNode('default_templates_dir')->defaultNull()->end()\n                        ->booleanNode('sortable')->defaultFalse()->end()\n                        ->variableNode('sorting')->defaultNull()->end()\n                        ->booleanNode('filterable')->defaultFalse()->end()\n                        ->variableNode('criteria')->defaultNull()->end()\n                        ->scalarNode('state_machine_component')->defaultNull()->end()\n                    ->end()\n                ->end()\n            ->end()\n        ;\n    }\n\n    /**\n     * @param ArrayNodeDefinition<TreeBuilder<'array'>> $node\n     */\n    private function addTranslationsSection(ArrayNodeDefinition $node): void\n    {\n        $node\n            ->children()\n                ->arrayNode('translation')\n                    ->canBeDisabled()\n                    ->children()\n                        ->scalarNode('locale_provider')->defaultValue('sylius.translation_locale_provider.immutable')->cannotBeEmpty()->end()\n                ->end()\n            ->end()\n        ;\n    }\n\n    /**\n     * @param ArrayNodeDefinition<TreeBuilder<'array'>> $node\n     */\n    private function addDriversSection(ArrayNodeDefinition $node): void\n    {\n        $node\n            ->children()\n                ->arrayNode('drivers')\n                    ->defaultValue([])\n                    ->enumPrototype()->values(SyliusResourceBundle::getAvailableDrivers())->end()\n                ->end()\n            ->end()\n        ;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Driver/AbstractDriver.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver;\n\nuse Sylius\\Component\\Resource\\Factory\\FactoryInterface as LegacyFactoryInterface;\nuse Sylius\\Component\\Resource\\Factory\\TranslatableFactoryInterface as LegacyTranslatableFactoryInterface;\nuse Sylius\\Resource\\Factory\\Factory;\nuse Sylius\\Resource\\Factory\\TranslatableFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Metadata;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\ContainerInterface;\nuse Symfony\\Component\\DependencyInjection\\Definition;\nuse Symfony\\Component\\DependencyInjection\\Reference;\n\nabstract class AbstractDriver implements DriverInterface\n{\n    public function load(ContainerBuilder $container, MetadataInterface $metadata): void\n    {\n        $this->setClassesParameters($container, $metadata);\n\n        if ($metadata->hasClass('controller')) {\n            $this->addController($container, $metadata);\n        }\n\n        $this->addManager($container, $metadata);\n        $this->addRepository($container, $metadata);\n\n        if ($metadata->hasClass('factory')) {\n            $this->addFactory($container, $metadata);\n        }\n    }\n\n    protected function setClassesParameters(ContainerBuilder $container, MetadataInterface $metadata): void\n    {\n        if ($metadata->hasClass('model')) {\n            $container->setParameter(sprintf('%s.model.%s.class', $metadata->getApplicationName(), $metadata->getName()), $metadata->getClass('model'));\n        }\n        if ($metadata->hasClass('controller')) {\n            $container->setParameter(sprintf('%s.controller.%s.class', $metadata->getApplicationName(), $metadata->getName()), $metadata->getClass('controller'));\n        }\n        if ($metadata->hasClass('factory')) {\n            $container->setParameter(sprintf('%s.factory.%s.class', $metadata->getApplicationName(), $metadata->getName()), $metadata->getClass('factory'));\n        }\n        if ($metadata->hasClass('repository')) {\n            $container->setParameter(sprintf('%s.repository.%s.class', $metadata->getApplicationName(), $metadata->getName()), $metadata->getClass('repository'));\n        }\n        if ($metadata->hasClass('form')) {\n            $container->setParameter(sprintf('%s.form.%s.class', $metadata->getApplicationName(), $metadata->getName()), $metadata->getClass('form'));\n        }\n    }\n\n    protected function addController(ContainerBuilder $container, MetadataInterface $metadata): void\n    {\n        $definition = new Definition($metadata->getClass('controller'));\n        $definition\n            ->setPublic(true)\n            ->setArguments([\n                $this->getMetadataDefinition($metadata),\n                new Reference('sylius.resource_controller.request_configuration_factory'),\n                new Reference('sylius.resource_controller.view_handler', ContainerInterface::NULL_ON_INVALID_REFERENCE),\n                new Reference($metadata->getServiceId('repository')),\n                new Reference($metadata->getServiceId('factory')),\n                new Reference('sylius.resource_controller.new_resource_factory'),\n                new Reference($metadata->getServiceId('manager')),\n                new Reference('sylius.resource_controller.single_resource_provider'),\n                new Reference('sylius.resource_controller.resources_collection_provider'),\n                new Reference('sylius.resource_controller.form_factory'),\n                new Reference('sylius.resource_controller.redirect_handler'),\n                new Reference('sylius.resource_controller.flash_helper'),\n                new Reference('sylius.resource_controller.authorization_checker'),\n                new Reference('sylius.resource_controller.event_dispatcher'),\n                new Reference($metadata->getServiceId('controller_state_machine'), ContainerInterface::NULL_ON_INVALID_REFERENCE),\n                new Reference('sylius.resource_controller.resource_update_handler'),\n                new Reference('sylius.resource_controller.resource_delete_handler'),\n            ])\n            ->addMethodCall('setContainer', [new Reference('service_container')])\n            ->addTag('controller.service_arguments')\n        ;\n\n        $container->setDefinition($metadata->getServiceId('controller'), $definition);\n    }\n\n    protected function addFactory(ContainerBuilder $container, MetadataInterface $metadata): void\n    {\n        $factoryClass = $metadata->getClass('factory');\n        $modelClass = $metadata->getClass('model');\n\n        $definition = new Definition($factoryClass);\n        $definition->setPublic(true);\n\n        $definitionArgs = [$modelClass];\n\n        /** @var array $factoryInterfaces */\n        $factoryInterfaces = class_implements($factoryClass);\n        if (in_array(TranslatableFactoryInterface::class, $factoryInterfaces, true)) {\n            $decoratedDefinition = new Definition(Factory::class);\n            $decoratedDefinition->setArguments($definitionArgs);\n\n            $definitionArgs = [$decoratedDefinition, new Reference('sylius.translation_locale_provider')];\n        }\n\n        $definition->setArguments($definitionArgs);\n\n        $container->setDefinition($metadata->getServiceId('factory'), $definition)\n            ->addTag('sylius.resource_factory')\n        ;\n\n        /** @var array $factoryParents */\n        $factoryParents = class_parents($factoryClass);\n\n        $typehintClasses = array_merge(\n            $factoryInterfaces,\n            [$factoryClass, LegacyFactoryInterface::class],\n            $factoryParents,\n        );\n\n        if (in_array(TranslatableFactoryInterface::class, $factoryInterfaces, true)) {\n            $typehintClasses[] = LegacyTranslatableFactoryInterface::class;\n        }\n\n        foreach ($typehintClasses as $typehintClass) {\n            $container->registerAliasForArgument(\n                $metadata->getServiceId('factory'),\n                $typehintClass,\n                $metadata->getHumanizedName() . ' factory',\n            );\n        }\n    }\n\n    protected function getMetadataDefinition(MetadataInterface $metadata): Definition\n    {\n        $definition = new Definition(Metadata::class);\n        $definition\n            ->setFactory([new Reference('sylius.resource_registry'), 'get'])\n            ->setArguments([$metadata->getAlias()])\n        ;\n\n        return $definition;\n    }\n\n    abstract protected function addManager(ContainerBuilder $container, MetadataInterface $metadata): void;\n\n    abstract protected function addRepository(ContainerBuilder $container, MetadataInterface $metadata): void;\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Driver/Doctrine/AbstractDoctrineDriver.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Doctrine;\n\nuse Doctrine\\Common\\Persistence\\ObjectManager as DeprecatedObjectManager;\nuse Doctrine\\Persistence\\ObjectManager;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\AbstractDriver;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Component\\DependencyInjection\\Alias;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Definition;\nuse Symfony\\Component\\DependencyInjection\\Reference;\n\nabstract class AbstractDoctrineDriver extends AbstractDriver\n{\n    protected function getClassMetadataDefinition(MetadataInterface $metadata): Definition\n    {\n        $definition = new Definition($this->getClassMetadataClassname());\n        $definition\n            ->setFactory([new Reference($this->getManagerServiceId($metadata)), 'getClassMetadata'])\n            ->setArguments([$metadata->getClass('model')])\n            ->setPublic(false)\n        ;\n\n        return $definition;\n    }\n\n    protected function addManager(ContainerBuilder $container, MetadataInterface $metadata): void\n    {\n        $container->setAlias(\n            $metadata->getServiceId('manager'),\n            new Alias($this->getManagerServiceId($metadata), true),\n        );\n\n        foreach ([DeprecatedObjectManager::class, ObjectManager::class] as $objectManagerClass) {\n            if (!class_exists($objectManagerClass)) {\n                continue;\n            }\n\n            $container->registerAliasForArgument(\n                $metadata->getServiceId('manager'),\n                $objectManagerClass,\n                $metadata->getHumanizedName() . ' manager',\n            );\n        }\n    }\n\n    /**\n     * Return the configured object managre name, or NULL if the default\n     * manager should be used.\n     */\n    protected function getObjectManagerName(MetadataInterface $metadata): ?string\n    {\n        if (!$metadata->hasParameter('options')) {\n            return null;\n        }\n\n        /** @var string[] $options */\n        $options = $metadata->getParameter('options');\n\n        return $options['object_manager'] ?? null;\n    }\n\n    abstract protected function getManagerServiceId(MetadataInterface $metadata): string;\n\n    abstract protected function getClassMetadataClassname(): string;\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Driver/Doctrine/DoctrineODMDriver.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Doctrine;\n\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ODM\\MongoDB\\TranslatableRepository;\nuse Sylius\\Bundle\\ResourceBundle\\SyliusResourceBundle;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Model\\TranslatableInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Definition;\nuse Symfony\\Component\\DependencyInjection\\Parameter;\nuse Symfony\\Component\\DependencyInjection\\Reference;\n\nfinal class DoctrineODMDriver extends AbstractDoctrineDriver\n{\n    public function getType(): string\n    {\n        return SyliusResourceBundle::DRIVER_DOCTRINE_MONGODB_ODM;\n    }\n\n    public function load(ContainerBuilder $container, MetadataInterface $metadata): void\n    {\n        trigger_deprecation(\n            'sylius/resource-bundle',\n            '1.3',\n            'The \"%s\" class is deprecated. Doctrine MongoDB and PHPCR will no longer be supported in 2.0.',\n            self::class,\n        );\n\n        parent::load($container, $metadata);\n    }\n\n    protected function addRepository(ContainerBuilder $container, MetadataInterface $metadata): void\n    {\n        $modelClass = $metadata->getClass('model');\n\n        /** @var array $modelInterfaces */\n        $modelInterfaces = class_implements($modelClass);\n\n        $repositoryClass = in_array(TranslatableInterface::class, $modelInterfaces)\n            ? TranslatableRepository::class\n            : new Parameter('sylius.mongodb.odm.repository.class')\n        ;\n\n        if ($metadata->hasClass('repository')) {\n            $repositoryClass = $metadata->getClass('repository');\n        }\n\n        $unitOfWorkDefinition = new Definition('Doctrine\\\\ODM\\\\MongoDB\\\\UnitOfWork');\n        $unitOfWorkDefinition\n            ->setFactory([new Reference($this->getManagerServiceId($metadata)), 'getUnitOfWork'])\n            ->setPublic(false)\n        ;\n\n        $definition = new Definition($repositoryClass);\n        $definition->setArguments([\n            new Reference($metadata->getServiceId('manager')),\n            $unitOfWorkDefinition,\n            $this->getClassMetadataDefinition($metadata),\n        ]);\n        $definition->addTag('sylius.repository');\n\n        $container->setDefinition($metadata->getServiceId('repository'), $definition);\n    }\n\n    protected function getManagerServiceId(MetadataInterface $metadata): string\n    {\n        if ($objectManagerName = $this->getObjectManagerName($metadata)) {\n            return sprintf('doctrine_mongodb.odm.%s_document_manager', $objectManagerName);\n        }\n\n        return 'doctrine_mongodb.odm.document_manager';\n    }\n\n    protected function getClassMetadataClassname(): string\n    {\n        return 'Doctrine\\\\ODM\\\\MongoDB\\\\Mapping\\\\ClassMetadata';\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Driver/Doctrine/DoctrineORMDriver.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Doctrine;\n\nuse Doctrine\\Bundle\\DoctrineBundle\\DependencyInjection\\Compiler\\ServiceRepositoryCompilerPass;\nuse Doctrine\\Bundle\\DoctrineBundle\\Repository\\ServiceEntityRepository;\nuse Doctrine\\Common\\Persistence\\ObjectManager as DeprecatedObjectManager;\nuse Doctrine\\ORM\\EntityManagerInterface;\nuse Doctrine\\ORM\\Mapping\\ClassMetadata;\nuse Doctrine\\Persistence\\ObjectManager;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\EntityRepository;\nuse Sylius\\Bundle\\ResourceBundle\\SyliusResourceBundle;\nuse Sylius\\Component\\Resource\\Repository\\RepositoryInterface as LegacyRepositoryInterface;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Definition;\nuse Symfony\\Component\\DependencyInjection\\Reference;\n\nfinal class DoctrineORMDriver extends AbstractDoctrineDriver\n{\n    public const GENERIC_ENTITIES_PARAMETER = 'sylius.doctrine.orm.container_repository_factory.entities';\n\n    public function getType(): string\n    {\n        return SyliusResourceBundle::DRIVER_DOCTRINE_ORM;\n    }\n\n    protected function addRepository(ContainerBuilder $container, MetadataInterface $metadata): void\n    {\n        $repositoryClassParameterName = sprintf('%s.repository.%s.class', $metadata->getApplicationName(), $metadata->getName());\n        $repositoryClass = EntityRepository::class;\n\n        /** @var string[] $genericEntities */\n        $genericEntities = $container->hasParameter(self::GENERIC_ENTITIES_PARAMETER) ? $container->getParameter(self::GENERIC_ENTITIES_PARAMETER) : [];\n\n        if ($container->hasParameter($repositoryClassParameterName)) {\n            /** @var string $repositoryClass */\n            $repositoryClass = $container->getParameter($repositoryClassParameterName);\n        }\n\n        if ($metadata->hasClass('repository')) {\n            /** @var string $repositoryClass */\n            $repositoryClass = $metadata->getClass('repository');\n        }\n\n        $serviceId = $metadata->getServiceId('repository');\n        $managerReference = new Reference($metadata->getServiceId('manager'));\n        $definition = new Definition($repositoryClass);\n        $definition->setPublic(true);\n        $definition->addTag('sylius.repository');\n\n        if ($repositoryClass === EntityRepository::class) {\n            /** @var string $entityClass */\n            $entityClass = $metadata->getClass('model');\n\n            $definition->setFactory([$managerReference, 'getRepository']);\n            $definition->setArguments([$entityClass]);\n\n            $container->setDefinition($serviceId, $definition);\n\n            $genericEntities[] = $entityClass;\n        } else {\n            if (is_a($repositoryClass, ServiceEntityRepository::class, true)) {\n                $definition->setArguments([new Reference('doctrine')]);\n                $container->setDefinition($serviceId, $definition);\n            } else {\n                $definition->setArguments([$managerReference, $this->getClassMetadataDefinition($metadata)]);\n            }\n\n            $container->setDefinition($serviceId, $definition);\n\n            $doctrineDefinition = new Definition($repositoryClass);\n            $doctrineDefinition->addTag(ServiceRepositoryCompilerPass::REPOSITORY_SERVICE_TAG);\n            $doctrineDefinition->setFactory([new Reference('service_container'), 'get']);\n            $doctrineDefinition->setArguments([$serviceId]);\n\n            $container->setDefinition($repositoryClass, $doctrineDefinition);\n        }\n\n        /** @var array $repositoryInterfaces */\n        $repositoryInterfaces = class_implements($repositoryClass);\n\n        /** @var array $repositoryParents */\n        $repositoryParents = class_parents($repositoryClass);\n\n        $typehintClasses = array_merge(\n            $repositoryInterfaces,\n            [$repositoryClass, LegacyRepositoryInterface::class],\n            $repositoryParents,\n        );\n\n        foreach ($typehintClasses as $typehintClass) {\n            $container->registerAliasForArgument(\n                $metadata->getServiceId('repository'),\n                $typehintClass,\n                $metadata->getHumanizedName() . ' repository',\n            );\n        }\n\n        $container->setParameter(self::GENERIC_ENTITIES_PARAMETER, $genericEntities);\n    }\n\n    protected function addManager(ContainerBuilder $container, MetadataInterface $metadata): void\n    {\n        parent::addManager($container, $metadata);\n\n        $typehintClasses = [\n            DeprecatedObjectManager::class,\n            ObjectManager::class,\n            EntityManagerInterface::class,\n        ];\n\n        foreach ($typehintClasses as $typehintClass) {\n            $container->registerAliasForArgument(\n                $metadata->getServiceId('manager'),\n                $typehintClass,\n                $metadata->getHumanizedName() . ' manager',\n            );\n        }\n    }\n\n    protected function getManagerServiceId(MetadataInterface $metadata): string\n    {\n        if ($objectManagerName = $this->getObjectManagerName($metadata)) {\n            return sprintf('doctrine.orm.%s_entity_manager', $objectManagerName);\n        }\n\n        return 'doctrine.orm.entity_manager';\n    }\n\n    protected function getClassMetadataClassname(): string\n    {\n        return ClassMetadata::class;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Driver/Doctrine/DoctrinePHPCRDriver.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Doctrine;\n\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ODM\\PHPCR\\EventListener\\DefaultParentListener;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ODM\\PHPCR\\EventListener\\NameFilterListener;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ODM\\PHPCR\\EventListener\\NameResolverListener;\nuse Sylius\\Bundle\\ResourceBundle\\SyliusResourceBundle;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Definition;\nuse Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException;\nuse Symfony\\Component\\DependencyInjection\\Parameter;\nuse Symfony\\Component\\DependencyInjection\\Reference;\n\nfinal class DoctrinePHPCRDriver extends AbstractDoctrineDriver\n{\n    public function load(ContainerBuilder $container, MetadataInterface $metadata): void\n    {\n        trigger_deprecation(\n            'sylius/resource-bundle',\n            '1.3',\n            'The \"%s\" class is deprecated. Doctrine MongoDB and PHPCR will no longer be supported in 2.0.',\n            self::class,\n        );\n\n        parent::load($container, $metadata);\n\n        $this->addResourceListeners($container, $metadata);\n    }\n\n    protected function addResourceListeners(ContainerBuilder $container, MetadataInterface $metadata): void\n    {\n        $defaultOptions = [\n                // if no parent is given default to the parent path given here.\n                'parent_path_default' => null,\n\n                // auto-create the parent path if it does not exist.\n                'parent_path_autocreate' => false,\n\n                // set true to always override the parent path.\n                'parent_path_force' => false,\n\n                // automatically replace invalid characters in the node name\n                // with a blank space.\n                'name_filter' => true,\n\n                // automatically resolve same-name-sibling conflicts.\n                'name_resolver' => true,\n        ];\n        $metadataOptions = $metadata->hasParameter('options') ? $metadata->getParameter('options') : [];\n\n        if ($diff = array_diff(array_keys($metadataOptions), array_keys($defaultOptions))) {\n            throw new InvalidArgumentException(sprintf(\n                'Unknown PHPCR-ODM configuration options: \"%s\"',\n                implode('\", \"', $diff),\n            ));\n        }\n\n        $options = array_merge(\n            $defaultOptions,\n            $metadataOptions,\n        );\n\n        $createEventName = sprintf('%s.%s.pre_%s', $metadata->getApplicationName(), $metadata->getName(), 'create');\n        $updateEventName = sprintf('%s.%s.pre_%s', $metadata->getApplicationName(), $metadata->getName(), 'update');\n\n        if ($options['parent_path_default']) {\n            $defaultPath = new Definition(DefaultParentListener::class);\n            $defaultPath->setArguments([\n                new Reference($metadata->getServiceId('manager')),\n                $options['parent_path_default'],\n                $options['parent_path_autocreate'],\n                $options['parent_path_force'],\n            ]);\n            $defaultPath->addTag('kernel.event_listener', [\n                'event' => $createEventName,\n                'method' => 'onPreCreate',\n            ]);\n\n            $container->setDefinition(\n                sprintf(\n                    '%s.resource.%s.doctrine.odm.phpcr.event_listener.default_path',\n                    $metadata->getApplicationName(),\n                    $metadata->getName(),\n                ),\n                $defaultPath,\n            );\n        }\n\n        if ($options['name_filter']) {\n            $nameFilter = new Definition(NameFilterListener::class);\n            $nameFilter->setArguments([\n                new Reference($metadata->getServiceId('manager')),\n            ]);\n            $nameFilter->addTag('kernel.event_listener', [\n                'event' => $createEventName,\n                'method' => 'onEvent',\n            ]);\n            $nameFilter->addTag('kernel.event_listener', [\n                'event' => $updateEventName,\n                'method' => 'onEvent',\n            ]);\n\n            $container->setDefinition(\n                sprintf(\n                    '%s.resource.%s.doctrine.odm.phpcr.event_listener.name_filter',\n                    $metadata->getApplicationName(),\n                    $metadata->getName(),\n                ),\n                $nameFilter,\n            );\n        }\n\n        if ($options['name_resolver']) {\n            $nameResolver = new Definition(NameResolverListener::class);\n            $nameResolver->setArguments([\n                new Reference($metadata->getServiceId('manager')),\n            ]);\n            $nameResolver->addTag('kernel.event_listener', [\n                'event' => $createEventName,\n                'method' => 'onEvent',\n            ]);\n            $nameResolver->addTag('kernel.event_listener', [\n                'event' => $updateEventName,\n                'method' => 'onEvent',\n            ]);\n\n            $container->setDefinition(\n                sprintf(\n                    '%s.resource.%s.doctrine.odm.phpcr.event_listener.name_resolver',\n                    $metadata->getApplicationName(),\n                    $metadata->getName(),\n                ),\n                $nameResolver,\n            );\n        }\n    }\n\n    public function getType(): string\n    {\n        return SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM;\n    }\n\n    protected function addRepository(ContainerBuilder $container, MetadataInterface $metadata): void\n    {\n        $repositoryClass = new Parameter('sylius.phpcr_odm.repository.class');\n\n        if ($metadata->hasClass('repository')) {\n            $repositoryClass = $metadata->getClass('repository');\n        }\n\n        $definition = new Definition($repositoryClass);\n        $definition->setArguments([\n            new Reference($metadata->getServiceId('manager')),\n            $this->getClassMetadataDefinition($metadata),\n        ]);\n        $definition->addTag('sylius.repository');\n\n        $container->setDefinition($metadata->getServiceId('repository'), $definition);\n    }\n\n    protected function getManagerServiceId(MetadataInterface $metadata): string\n    {\n        if ($objectManagerName = $this->getObjectManagerName($metadata)) {\n            return sprintf('doctrine_phpcr.odm.%s_document_manager', $objectManagerName);\n        }\n\n        return 'doctrine_phpcr.odm.document_manager';\n    }\n\n    protected function getClassMetadataClassname(): string\n    {\n        return 'Doctrine\\\\ODM\\\\PHPCR\\\\Mapping\\\\ClassMetadata';\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Driver/DriverInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver;\n\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\n\ninterface DriverInterface\n{\n    public function load(ContainerBuilder $container, MetadataInterface $metadata): void;\n\n    /**\n     * Returns unique name of the driver.\n     */\n    public function getType(): string;\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Driver/DriverProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver;\n\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Doctrine\\DoctrineODMDriver;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Doctrine\\DoctrineORMDriver;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Doctrine\\DoctrinePHPCRDriver;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Exception\\UnknownDriverException;\nuse Sylius\\Bundle\\ResourceBundle\\SyliusResourceBundle;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Webmozart\\Assert\\Assert;\n\nfinal class DriverProvider\n{\n    /** @var DriverInterface[] */\n    private static array $drivers = [];\n\n    /**\n     * @throws UnknownDriverException\n     */\n    public static function get(MetadataInterface $metadata): DriverInterface\n    {\n        $type = $metadata->getDriver();\n\n        if (isset(self::$drivers[$type])) {\n            return self::$drivers[$type];\n        }\n\n        Assert::notFalse($type, sprintf('No driver was configured on the resource \"%s\".', $metadata->getAlias()));\n\n        switch ($type) {\n            case SyliusResourceBundle::DRIVER_DOCTRINE_ORM:\n                return self::$drivers[$type] = new DoctrineORMDriver();\n            case SyliusResourceBundle::DRIVER_DOCTRINE_MONGODB_ODM:\n                return self::$drivers[$type] = new DoctrineODMDriver();\n            case SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM:\n                return self::$drivers[$type] = new DoctrinePHPCRDriver();\n        }\n\n        throw new UnknownDriverException($type);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Driver/Exception/InvalidDriverException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Exception;\n\nclass InvalidDriverException extends \\Exception\n{\n    public function __construct(string $driver, string $className)\n    {\n        parent::__construct(sprintf(\n            'Driver \"%s\" is not supported by %s.',\n            $driver,\n            $className,\n        ));\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Driver/Exception/UnknownDriverException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Exception;\n\nclass UnknownDriverException extends \\Exception\n{\n    public function __construct(string $driver)\n    {\n        parent::__construct(sprintf(\n            'Unknown driver \"%s\".',\n            $driver,\n        ));\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/Extension/AbstractResourceExtension.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Extension;\n\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\DriverProvider;\nuse Sylius\\Resource\\Metadata\\Metadata;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Extension\\Extension;\n\nabstract class AbstractResourceExtension extends Extension\n{\n    protected function registerResources(\n        string $applicationName,\n        string $driver,\n        array $registeredResources,\n        ContainerBuilder $container,\n    ): void {\n        $container->setParameter(sprintf('%s.driver.%s', $this->getAlias(), $driver), true);\n        $container->setParameter(sprintf('%s.driver', $this->getAlias()), $driver);\n\n        /** @var array<string, array> $resources */\n        $resources = $container->hasParameter('sylius.resources') ? $container->getParameter('sylius.resources') : [];\n\n        foreach ($registeredResources as $resourceName => $resourceConfig) {\n            $alias = $applicationName . '.' . $resourceName;\n            $resourceConfig = array_merge(['driver' => $driver], $resourceConfig);\n\n            $resources[$alias] = $resourceConfig;\n            $container->setParameter('sylius.resources', $resources);\n\n            $metadata = Metadata::fromAliasAndConfiguration($alias, $resourceConfig);\n\n            DriverProvider::get($metadata)->load($container, $metadata);\n\n            if ($metadata->hasParameter('translation')) {\n                $alias .= '_translation';\n                $resourceConfig = array_merge(['driver' => $driver], $resourceConfig['translation']);\n\n                $resources[$alias] = $resourceConfig;\n                $container->setParameter('sylius.resources', $resources);\n\n                $metadata = Metadata::fromAliasAndConfiguration($alias, $resourceConfig);\n\n                DriverProvider::get($metadata)->load($container, $metadata);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/PagerfantaConfiguration.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection;\n\nuse Symfony\\Component\\Config\\Definition\\Builder\\ArrayNodeDefinition;\nuse Symfony\\Component\\Config\\Definition\\Builder\\TreeBuilder;\nuse Symfony\\Component\\Config\\Definition\\ConfigurationInterface;\n\n/**\n * Container configuration to bridge the configuration from WhiteOctoberPagerfantaBundle to BabDevPagerfantaBundle\n *\n * @internal\n */\nfinal class PagerfantaConfiguration implements ConfigurationInterface\n{\n    public const EXCEPTION_STRATEGY_TO_HTTP_NOT_FOUND = 'to_http_not_found';\n\n    /**\n     * @return TreeBuilder<'array'>\n     */\n    public function getConfigTreeBuilder(): TreeBuilder\n    {\n        $treeBuilder = new TreeBuilder('white_october_pagerfanta');\n\n        /** @var ArrayNodeDefinition<TreeBuilder<'array'>> $rootNode */\n        $rootNode = $treeBuilder->getRootNode();\n        $rootNode->setDeprecated('sylius/resource-bundle', '1.7', 'The \"%node%\" configuration node is deprecated, migrate your configuration to the \"babdev_pagerfanta\" configuration node.');\n\n        $this->addExceptionsStrategySection($rootNode);\n\n        $rootNode\n            ->children()\n                ->scalarNode('default_view')\n                    ->defaultValue('default')\n                ->end()\n            ->end()\n        ;\n\n        return $treeBuilder;\n    }\n\n    /**\n     * @param ArrayNodeDefinition<TreeBuilder<'array'>> $node\n     */\n    private function addExceptionsStrategySection(ArrayNodeDefinition $node): void\n    {\n        $node\n            ->children()\n                ->arrayNode('exceptions_strategy')\n                    ->addDefaultsIfNotSet()\n                    ->children()\n                        ->scalarNode('out_of_range_page')->defaultValue(self::EXCEPTION_STRATEGY_TO_HTTP_NOT_FOUND)->end()\n                        ->scalarNode('not_valid_current_page')->defaultValue(self::EXCEPTION_STRATEGY_TO_HTTP_NOT_FOUND)->end()\n                    ->end()\n                ->end()\n            ->end()\n        ;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/PagerfantaExtension.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection;\n\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Extension\\Extension;\nuse Symfony\\Component\\DependencyInjection\\Extension\\PrependExtensionInterface;\n\n/**\n * Container extension to bridge the configuration from WhiteOctoberPagerfantaBundle to BabDevPagerfantaBundle\n *\n * @internal\n */\nfinal class PagerfantaExtension extends Extension implements PrependExtensionInterface\n{\n    public function __construct(private bool $internalUse = false)\n    {\n    }\n\n    public function getAlias(): string\n    {\n        return 'white_october_pagerfanta';\n    }\n\n    public function getConfiguration(array $config, ContainerBuilder $container): PagerfantaConfiguration\n    {\n        return new PagerfantaConfiguration();\n    }\n\n    public function load(array $configs, ContainerBuilder $container): void\n    {\n        if (false === $this->internalUse) {\n            trigger_deprecation(\n                'sylius/resource-bundle',\n                '1.7',\n                'The \"%s\" class is deprecated. Migrate your Pagerfanta configuration from WhiteOctoberPagerfantaBundle to BabDevPagerfantaBundle, the configuration bridge will be removed in 2.0.',\n                self::class,\n            );\n        }\n\n        $config = $this->processConfiguration($this->getConfiguration($configs, $container), $configs);\n\n        $container->setParameter('white_october_pagerfanta.default_view', $config['default_view']);\n    }\n\n    public function prepend(ContainerBuilder $container): void\n    {\n        $config = $this->processConfiguration($this->getConfiguration([], $container), $container->getExtensionConfig($this->getAlias()));\n\n        $container->prependExtensionConfig('babdev_pagerfanta', $config);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/DependencyInjection/SyliusResourceExtension.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\DependencyInjection;\n\nuse Behat\\Transliterator\\Transliterator;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceController;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Doctrine\\DoctrineODMDriver;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Doctrine\\DoctrineORMDriver;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Doctrine\\DoctrinePHPCRDriver;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\DriverProvider;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\DefaultResourceType;\nuse Sylius\\Bundle\\ResourceBundle\\SyliusResourceBundle;\nuse Sylius\\Component\\Resource\\Factory\\FactoryInterface as LegacyFactoryInterface;\nuse Sylius\\Resource\\Factory\\Factory;\nuse Sylius\\Resource\\Factory\\FactoryInterface;\nuse Sylius\\Resource\\Metadata\\AsOperationMutator;\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\AsResourceMutator;\nuse Sylius\\Resource\\Metadata\\Metadata;\nuse Sylius\\Resource\\Metadata\\OperationMutatorInterface;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\ResourceMutatorInterface;\nuse Sylius\\Resource\\Reflection\\ClassReflection;\nuse Sylius\\Resource\\Reflection\\ReflectionClassRecursiveIterator;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Sylius\\Resource\\State\\ResponderInterface;\nuse Sylius\\Resource\\Twig\\Context\\Factory\\ContextFactoryInterface;\nuse Symfony\\Component\\Config\\FileLocator;\nuse Symfony\\Component\\Config\\Loader\\LoaderInterface;\nuse Symfony\\Component\\Config\\Resource\\DirectoryResource;\nuse Symfony\\Component\\DependencyInjection\\ChildDefinition;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException;\nuse Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException;\nuse Symfony\\Component\\DependencyInjection\\Extension\\Extension;\nuse Symfony\\Component\\DependencyInjection\\Extension\\PrependExtensionInterface;\nuse Symfony\\Component\\DependencyInjection\\Loader\\PhpFileLoader;\nuse Symfony\\Component\\Finder\\Finder;\nuse function Symfony\\Component\\String\\u;\n\nfinal class SyliusResourceExtension extends Extension implements PrependExtensionInterface\n{\n    public function load(array $configs, ContainerBuilder $container): void\n    {\n        $config = $this->processConfiguration($this->getConfiguration([], $container), $configs);\n\n        $loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));\n\n        $loader->load('services.php');\n\n        /** @var array<string, string> $bundles */\n        $bundles = $container->getParameter('kernel.bundles');\n        if (array_key_exists('SyliusGridBundle', $bundles)) {\n            $loader->load('services/integrations/grid.php');\n        }\n\n        if ($config['translation']['enabled']) {\n            $loader->load('services/integrations/translation.php');\n\n            $container->setAlias('sylius.translation_locale_provider', $config['translation']['locale_provider'])->setPublic(true);\n        }\n\n        $container->setParameter('sylius.resource.mapping', $config['mapping']);\n        $container->setParameter('sylius.resource.settings', $config['settings']);\n\n        $routingPathBcLayer = $config['routing_path_bc_layer'] ?? null;\n\n        if (null === $routingPathBcLayer) {\n            $routingPathBcLayer = class_exists(Transliterator::class);\n        }\n\n        if ($routingPathBcLayer && !class_exists(Transliterator::class)) {\n            throw new RuntimeException(sprintf('The routing path bc-layer is enabled but behat/transliterator package is not installed.'));\n        }\n\n        $container->setParameter('sylius.routing_path_bc_layer', $routingPathBcLayer);\n\n        $container->setAlias('sylius.resource_controller.authorization_checker', $config['authorization_checker']);\n        $container->setAlias('sylius.path_segment_name_generator', $config['path_segment_name_generator']);\n\n        $this->registerMetadataConfiguration($container, $config);\n        $this->autoRegisterResources($config, $container);\n\n        $this->loadPersistence($config['drivers'], $config['resources'], $loader, $container);\n        $this->loadResources($config['resources'], $container);\n\n        $container->registerAttributeForAutoconfiguration(AsResource::class, static function (ChildDefinition $definition): void {\n            $definition->addTag('container.excluded', [\n                'source' => 'by #[AsResource] attribute',\n            ]);\n        });\n\n        $container->registerAttributeForAutoconfiguration(\n            AsResourceMutator::class,\n            static function (ChildDefinition $definition, AsResourceMutator $attribute, \\ReflectionClass $reflector): void {\n                if (!is_a($reflector->name, ResourceMutatorInterface::class, true)) {\n                    throw new RuntimeException(\\sprintf('Resource mutator \"%s\" should implement %s', $reflector->name, ResourceMutatorInterface::class));\n                }\n\n                $definition->addTag('sylius.resource_mutator', [\n                    'resourceClass' => $attribute->resourceClass,\n                ]);\n            },\n        );\n\n        $container->registerAttributeForAutoconfiguration(\n            AsOperationMutator::class,\n            static function (ChildDefinition $definition, AsOperationMutator $attribute, \\ReflectionClass $reflector): void {\n                if (!is_a($reflector->name, OperationMutatorInterface::class, true)) {\n                    throw new RuntimeException(\\sprintf('Operation mutator \"%s\" should implement %s', $reflector->name, OperationMutatorInterface::class));\n                }\n\n                $definition->addTag('sylius.operation_mutator', [\n                    'operationName' => $attribute->operationName,\n                ]);\n            },\n        );\n\n        $container->registerForAutoconfiguration(ProviderInterface::class)\n            ->addTag('sylius.state_provider')\n        ;\n\n        $container->registerForAutoconfiguration(ProcessorInterface::class)\n            ->addTag('sylius.state_processor')\n        ;\n\n        $container->registerForAutoconfiguration(ResponderInterface::class)\n            ->addTag('sylius.state_responder')\n        ;\n\n        $container->registerForAutoconfiguration(FactoryInterface::class)\n            ->addTag('sylius.resource_factory')\n        ;\n\n        $container->registerForAutoconfiguration(LegacyFactoryInterface::class)\n            ->addTag('sylius.resource_factory')\n        ;\n\n        $container->registerForAutoconfiguration(ContextFactoryInterface::class)\n            ->addTag('sylius.twig_context_factory')\n        ;\n\n        $container->addObjectResource(Metadata::class);\n        $container->addObjectResource(DriverProvider::class);\n        $container->addObjectResource(DoctrineORMDriver::class);\n        $container->addObjectResource(DoctrineODMDriver::class);\n        $container->addObjectResource(DoctrinePHPCRDriver::class);\n    }\n\n    public function getConfiguration(array $config, ContainerBuilder $container): Configuration\n    {\n        $configuration = new Configuration();\n\n        $container->addObjectResource($configuration);\n\n        return $configuration;\n    }\n\n    public function prepend(ContainerBuilder $container): void\n    {\n        $config = ['body_listener' => ['enabled' => true]];\n        $container->prependExtensionConfig('fos_rest', $config);\n    }\n\n    private function autoRegisterResources(array &$config, ContainerBuilder $container): void\n    {\n        /** @var array $resources */\n        $resources = $config['resources'];\n\n        /** @var array $mapping */\n        $mapping = $container->getParameter('sylius.resource.mapping');\n        $paths = $mapping['paths'] ?? [];\n\n        foreach (ReflectionClassRecursiveIterator::getReflectionClassesFromDirectories($paths) as $reflectionClass) {\n            $className = $reflectionClass->getName();\n            $resourceAttributes = ClassReflection::getClassAttributes($className, AsResource::class);\n\n            foreach ($resourceAttributes as $resourceAttribute) {\n                /** @var AsResource $resource */\n                $resource = $resourceAttribute->newInstance();\n                $resourceMetadata = $resource->toMetadata();\n                $resourceAlias = $this->getResourceAlias($resourceMetadata, $className);\n\n                if ($resources[$resourceAlias] ?? false) {\n                    continue;\n                }\n\n                $resources[$resourceAlias] = [\n                    'classes' => [\n                        'model' => $className,\n                        'controller' => ResourceController::class,\n                        'factory' => Factory::class,\n                        'form' => DefaultResourceType::class,\n                    ],\n                    'driver' => $resourceMetadata->getDriver() ?? SyliusResourceBundle::DRIVER_DOCTRINE_ORM,\n                ];\n            }\n        }\n\n        $config['resources'] = $resources;\n    }\n\n    /** @param class-string $className */\n    private function getResourceAlias(ResourceMetadata $resource, string $className): string\n    {\n        $alias = $resource->getAlias();\n        $applicationName = $resource->getApplicationName() ?? 'app';\n\n        if (null !== $alias) {\n            return $alias;\n        }\n\n        $reflectionClass = new \\ReflectionClass($className);\n\n        $shortName = $reflectionClass->getShortName();\n        $suffix = 'Resource';\n        if (str_ends_with($shortName, $suffix)) {\n            $shortName = substr($shortName, 0, strlen($shortName) - strlen($suffix));\n        }\n\n        return u($applicationName)->snake()->toString() . '.' . u($shortName)->snake()->toString();\n    }\n\n    /**\n     * @param array<string, array{driver?: string|false}> $resources\n     */\n    private function loadPersistence(array $drivers, array $resources, LoaderInterface $loader, ContainerBuilder $container): void\n    {\n        $availableDrivers = $this->getAvailableDrivers($container);\n\n        // Enable all available drivers if there is no configured drivers\n        $drivers = [] !== $drivers ? $drivers : $availableDrivers;\n\n        $resourceDrivers = $this->getResourceDrivers($resources);\n\n        $this->checkConfiguredDrivers($drivers, $availableDrivers, $resourceDrivers);\n\n        $integrateDoctrine = array_reduce($drivers, function (bool $result, string $driver): bool {\n            return $result || in_array($driver, [SyliusResourceBundle::DRIVER_DOCTRINE_ORM, SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM, SyliusResourceBundle::DRIVER_DOCTRINE_MONGODB_ODM], true);\n        }, false);\n\n        if ($integrateDoctrine) {\n            $loader->load('services/integrations/doctrine.php');\n        }\n\n        foreach ($drivers as $driver) {\n            if (in_array($driver, [SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM, SyliusResourceBundle::DRIVER_DOCTRINE_MONGODB_ODM], true)) {\n                trigger_deprecation(\n                    'sylius/resource-bundle',\n                    '1.3',\n                    'The \"%s\" driver is deprecated. Doctrine MongoDB and PHPCR will no longer be supported in 2.0.',\n                    $driver,\n                );\n            }\n\n            // Only Doctrine drivers need service integration file\n            if (!str_starts_with($driver, 'doctrine')) {\n                continue;\n            }\n\n            $loader->load(sprintf('services/integrations/%s.php', $driver));\n        }\n    }\n\n    /**\n     * @param array<string, array{driver?: string|false}> $resources\n     *\n     * @return array<string, string>\n     */\n    private function getResourceDrivers(array $resources): array\n    {\n        $resourceDrivers = array_map(function (array $resource): string|false {\n            return $resource['driver'] ?? false;\n        }, $resources);\n\n        // Remove resources with disabled driver\n        return array_filter($resourceDrivers, function (string|false $driver): bool {\n            return false !== $driver;\n        });\n    }\n\n    private function getAvailableDrivers(ContainerBuilder $container): array\n    {\n        $availableDrivers = [];\n\n        if ($container::willBeAvailable(SyliusResourceBundle::DRIVER_DOCTRINE_ORM, \\Doctrine\\ORM\\EntityManagerInterface::class, ['doctrine/doctrine-bundle'])) {\n            $availableDrivers[] = SyliusResourceBundle::DRIVER_DOCTRINE_ORM;\n        }\n\n        if ($container::willBeAvailable(SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM, \\Doctrine\\ODM\\PHPCR\\Document\\Resource::class, ['doctrine/doctrine-bundle'])) {\n            $availableDrivers[] = SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM;\n        }\n\n        if ($container::willBeAvailable(SyliusResourceBundle::DRIVER_DOCTRINE_MONGODB_ODM, \\Doctrine\\ODM\\MongoDB\\DocumentManager::class, ['doctrine/doctrine-bundle'])) {\n            $availableDrivers[] = SyliusResourceBundle::DRIVER_DOCTRINE_MONGODB_ODM;\n        }\n\n        return $availableDrivers;\n    }\n\n    /**\n     * @param string[] $configuredDrivers\n     * @param string[] $availableDrivers\n     * @param array<string, string> $resourceDrivers\n     */\n    private function checkConfiguredDrivers(array $configuredDrivers, array $availableDrivers, array $resourceDrivers): void\n    {\n        foreach ($configuredDrivers as $driver) {\n            if (!in_array($driver, $availableDrivers, true)) {\n                throw new InvalidArgumentException(sprintf(\n                    'Driver \"%s\" is configured, but this driver is not available. Try running \"composer require %s\"',\n                    $driver,\n                    $driver,\n                ));\n            }\n        }\n\n        foreach ($resourceDrivers as $resource => $driver) {\n            if (!in_array($driver, $availableDrivers, true)) {\n                throw new InvalidArgumentException(sprintf(\n                    'Resource \"%s\" uses drivers \"%s\", but this driver is not available. Try running \"composer require %s\"',\n                    $resource,\n                    $driver,\n                    $driver,\n                ));\n            }\n\n            if (!in_array($driver, $configuredDrivers, true)) {\n                throw new InvalidArgumentException(sprintf(\n                    'Resource \"%s\" uses drivers \"%s\", but this driver is not enabled. Try adding \"%s\" in sylius_resource.drivers option',\n                    $resource,\n                    $driver,\n                    $driver,\n                ));\n            }\n        }\n    }\n\n    private function loadResources(array $loadedResources, ContainerBuilder $container): void\n    {\n        /** @var array<string, array> $resources */\n        $resources = $container->hasParameter('sylius.resources') ? $container->getParameter('sylius.resources') : [];\n\n        foreach ($loadedResources as $alias => $resourceConfig) {\n            $metadata = Metadata::fromAliasAndConfiguration($alias, $resourceConfig);\n\n            $resources[$alias] = $resourceConfig;\n            $container->setParameter('sylius.resources', $resources);\n\n            if ($metadata->getDriver()) {\n                DriverProvider::get($metadata)->load($container, $metadata);\n            }\n\n            if ($metadata->hasParameter('translation')) {\n                $alias .= '_translation';\n                $resourceConfig = array_merge(['driver' => $resourceConfig['driver']], $resourceConfig['translation']);\n\n                $resources[$alias] = $resourceConfig;\n                $container->setParameter('sylius.resources', $resources);\n\n                $metadata = Metadata::fromAliasAndConfiguration($alias, $resourceConfig);\n\n                if ($metadata->getDriver()) {\n                    DriverProvider::get($metadata)->load($container, $metadata);\n                }\n            }\n        }\n    }\n\n    private function registerMetadataConfiguration(ContainerBuilder $container, array $config): void\n    {\n        $resources = $this->getResourceFilesToWatch($container, $config);\n\n        $container->getDefinition('sylius.metadata.resource_extractor.php_file')->replaceArgument(0, $resources);\n    }\n\n    private function getResourceFilesToWatch(ContainerBuilder $container, array $config): array\n    {\n        $files = [];\n\n        /** @var string $path */\n        foreach ($config['mapping']['imports'] ?? [] as $path) {\n            if (is_dir($path)) {\n                foreach (Finder::create()->followLinks()->files()->in($path)->name('/\\.php$/')->sortByName() as $file) {\n                    $files[] = $file->getRealPath();\n                }\n\n                $container->addResource(new DirectoryResource($path, '/\\.php$/'));\n\n                continue;\n            }\n\n            if ($container->fileExists($path, false)) {\n                if (!str_ends_with($path, '.php')) {\n                    throw new RuntimeException(\\sprintf('Unsupported mapping type in \"%s\", supported type is PHP.', $path));\n                }\n\n                $files[] = $path;\n\n                continue;\n            }\n\n            throw new RuntimeException(\\sprintf('Could not open file or directory \"%s\".', $path));\n        }\n\n        return $files;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Doctrine/ODM/MongoDB/DocumentRepository.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Doctrine\\ODM\\MongoDB;\n\nuse Doctrine\\MongoDB\\Query\\Builder as QueryBuilder;\nuse Doctrine\\ODM\\MongoDB\\DocumentRepository as BaseDocumentRepository;\nuse Pagerfanta\\Doctrine\\MongoDBODM\\QueryAdapter;\nuse Pagerfanta\\Pagerfanta;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\ntrigger_deprecation('sylius/resource-bundle', '1.3', 'The \"%s\" class is deprecated. Doctrine MongoDB and PHPCR support will no longer be supported in 2.0.', DocumentRepository::class);\n\n/**\n * Doctrine ODM driver resource manager.\n */\nclass DocumentRepository extends BaseDocumentRepository implements RepositoryInterface\n{\n    /**\n     * @param int $id\n     */\n    public function find($id): object\n    {\n        return $this\n            ->getQueryBuilder()\n            ->field('id')->equals(new \\MongoId($id))\n            ->getQuery()\n            ->getSingleResult()\n        ;\n    }\n\n    public function findAll(): iterable\n    {\n        return $this\n            ->getCollectionQueryBuilder()\n            ->getQuery()\n            ->getIterator()\n        ;\n    }\n\n    public function findOneBy(array $criteria): object\n    {\n        $queryBuilder = $this->getQueryBuilder();\n\n        $this->applyCriteria($queryBuilder, $criteria);\n\n        return $queryBuilder\n            ->getQuery()\n            ->getSingleResult()\n        ;\n    }\n\n    /**\n     * @param int $limit\n     * @param int $offset\n     */\n    public function findBy(array $criteria, ?array $sorting = null, $limit = null, $offset = null): iterable\n    {\n        $queryBuilder = $this->getCollectionQueryBuilder();\n\n        $this->applyCriteria($queryBuilder, $criteria);\n        $this->applySorting($queryBuilder, $sorting);\n\n        if (null !== $limit) {\n            $queryBuilder->limit($limit);\n        }\n\n        if (null !== $offset) {\n            $queryBuilder->skip($offset);\n        }\n\n        return $queryBuilder\n            ->getQuery()\n            ->getIterator()\n        ;\n    }\n\n    public function createPaginator(array $criteria = [], array $sorting = []): iterable\n    {\n        $queryBuilder = $this->getCollectionQueryBuilder();\n\n        $this->applyCriteria($queryBuilder, $criteria);\n        $this->applySorting($queryBuilder, $sorting);\n\n        return $this->getPaginator($queryBuilder);\n    }\n\n    public function add(ResourceInterface $resource): void\n    {\n        $this->dm->persist($resource);\n        $this->dm->flush();\n    }\n\n    public function remove(ResourceInterface $resource): void\n    {\n        if (null !== $this->find($resource->getId())) {\n            $this->dm->remove($resource);\n            $this->dm->flush();\n        }\n    }\n\n    public function getPaginator(QueryBuilder $queryBuilder): Pagerfanta\n    {\n        return new Pagerfanta(new QueryAdapter($queryBuilder));\n    }\n\n    protected function getQueryBuilder(): QueryBuilder\n    {\n        return $this->createQueryBuilder();\n    }\n\n    protected function getCollectionQueryBuilder(): QueryBuilder\n    {\n        return $this->createQueryBuilder();\n    }\n\n    protected function applyCriteria(QueryBuilder $queryBuilder, array $criteria = []): void\n    {\n        foreach ($criteria as $property => $value) {\n            $queryBuilder->field($property)->equals($value);\n        }\n    }\n\n    protected function applySorting(QueryBuilder $queryBuilder, array $sorting = []): void\n    {\n        foreach ($sorting as $property => $order) {\n            $queryBuilder->sort($property, $order);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Doctrine/ODM/MongoDB/TranslatableRepository.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Doctrine\\ODM\\MongoDB;\n\nuse Doctrine\\MongoDB\\Query\\Builder as QueryBuilder;\nuse Sylius\\Component\\Resource\\Repository\\TranslatableRepositoryInterface;\n\ntrigger_deprecation('sylius/resource-bundle', '1.3', 'The \"%s\" class is deprecated. Doctrine MongoDB and PHPCR support will no longer be supported in 2.0.', TranslatableRepository::class);\n\n/**\n * Doctrine ORM driver translatable entity repository.\n */\nclass TranslatableRepository extends DocumentRepository implements TranslatableRepositoryInterface\n{\n    protected function applyCriteria(QueryBuilder $queryBuilder, ?array $criteria = null): void\n    {\n        if (null === $criteria) {\n            return;\n        }\n\n        foreach ($criteria as $property => $value) {\n            if (is_array($value)) {\n                $queryBuilder\n                    ->field($property)->in($value)\n                ;\n            } elseif ('' !== $value) {\n                $queryBuilder\n                    ->field($property)->equals($value)\n                ;\n            }\n        }\n    }\n\n    protected function applySorting(QueryBuilder $queryBuilder, ?array $sorting = null): void\n    {\n        if (null === $sorting) {\n            return;\n        }\n\n        foreach ($sorting as $property => $order) {\n            $queryBuilder->sort($property, $order);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Doctrine/ODM/PHPCR/DocumentRepository.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Doctrine\\ODM\\PHPCR;\n\nuse Doctrine\\ODM\\PHPCR\\DocumentRepository as BaseDocumentRepository;\nuse Doctrine\\ODM\\PHPCR\\Query\\Builder\\QueryBuilder;\nuse Pagerfanta\\Doctrine\\PHPCRODM\\QueryAdapter;\nuse Pagerfanta\\Pagerfanta;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\ntrigger_deprecation('sylius/resource-bundle', '1.3', 'The \"%s\" class is deprecated. Doctrine MongoDB and PHPCR support will no longer be supported in 2.0.', DocumentRepository::class);\n\n/**\n * Doctrine PHPCR-ODM driver document repository.\n */\nclass DocumentRepository extends BaseDocumentRepository implements RepositoryInterface\n{\n    public function createPaginator(array $criteria = [], array $sorting = []): iterable\n    {\n        $queryBuilder = $this->getCollectionQueryBuilder();\n\n        $this->applyCriteria($queryBuilder, $criteria);\n        $this->applySorting($queryBuilder, $sorting);\n\n        return $this->getPaginator($queryBuilder);\n    }\n\n    public function add(ResourceInterface $resource): void\n    {\n        $this->dm->persist($resource);\n        $this->dm->flush();\n    }\n\n    public function remove(ResourceInterface $resource): void\n    {\n        if (null !== $this->find($resource->getId())) {\n            $this->dm->remove($resource);\n            $this->dm->flush();\n        }\n    }\n\n    public function getPaginator(QueryBuilder $queryBuilder): Pagerfanta\n    {\n        return new Pagerfanta(new QueryAdapter($queryBuilder));\n    }\n\n    protected function getCollectionQueryBuilder(): QueryBuilder\n    {\n        return $this->createQueryBuilder('o');\n    }\n\n    protected function applyCriteria(QueryBuilder $queryBuilder, array $criteria = []): void\n    {\n        $metadata = $this->getClassMetadata();\n        foreach ($criteria as $property => $value) {\n            if (!empty($value)) {\n                if ($property === $metadata->nodename) {\n                    $queryBuilder\n                        ->andWhere()\n                            ->eq()\n                                ->localName($this->getAlias())\n                                ->literal($value)\n                    ;\n                } else {\n                    $queryBuilder\n                        ->andWhere()\n                            ->eq()\n                                ->field($this->getPropertyName($property))\n                                ->literal($value)\n                    ;\n                }\n            }\n        }\n    }\n\n    protected function applySorting(QueryBuilder $queryBuilder, array $sorting = []): void\n    {\n        foreach ($sorting as $property => $order) {\n            if (!empty($order)) {\n                $queryBuilder->orderBy()->{$order}()->field('o.' . $property);\n            }\n        }\n\n        $queryBuilder->end();\n    }\n\n    protected function getPropertyName(string $name): string\n    {\n        if (false === strpos($name, '.')) {\n            return $this->getAlias() . '.' . $name;\n        }\n\n        return $name;\n    }\n\n    protected function getAlias(): string\n    {\n        return 'o';\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Doctrine/ODM/PHPCR/EventListener/DefaultParentListener.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Doctrine\\ODM\\PHPCR\\EventListener;\n\nuse Doctrine\\ODM\\PHPCR\\DocumentManagerInterface;\nuse Doctrine\\ODM\\PHPCR\\Mapping\\ClassMetadata;\nuse PHPCR\\Util\\NodeHelper;\nuse Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent;\n\ntrigger_deprecation('sylius/resource-bundle', '1.3', 'The \"%s\" class is deprecated. Doctrine MongoDB and PHPCR support will no longer be supported in 2.0.', DefaultParentListener::class);\n\n/**\n * Automatically set the parent brefore the creation.\n */\nclass DefaultParentListener\n{\n    /** @var DocumentManagerInterface */\n    private $documentManager;\n\n    private string $parentPath;\n\n    private bool $autocreate;\n\n    private bool $force;\n\n    /**\n     * @param string $parentPath\n     * @param bool $autocreate\n     * @param bool $force\n     */\n    public function __construct(\n        DocumentManagerInterface $documentManager,\n        $parentPath,\n        $autocreate = false,\n        $force = false,\n    ) {\n        $this->documentManager = $documentManager;\n        $this->parentPath = $parentPath;\n        $this->autocreate = $autocreate;\n        $this->force = $force;\n    }\n\n    public function onPreCreate(ResourceControllerEvent $event)\n    {\n        $document = $event->getSubject();\n        $class = get_class($document);\n\n        $this->resolveParent(\n            $document,\n            $this->documentManager->getClassMetadata($class),\n        );\n    }\n\n    private function resolveParent(\n        $document,\n        ClassMetadata $metadata,\n    ) {\n        if (!$parentField = $metadata->parentMapping) {\n            throw new \\RuntimeException(sprintf(\n                'A default parent path has been specified, but no parent mapping has been applied to document \"%s\"',\n                get_class($document),\n            ));\n        }\n\n        if (false === $this->force) {\n            $actualParent = $metadata->getFieldValue($document, $parentField);\n\n            if ($actualParent) {\n                return;\n            }\n        }\n\n        $parentDocument = $this->documentManager->find(null, $this->parentPath);\n\n        if (true === $this->autocreate && null === $parentDocument) {\n            NodeHelper::createPath($this->documentManager->getPhpcrSession(), $this->parentPath);\n            $parentDocument = $this->documentManager->find(null, $this->parentPath);\n        }\n\n        if (null === $parentDocument) {\n            throw new \\RuntimeException(sprintf(\n                'Document at default parent path \"%s\" does not exist. `autocreate` was set to \"%s\"',\n                $this->parentPath,\n                $this->autocreate ? 'true' : 'false',\n            ));\n        }\n\n        $metadata->setFieldValue($document, $parentField, $parentDocument);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Doctrine/ODM/PHPCR/EventListener/NameFilterListener.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Doctrine\\ODM\\PHPCR\\EventListener;\n\nuse Doctrine\\ODM\\PHPCR\\DocumentManagerInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent;\n\ntrigger_deprecation('sylius/resource-bundle', '1.3', 'The \"%s\" class is deprecated. Doctrine MongoDB and PHPCR support will no longer be supported in 2.0.', NameFilterListener::class);\n\n/**\n * Filter the node name field, replacing invalid characters with a substitute\n * characters.\n *\n * @see http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#3.2.2%20Local%20Names\n * @see https://github.com/phpcr/phpcr-utils/blob/master/src/PHPCR/Util/PathHelper.php#L95\n */\nclass NameFilterListener\n{\n    /** @var DocumentManagerInterface */\n    private $documentManager;\n\n    /** @var string */\n    private $replacementCharacter;\n\n    public function __construct(\n        DocumentManagerInterface $documentManager,\n        $replacementCharacter = ' ',\n    ) {\n        $this->documentManager = $documentManager;\n        $this->replacementCharacter = $replacementCharacter;\n    }\n\n    public function onEvent(ResourceControllerEvent $event)\n    {\n        $document = $event->getSubject();\n\n        $metadata = $this->documentManager->getClassMetadata(get_class($document));\n\n        if (null === $nameField = $metadata->nodename) {\n            throw new \\RuntimeException(sprintf(\n                'In order to use the node name filter on \"%s\" it is necessary to map a field as the \"nodename\"',\n                get_class($document),\n            ));\n        }\n\n        $name = $metadata->getFieldValue($document, $nameField);\n        $name = preg_replace('/\\\\/|:|\\\\[|\\\\]|\\\\||\\\\*/', $this->replacementCharacter, $name);\n        $metadata->setFieldValue($document, $nameField, $name);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Doctrine/ODM/PHPCR/EventListener/NameResolverListener.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Doctrine\\ODM\\PHPCR\\EventListener;\n\nuse Doctrine\\ODM\\PHPCR\\DocumentManagerInterface;\nuse Doctrine\\ODM\\PHPCR\\Mapping\\ClassMetadata;\nuse Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent;\n\ntrigger_deprecation('sylius/resource-bundle', '1.3', 'The \"%s\" class is deprecated. Doctrine MongoDB and PHPCR support will no longer be supported in 2.0.', NameResolverListener::class);\n\n/**\n * Handles the resolution of the PHPCR node name field.\n *\n * If a node already exists with the same name, then a numerical index will be\n * appended to the name.\n */\nclass NameResolverListener\n{\n    /** @var DocumentManagerInterface */\n    private $documentManager;\n\n    public function __construct(\n        DocumentManagerInterface $documentManager,\n    ) {\n        $this->documentManager = $documentManager;\n    }\n\n    public function onEvent(ResourceControllerEvent $event)\n    {\n        $document = $event->getSubject();\n\n        $metadata = $this->documentManager->getClassMetadata(get_class($document));\n\n        if ($metadata->idGenerator !== ClassMetadata::GENERATOR_TYPE_PARENT) {\n            throw new \\RuntimeException(sprintf(\n                'Document of class \"%s\" must be using the GENERATOR_TYPE_PARENT identificatio strategy (value %s), it is current using \"%s\" (this may be an automatic configuration: be sure to map both the `nodename` and the `parentDocument`).',\n                get_class($document),\n                ClassMetadata::GENERATOR_TYPE_PARENT,\n                $metadata->idGenerator,\n            ));\n        }\n\n        // NOTE: that the PHPCR-ODM requires these two fields to be set when\n        //       when the GENERATOR_TYPE_PARENT \"ID\" strategy is used.\n        $nameField = $metadata->nodename;\n        $parentField = $metadata->parentMapping;\n\n        $parentDocument = $metadata->getFieldValue($document, $parentField);\n        $phpcrNode = $this->documentManager->getNodeForDocument($parentDocument);\n        $parentPath = $phpcrNode->getPath();\n\n        $baseCandidateName = $metadata->getFieldValue($document, $nameField);\n        $candidateName = $baseCandidateName;\n\n        $index = 1;\n        while (true) {\n            $candidatePath = sprintf('%s/%s', $parentPath, $candidateName);\n            $existing = $this->documentManager->find(null, $candidatePath);\n\n            // if the existing document is the document we are updating, then thats great.\n            if ($existing === $document) {\n                return;\n            }\n\n            if (null === $existing) {\n                $metadata->setFieldValue($document, $nameField, $candidateName);\n\n                return;\n            }\n\n            $candidateName = sprintf('%s-%d', $baseCandidateName, $index);\n            ++$index;\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Doctrine/ODM/PHPCR/Form/Builder/DefaultFormBuilder.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Doctrine\\ODM\\PHPCR\\Form\\Builder;\n\nuse Doctrine\\ODM\\PHPCR\\DocumentManagerInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Builder\\DefaultFormBuilderInterface;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\n\ntrigger_deprecation('sylius/resource-bundle', '1.3', 'The \"%s\" class is deprecated. Doctrine MongoDB and PHPCR support will no longer be supported in 2.0.', DefaultFormBuilder::class);\n\nclass DefaultFormBuilder implements DefaultFormBuilderInterface\n{\n    /** @var DocumentManagerInterface */\n    private $documentManager;\n\n    public function __construct(\n        DocumentManagerInterface $documentManager,\n    ) {\n        $this->documentManager = $documentManager;\n    }\n\n    public function build(MetadataInterface $metadata, FormBuilderInterface $formBuilder, array $options): void\n    {\n        $classMetadata = $this->documentManager->getClassMetadata($metadata->getClass('model'));\n\n        // the field mappings should only contain standard value mappings\n        foreach ($classMetadata->fieldMappings as $fieldName) {\n            if ($fieldName === $classMetadata->uuidFieldName) {\n                continue;\n            }\n            if ($fieldName === $classMetadata->nodename) {\n                continue;\n            }\n\n            $options = [];\n\n            $mapping = $classMetadata->mappings[$fieldName];\n\n            if ($mapping['nullable'] === false) {\n                $options['required'] = true;\n            }\n\n            $formBuilder->add($fieldName, null, $options);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Doctrine/ORM/ContainerRepositoryFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM;\n\nuse Doctrine\\ORM\\EntityManagerInterface;\nuse Doctrine\\ORM\\EntityRepository as DoctrineEntityRepository;\nuse Doctrine\\ORM\\Mapping\\ClassMetadata;\nuse Doctrine\\ORM\\Repository\\RepositoryFactory;\n\nfinal class ContainerRepositoryFactory implements RepositoryFactory\n{\n    private RepositoryFactory $doctrineFactory;\n\n    /** @var string[] */\n    private array $genericEntities;\n\n    /** @var DoctrineEntityRepository[] */\n    private array $managedRepositories = [];\n\n    /**\n     * @param string[] $genericEntities\n     */\n    public function __construct(RepositoryFactory $doctrineFactory, array $genericEntities)\n    {\n        $this->doctrineFactory = $doctrineFactory;\n        $this->genericEntities = $genericEntities;\n    }\n\n    /**\n     * @psalm-suppress InvalidReturnStatement\n     * @psalm-suppress InvalidReturnType\n     */\n    public function getRepository(EntityManagerInterface $entityManager, $entityName): DoctrineEntityRepository\n    {\n        $metadata = $entityManager->getClassMetadata($entityName);\n\n        if ($metadata->customRepositoryClassName === null && in_array($entityName, $this->genericEntities, true)) {\n            /** @psalm-suppress InvalidReturnStatement */\n            return $this->getOrCreateRepository($entityManager, $metadata);\n        }\n\n        /** @var DoctrineEntityRepository $repository */\n        $repository = $this->doctrineFactory->getRepository($entityManager, $entityName);\n\n        return $repository;\n    }\n\n    private function getOrCreateRepository(\n        EntityManagerInterface $entityManager,\n        ClassMetadata $metadata,\n    ): DoctrineEntityRepository {\n        $repositoryHash = $metadata->getName() . spl_object_hash($entityManager);\n\n        if (!isset($this->managedRepositories[$repositoryHash])) {\n            $this->managedRepositories[$repositoryHash] = new EntityRepository($entityManager, $metadata);\n        }\n\n        return $this->managedRepositories[$repositoryHash];\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Doctrine/ORM/CreatePaginatorTrait.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM;\n\nuse Doctrine\\ORM\\EntityRepository as DoctrineEntityRepository;\nuse Doctrine\\ORM\\QueryBuilder;\nuse Pagerfanta\\Adapter\\ArrayAdapter;\nuse Pagerfanta\\Doctrine\\ORM\\QueryAdapter;\nuse Pagerfanta\\Pagerfanta;\nuse Pagerfanta\\PagerfantaInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\n/**\n * @mixin DoctrineEntityRepository\n */\ntrait CreatePaginatorTrait\n{\n    /**\n     * @return iterable<int, ResourceInterface>\n     */\n    public function createPaginator(array $criteria = [], array $sorting = []): iterable\n    {\n        $queryBuilder = $this->createQueryBuilder('o');\n\n        $this->applyCriteria($queryBuilder, $criteria);\n        $this->applySorting($queryBuilder, $sorting);\n\n        return $this->getPaginator($queryBuilder);\n    }\n\n    protected function getPaginator(QueryBuilder $queryBuilder): PagerfantaInterface\n    {\n        if (!class_exists(QueryAdapter::class)) {\n            throw new \\LogicException('You can not use the \"paginator\" if Pargefanta Doctrine ORM Adapter is not available. Try running \"composer require pagerfanta/doctrine-orm-adapter\".');\n        }\n\n        // Use output walkers option in the query adapter should be false as it affects performance greatly (see sylius/sylius#3775)\n        return new Pagerfanta(new QueryAdapter($queryBuilder, false, false));\n    }\n\n    /**\n     * @param array $objects\n     */\n    protected function getArrayPaginator($objects): PagerfantaInterface\n    {\n        return new Pagerfanta(new ArrayAdapter($objects));\n    }\n\n    protected function applyCriteria(QueryBuilder $queryBuilder, array $criteria = []): void\n    {\n        foreach ($criteria as $property => $value) {\n            if (!in_array($property, array_merge($this->getClassMetadata()->getAssociationNames(), $this->getClassMetadata()->getFieldNames()), true)) {\n                continue;\n            }\n\n            $name = $this->getPropertyName($property);\n\n            if (null === $value) {\n                $queryBuilder->andWhere($queryBuilder->expr()->isNull($name));\n            } elseif (is_array($value)) {\n                $queryBuilder->andWhere($queryBuilder->expr()->in($name, $value));\n            } elseif ('' !== $value) {\n                $parameter = str_replace('.', '_', $property);\n                $queryBuilder\n                    ->andWhere($queryBuilder->expr()->eq($name, ':' . $parameter))\n                    ->setParameter($parameter, $value)\n                ;\n            }\n        }\n    }\n\n    protected function applySorting(QueryBuilder $queryBuilder, array $sorting = []): void\n    {\n        foreach ($sorting as $property => $order) {\n            if (!in_array($property, array_merge($this->getClassMetadata()->getAssociationNames(), $this->getClassMetadata()->getFieldNames()), true)) {\n                continue;\n            }\n\n            if (!empty($order)) {\n                $queryBuilder->addOrderBy($this->getPropertyName($property), $order);\n            }\n        }\n    }\n\n    protected function getPropertyName(string $name): string\n    {\n        if (!str_contains($name, '.')) {\n            return 'o' . '.' . $name;\n        }\n\n        return $name;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Doctrine/ORM/EntityRepository.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM;\n\nuse Doctrine\\ORM\\EntityRepository as BaseEntityRepository;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\n\n/** @psalm-suppress DeprecatedInterface */\nclass EntityRepository extends BaseEntityRepository implements RepositoryInterface\n{\n    use ResourceRepositoryTrait;\n}\n"
  },
  {
    "path": "src/Bundle/Doctrine/ORM/Form/Builder/DefaultFormBuilder.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\Form\\Builder;\n\nuse Doctrine\\DBAL\\Types\\Types;\nuse Doctrine\\ORM\\EntityManagerInterface;\nuse Doctrine\\ORM\\Mapping\\ClassMetadata;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Builder\\DefaultFormBuilderInterface;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Webmozart\\Assert\\Assert;\n\nclass DefaultFormBuilder implements DefaultFormBuilderInterface\n{\n    private EntityManagerInterface $entityManager;\n\n    public function __construct(EntityManagerInterface $entityManager)\n    {\n        $this->entityManager = $entityManager;\n    }\n\n    public function build(MetadataInterface $metadata, FormBuilderInterface $formBuilder, array $options): void\n    {\n        $classMetadata = $this->entityManager->getClassMetadata($metadata->getClass('model'));\n\n        if (1 < count($classMetadata->identifier)) {\n            throw new \\RuntimeException('The default form factory does not support entity classes with multiple primary keys.');\n        }\n\n        $this->doBuild($classMetadata, $formBuilder);\n    }\n\n    private function doBuild(ClassMetadata $classMetadata, FormBuilderInterface $formBuilder): void\n    {\n        $fields = $classMetadata->fieldNames;\n\n        if (!$classMetadata->isIdentifierNatural()) {\n            $fields = array_diff($fields, $classMetadata->identifier);\n        }\n\n        foreach ($fields as $fieldName) {\n            $options = [];\n\n            // Skip fields coming from embeddables\n            if (strpos($fieldName, '.') !== false) {\n                continue;\n            }\n\n            if (in_array($fieldName, ['createdAt', 'updatedAt'], true)) {\n                continue;\n            }\n\n            if (Types::DATETIME_MUTABLE === $classMetadata->getTypeOfField($fieldName)) {\n                $options = ['widget' => 'single_text'];\n            }\n\n            $formBuilder->add($fieldName, null, $options);\n        }\n\n        foreach ($classMetadata->embeddedClasses as $fieldName => $embeddedMapping) {\n            $nestedFormBuilder = $formBuilder->create($fieldName, null, ['data_class' => $embeddedMapping['class'], 'compound' => true]);\n\n            Assert::stringNotEmpty($embeddedMapping['class']);\n\n            $this->doBuild($this->entityManager->getClassMetadata($embeddedMapping['class']), $nestedFormBuilder);\n\n            $formBuilder->add($nestedFormBuilder);\n        }\n\n        foreach ($classMetadata->getAssociationMappings() as $fieldName => $associationMapping) {\n            if (ClassMetadata::ONE_TO_MANY !== $associationMapping['type']) {\n                $formBuilder->add($fieldName, null, ['choice_label' => 'id']);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Doctrine/ORM/ResourceLogEntryRepository.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM;\n\nuse Doctrine\\ORM\\QueryBuilder;\n\n/** @psalm-suppress DeprecatedInterface */\nfinal class ResourceLogEntryRepository extends EntityRepository implements ResourceLogEntryRepositoryInterface\n{\n    public function createByObjectIdQueryBuilder(string $objectId): QueryBuilder\n    {\n        return $this->createQueryBuilder('log')\n            ->where('log.objectId = :objectId')\n            ->setParameter('objectId', $objectId)\n        ;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Doctrine/ORM/ResourceLogEntryRepositoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM;\n\nuse Doctrine\\ORM\\QueryBuilder;\n\ninterface ResourceLogEntryRepositoryInterface\n{\n    public function createByObjectIdQueryBuilder(string $objectId): QueryBuilder;\n}\n"
  },
  {
    "path": "src/Bundle/Doctrine/ORM/ResourceRepositoryTrait.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM;\n\nuse Doctrine\\ORM\\EntityRepository as DoctrineEntityRepository;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\n/**\n * @mixin DoctrineEntityRepository\n */\ntrait ResourceRepositoryTrait\n{\n    use CreatePaginatorTrait;\n\n    public function add(ResourceInterface $resource): void\n    {\n        $this->getEntityManager()->persist($resource);\n        $this->getEntityManager()->flush();\n    }\n\n    public function remove(ResourceInterface $resource): void\n    {\n        if (null !== $this->find($resource->getId())) {\n            $this->getEntityManager()->remove($resource);\n            $this->getEntityManager()->flush();\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Doctrine/ResourceMappingDriverChain.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Doctrine;\n\nuse Doctrine\\Persistence\\Mapping\\ClassMetadata;\nuse Doctrine\\Persistence\\Mapping\\Driver\\MappingDriver;\nuse Doctrine\\Persistence\\Mapping\\Driver\\MappingDriverChain;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\n\n/**\n * It needs to extend MappingDriverChain in order to be compatible with Gedmo/DoctrineExtensions.\n *\n * @see \\Gedmo\\Mapping\\ExtensionMetadataFactory::getDriver()\n */\nfinal class ResourceMappingDriverChain extends MappingDriverChain\n{\n    private RegistryInterface $resourceRegistry;\n\n    public function __construct(MappingDriver $mappingDriver, RegistryInterface $resourceRegistry)\n    {\n        $this->resourceRegistry = $resourceRegistry;\n\n        $this->setDefaultDriver($mappingDriver);\n    }\n\n    public function loadMetadataForClass($className, ClassMetadata $metadata): void\n    {\n        parent::loadMetadataForClass($className, $metadata);\n\n        $this->convertResourceMappedSuperclass($metadata);\n    }\n\n    /**\n     * @psalm-suppress NoInterfaceProperties https://github.com/vimeo/psalm/issues/2206\n     */\n    private function convertResourceMappedSuperclass(ClassMetadata $metadata): void\n    {\n        if (!isset($metadata->isMappedSuperclass)) {\n            return;\n        }\n\n        if (false === $metadata->isMappedSuperclass) {\n            return;\n        }\n\n        try {\n            $resourceMetadata = $this->resourceRegistry->getByClass($metadata->getName());\n        } catch (\\InvalidArgumentException $exception) {\n            return;\n        }\n\n        if ($metadata->getName() !== $resourceMetadata->getClass('model')) {\n            return;\n        }\n\n        $metadata->isMappedSuperclass = false;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Event/ResourceControllerEvent.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Event;\n\n\\class_exists(\\Sylius\\Resource\\Symfony\\EventDispatcher\\GenericEvent::class);\n\nif (false) {\n    class ResourceControllerEvent extends \\Sylius\\Resource\\Symfony\\EventDispatcher\\GenericEvent\n    {\n    }\n}\n"
  },
  {
    "path": "src/Bundle/EventListener/AbstractDoctrineListener.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\EventListener;\n\nuse Doctrine\\Persistence\\Mapping\\ClassMetadata;\nuse Doctrine\\Persistence\\Mapping\\ReflectionService;\nuse Doctrine\\Persistence\\Mapping\\RuntimeReflectionService;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\nabstract class AbstractDoctrineListener\n{\n    protected RegistryInterface $resourceRegistry;\n\n    private ?RuntimeReflectionService $reflectionService = null;\n\n    public function __construct(RegistryInterface $resourceRegistry)\n    {\n        $this->resourceRegistry = $resourceRegistry;\n    }\n\n    protected function isResource(ClassMetadata $metadata): bool\n    {\n        return $metadata->getReflectionClass()->implementsInterface(ResourceInterface::class);\n    }\n\n    /**\n     * @psalm-suppress InvalidReturnType\n     */\n    protected function getReflectionService(): ReflectionService\n    {\n        if ($this->reflectionService === null) {\n            $this->reflectionService = new RuntimeReflectionService();\n        }\n\n        /** @psalm-suppress InvalidReturnStatement */\n        return $this->reflectionService;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/EventListener/AbstractDoctrineSubscriber.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\EventListener;\n\nuse Doctrine\\Common\\EventSubscriber;\n\ntrigger_deprecation('sylius/resource-bundle', '1.10', 'The \"%s\" class is deprecated, use %s instead. It will be removed in 2.0.', AbstractDoctrineSubscriber::class, AbstractDoctrineListener::class);\n\nabstract class AbstractDoctrineSubscriber extends AbstractDoctrineListener implements EventSubscriber\n{\n}\n"
  },
  {
    "path": "src/Bundle/EventListener/ODMMappedSuperClassSubscriber.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\EventListener;\n\nuse Doctrine\\ODM\\MongoDB\\Event\\LoadClassMetadataEventArgs;\nuse Doctrine\\ODM\\MongoDB\\Events;\nuse Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata;\nuse Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataInfo;\n\ntrigger_deprecation('sylius/resource-bundle', '1.3', 'The \"%s\" class is deprecated. Doctrine MongoDB and PHPCR support will no longer be supported in 2.0.', ODMMappedSuperClassSubscriber::class);\n\n/**\n * Doctrine listener used to manipulate mappings.\n */\nfinal class ODMMappedSuperClassSubscriber extends AbstractDoctrineSubscriber\n{\n    /**\n     * @return array\n     */\n    public function getSubscribedEvents()\n    {\n        return [\n            Events::loadClassMetadata,\n        ];\n    }\n\n    public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)\n    {\n        $metadata = $eventArgs->getClassMetadata();\n\n        $this->convertToDocumentIfNeeded($metadata);\n\n        if (!$metadata->isMappedSuperclass) {\n            $this->setAssociationMappings($metadata, $eventArgs->getDocumentManager()->getConfiguration());\n        } else {\n            $this->unsetAssociationMappings($metadata);\n        }\n    }\n\n    private function convertToDocumentIfNeeded(ClassMetadataInfo $metadata)\n    {\n        if (false === $metadata->isMappedSuperclass) {\n            return;\n        }\n\n        try {\n            $resourceMetadata = $this->resourceRegistry->getByClass($metadata->getName());\n        } catch (\\InvalidArgumentException $exception) {\n            return;\n        }\n\n        if ($metadata->getName() === $resourceMetadata->getClass('model')) {\n            $metadata->isMappedSuperclass = false;\n        }\n    }\n\n    /**\n     * @param $configuration\n     */\n    private function setAssociationMappings(ClassMetadataInfo $metadata, $configuration)\n    {\n        foreach (class_parents($metadata->getName()) as $parent) {\n            if (false === in_array($parent, $configuration->getMetadataDriverImpl()->getAllClassNames())) {\n                continue;\n            }\n\n            $parentMetadata = new ClassMetadata(\n                $parent,\n                $configuration->getNamingStrategy(),\n            );\n\n            // Wakeup Reflection\n            $parentMetadata->wakeupReflection($this->getReflectionService());\n\n            // Load Metadata\n            $configuration->getMetadataDriverImpl()->loadMetadataForClass($parent, $parentMetadata);\n\n            if (false === $this->isResource($parentMetadata)) {\n                continue;\n            }\n\n            if ($parentMetadata->isMappedSuperclass) {\n                foreach ($parentMetadata->associationMappings as $key => $value) {\n                    if ($this->isRelation($value['association']) && !isset($metadata->associationMappings[$key])) {\n                        $metadata->associationMappings[$key] = $value;\n                    }\n                }\n            }\n        }\n    }\n\n    private function unsetAssociationMappings(ClassMetadataInfo $metadata)\n    {\n        if (false === $this->isResource($metadata)) {\n            return;\n        }\n\n        foreach ($metadata->associationMappings as $key => $value) {\n            if ($this->isRelation($value['association'])) {\n                unset($metadata->associationMappings[$key]);\n            }\n        }\n    }\n\n    /**\n     * @param string $type\n     *\n     * @return bool\n     */\n    private function isRelation($type)\n    {\n        return in_array(\n            $type,\n            [\n                ClassMetadataInfo::REFERENCE_ONE,\n                ClassMetadataInfo::REFERENCE_MANY,\n                ClassMetadataInfo::EMBED_ONE,\n                ClassMetadataInfo::EMBED_MANY,\n            ],\n            true,\n        );\n    }\n}\n"
  },
  {
    "path": "src/Bundle/EventListener/ODMRepositoryClassSubscriber.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\EventListener;\n\nuse Doctrine\\ODM\\MongoDB\\Event\\LoadClassMetadataEventArgs;\nuse Doctrine\\ODM\\MongoDB\\Events;\nuse Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata;\n\ntrigger_deprecation('sylius/resource-bundle', '1.3', 'The \"%s\" class is deprecated. Doctrine MongoDB and PHPCR support will no longer be supported in 2.0.', ODMRepositoryClassSubscriber::class);\n\nfinal class ODMRepositoryClassSubscriber extends AbstractDoctrineSubscriber\n{\n    /**\n     * @return array\n     */\n    public function getSubscribedEvents()\n    {\n        return [\n            Events::loadClassMetadata,\n        ];\n    }\n\n    public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)\n    {\n        $this->setCustomRepositoryClass($eventArgs->getClassMetadata());\n    }\n\n    private function setCustomRepositoryClass(ClassMetadata $metadata)\n    {\n        try {\n            $resourceMetadata = $this->resourceRegistry->getByClass($metadata->getName());\n        } catch (\\InvalidArgumentException $exception) {\n            return;\n        }\n\n        if ($resourceMetadata->hasClass('repository')) {\n            $metadata->setCustomRepositoryClass($resourceMetadata->getClass('repository'));\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/EventListener/ODMTranslatableListener.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\EventListener;\n\nuse Doctrine\\Common\\EventSubscriber;\nuse Doctrine\\ODM\\MongoDB\\Event\\LifecycleEventArgs;\nuse Doctrine\\ODM\\MongoDB\\Event\\LoadClassMetadataEventArgs;\nuse Doctrine\\ODM\\MongoDB\\Events;\nuse Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata;\nuse Sylius\\Resource\\Model\\TranslatableInterface;\nuse Sylius\\Resource\\Model\\TranslationInterface;\n\ntrigger_deprecation('sylius/resource-bundle', '1.3', 'The \"%s\" class is deprecated. Doctrine MongoDB and PHPCR support will no longer be supported in 2.0.', ODMTranslatableListener::class);\n\nfinal class ODMTranslatableListener implements EventSubscriber\n{\n    /** @var string */\n    private $currentLocale;\n\n    private string $fallbackLocale;\n\n    private array $mappings;\n\n    /**\n     * @param string $fallbackLocale\n     */\n    public function __construct(array $mappings, $fallbackLocale)\n    {\n        $this->mappings = $mappings;\n        $this->fallbackLocale = $fallbackLocale;\n    }\n\n    public function setCurrentLocale($currentLocale)\n    {\n        $this->currentLocale = $currentLocale;\n\n        return $this;\n    }\n\n    public function getSubscribedEvents()\n    {\n        return [\n            Events::loadClassMetadata,\n            Events::postLoad,\n        ];\n    }\n\n    /**\n     * Add mapping to translatable entities\n     */\n    public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)\n    {\n        $classMetadata = $eventArgs->getClassMetadata();\n        $reflection = $classMetadata->reflClass;\n\n        if (!$reflection || $reflection->isAbstract()) {\n            return;\n        }\n\n        if ($reflection->implementsInterface(TranslatableInterface::class)) {\n            $this->mapTranslatable($classMetadata);\n        }\n\n        if ($reflection->implementsInterface(TranslationInterface::class)) {\n            $this->mapTranslation($classMetadata);\n        }\n    }\n\n    /**\n     * Add mapping data to a translatable entity\n     */\n    private function mapTranslatable(ClassMetadata $metadata)\n    {\n        // In the case A -> B -> TranslatableInterface, B might not have mapping defined as it\n        // is probably defined in A, so in that case, we just return.\n        if (!isset($this->mappings[$metadata->name])) {\n            return;\n        }\n\n        $config = $this->mappings[$metadata->name];\n        $mapping = $config['translation']['mapping'];\n\n        $metadata->mapManyEmbedded([\n            'fieldName' => $mapping['translatable']['translations'],\n            'targetDocument' => $config['translation']['model'],\n            'strategy' => 'set',\n        ]);\n    }\n\n    /**\n     * Add mapping data to a translation entity\n     */\n    private function mapTranslation(ClassMetadata $metadata)\n    {\n        // In the case A -> B -> TranslationInterface, B might not have mapping defined as it\n        // is probably defined in A, so in that case, we just return;\n        if (!isset($this->mappings[$metadata->name])) {\n            return;\n        }\n\n        $config = $this->mappings[$metadata->name];\n        $mapping = $config['translation']['mapping'];\n\n        $metadata->isEmbeddedDocument = true;\n        $metadata->isMappedSuperclass = false;\n        $metadata->setIdentifier(null);\n\n        // Map locale field.\n        if (!$metadata->hasField($mapping['translation']['locale'])) {\n            $metadata->mapField([\n                'fieldName' => $mapping['translation']['locale'],\n                'type' => 'string',\n            ]);\n        }\n\n        // Map unique index.\n        $keys = [\n            $mapping['translation']['translatable'] => 1,\n            $mapping['translation']['locale'] => 1,\n        ];\n\n        if (!$this->hasUniqueIndex($metadata, $keys)) {\n            $metadata->addIndex($keys, [\n                'unique' => true,\n            ]);\n        }\n    }\n\n    /**\n     * Load translations\n     */\n    public function postLoad(LifecycleEventArgs $args)\n    {\n        $document = $args->getDocument();\n\n        // Sometimes $document is a doctrine proxy class, we therefore need to retrieve it's real class\n        $name = $args->getDocumentManager()->getClassMetadata(get_class($document))->getName();\n\n        if (!isset($this->mappings[$name])) {\n            return;\n        }\n\n        $metadata = $this->mappings[$name];\n\n        if (isset($metadata['fallback_locale'])) {\n            $setter = 'set' . ucfirst($metadata['fallback_locale']);\n            $document->$setter($this->fallbackLocale);\n        }\n        if (isset($metadata['current_locale'])) {\n            $setter = 'set' . ucfirst($metadata['current_locale']);\n            $document->$setter($this->currentLocale);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/EventListener/ORMMappedSuperClassSubscriber.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\EventListener;\n\nuse Doctrine\\Common\\EventSubscriber;\nuse Doctrine\\ORM\\Configuration;\nuse Doctrine\\ORM\\Event\\LoadClassMetadataEventArgs;\nuse Doctrine\\ORM\\Events;\nuse Doctrine\\ORM\\Mapping\\AssociationMapping;\nuse Doctrine\\ORM\\Mapping\\ClassMetadata;\nuse Doctrine\\Persistence\\Mapping\\Driver\\MappingDriver;\nuse Webmozart\\Assert\\Assert;\n\nfinal class ORMMappedSuperClassSubscriber extends AbstractDoctrineListener implements EventSubscriber\n{\n    /**\n     * @deprecated since version 1.10, It will be removed in 2.0.\n     */\n    public function getSubscribedEvents(): array\n    {\n        return [\n            Events::loadClassMetadata,\n        ];\n    }\n\n    public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void\n    {\n        $metadata = $eventArgs->getClassMetadata();\n\n        if (!$metadata->isMappedSuperclass) {\n            $this->setAssociationMappings($metadata, $eventArgs->getEntityManager()->getConfiguration());\n        } else {\n            $this->unsetAssociationMappings($metadata);\n        }\n    }\n\n    private function setAssociationMappings(ClassMetadata $metadata, Configuration $configuration): void\n    {\n        $class = $metadata->getName();\n        if (!class_exists($class)) {\n            return;\n        }\n\n        /** @psalm-suppress DeprecatedClass */\n        $metadataDriver = $configuration->getMetadataDriverImpl();\n        Assert::isInstanceOf($metadataDriver, MappingDriver::class);\n\n        $parents = class_parents($class) ?: [];\n\n        foreach ($parents as $parent) {\n            if (false === in_array($parent, $metadataDriver->getAllClassNames(), true)) {\n                continue;\n            }\n\n            $parentMetadata = new ClassMetadata(\n                $parent,\n                $configuration->getNamingStrategy(),\n            );\n\n            // Wakeup Reflection\n            /** @psalm-suppress ArgumentTypeCoercion */\n            $parentMetadata->wakeupReflection($this->getReflectionService());\n\n            // Load Metadata\n            $metadataDriver->loadMetadataForClass($parent, $parentMetadata);\n\n            /** @psalm-suppress InvalidArgument */\n            if (false === $this->isResource($parentMetadata)) {\n                continue;\n            }\n\n            if ($parentMetadata->isMappedSuperclass) {\n                /**\n                 * @var AssociationMapping|array{type: int} $value\n                 */\n                foreach ($parentMetadata->getAssociationMappings() as $key => $value) {\n                    $type = \\is_array($value) ? $value['type'] : $value->type();\n                    if ($this->isRelation($type) && !isset($metadata->associationMappings[$key])) {\n                        if (\\is_array($value)) {\n                            $value['sourceEntity'] = $class;\n                        } else {\n                            /** @psalm-suppress UndefinedClass */\n                            $value->sourceEntity = $class; /** @phpstan-ignore-line */\n                        }\n\n                        $metadata->associationMappings[$key] = $value; /** @phpstan-ignore-line */\n                    }\n                }\n            }\n        }\n    }\n\n    private function unsetAssociationMappings(ClassMetadata $metadata): void\n    {\n        /** @psalm-suppress InvalidArgument */\n        if (false === $this->isResource($metadata)) {\n            return;\n        }\n\n        /**\n         * @var AssociationMapping|array{type: int} $value\n         */\n        foreach ($metadata->getAssociationMappings() as $key => $value) {\n            $type = \\is_array($value) ? $value['type'] : $value->type();\n            if ($this->isRelation($type)) {\n                unset($metadata->associationMappings[$key]);\n            }\n        }\n    }\n\n    private function isRelation(int $type): bool\n    {\n        return in_array(\n            $type,\n            [\n                ClassMetadata::MANY_TO_MANY,\n                ClassMetadata::ONE_TO_MANY,\n                ClassMetadata::ONE_TO_ONE,\n            ],\n            true,\n        );\n    }\n}\n"
  },
  {
    "path": "src/Bundle/EventListener/ORMRepositoryClassSubscriber.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\EventListener;\n\nuse Doctrine\\Common\\EventSubscriber;\nuse Doctrine\\ORM\\EntityRepository;\nuse Doctrine\\ORM\\Event\\LoadClassMetadataEventArgs;\nuse Doctrine\\ORM\\Events;\nuse Doctrine\\ORM\\Mapping\\ClassMetadata;\n\nfinal class ORMRepositoryClassSubscriber extends AbstractDoctrineListener implements EventSubscriber\n{\n    /**\n     * @deprecated since version 1.10, It will be removed in 2.0.\n     */\n    public function getSubscribedEvents(): array\n    {\n        return [\n            Events::loadClassMetadata,\n        ];\n    }\n\n    public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void\n    {\n        $this->setCustomRepositoryClass($eventArgs->getClassMetadata());\n    }\n\n    private function setCustomRepositoryClass(ClassMetadata $metadata): void\n    {\n        try {\n            $resourceMetadata = $this->resourceRegistry->getByClass($metadata->getName());\n        } catch (\\InvalidArgumentException $exception) {\n            return;\n        }\n\n        if ($resourceMetadata->hasClass('repository')) {\n            /** @psalm-var class-string<EntityRepository>|null $repository */\n            $repository = $resourceMetadata->getClass('repository');\n            $metadata->setCustomRepositoryClass($repository);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/EventListener/ORMTranslatableListener.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\EventListener;\n\nuse Doctrine\\Common\\EventSubscriber;\nuse Doctrine\\ORM\\Event\\LoadClassMetadataEventArgs;\nuse Doctrine\\ORM\\Event\\PostLoadEventArgs;\nuse Doctrine\\ORM\\Events;\nuse Doctrine\\ORM\\Mapping\\ClassMetadata;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Model\\TranslatableInterface;\nuse Sylius\\Resource\\Model\\TranslationInterface;\nuse Sylius\\Resource\\Translation\\TranslatableEntityLocaleAssignerInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerInterface;\n\nfinal class ORMTranslatableListener implements EventSubscriber\n{\n    private RegistryInterface $resourceMetadataRegistry;\n\n    private TranslatableEntityLocaleAssignerInterface $translatableEntityLocaleAssigner;\n\n    public function __construct(\n        RegistryInterface $resourceMetadataRegistry,\n        object $translatableEntityLocaleAssigner,\n    ) {\n        $this->resourceMetadataRegistry = $resourceMetadataRegistry;\n        $this->translatableEntityLocaleAssigner = $this->processTranslatableEntityLocaleAssigner($translatableEntityLocaleAssigner);\n    }\n\n    /**\n     * @deprecated since version 1.10, It will be removed in 2.0.\n     */\n    public function getSubscribedEvents(): array\n    {\n        return [\n            Events::loadClassMetadata,\n            Events::postLoad,\n        ];\n    }\n\n    /**\n     * Add mapping to translatable entities\n     */\n    public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void\n    {\n        $classMetadata = $eventArgs->getClassMetadata();\n        $reflection = $classMetadata->getReflectionClass();\n\n        /** @psalm-suppress PossiblyNullReference */\n        if ($reflection->isAbstract()) {\n            return;\n        }\n\n        if ($reflection->implementsInterface(TranslatableInterface::class)) {\n            $this->mapTranslatable($classMetadata);\n        }\n\n        if ($reflection->implementsInterface(TranslationInterface::class)) {\n            $this->mapTranslation($classMetadata);\n        }\n    }\n\n    public function postLoad(PostLoadEventArgs $args): void\n    {\n        $entity = $args->getObject();\n\n        if (!$entity instanceof TranslatableInterface) {\n            return;\n        }\n\n        $this->translatableEntityLocaleAssigner->assignLocale($entity);\n    }\n\n    /**\n     * Add mapping data to a translatable entity.\n     */\n    private function mapTranslatable(ClassMetadata $metadata): void\n    {\n        $className = $metadata->name;\n\n        try {\n            $resourceMetadata = $this->resourceMetadataRegistry->getByClass($className);\n        } catch (\\InvalidArgumentException $exception) {\n            return;\n        }\n\n        if (!$resourceMetadata->hasParameter('translation')) {\n            return;\n        }\n\n        /** @var MetadataInterface $translationResourceMetadata */\n        $translationResourceMetadata = $this->resourceMetadataRegistry->get($resourceMetadata->getAlias() . '_translation');\n\n        if (!$metadata->hasAssociation('translations')) {\n            $metadata->mapOneToMany([\n                'fieldName' => 'translations',\n                'targetEntity' => $translationResourceMetadata->getClass('model'),\n                'mappedBy' => 'translatable',\n                'fetch' => ClassMetadata::FETCH_EXTRA_LAZY,\n                'indexBy' => 'locale',\n                'cascade' => ['persist', 'remove'],\n                'orphanRemoval' => true,\n            ]);\n        }\n    }\n\n    /**\n     * Add mapping data to a translation entity.\n     */\n    private function mapTranslation(ClassMetadata $metadata): void\n    {\n        $className = $metadata->name;\n\n        try {\n            $resourceMetadata = $this->resourceMetadataRegistry->getByClass($className);\n        } catch (\\InvalidArgumentException $exception) {\n            return;\n        }\n\n        /** @var MetadataInterface $translatableResourceMetadata */\n        $translatableResourceMetadata = $this->resourceMetadataRegistry->get(str_replace('_translation', '', $resourceMetadata->getAlias()));\n\n        if (!$metadata->hasAssociation('translatable')) {\n            $metadata->mapManyToOne([\n                'fieldName' => 'translatable',\n                'targetEntity' => $translatableResourceMetadata->getClass('model'),\n                'inversedBy' => 'translations',\n                'joinColumns' => [[\n                    'name' => 'translatable_id',\n                    'referencedColumnName' => 'id',\n                    'onDelete' => 'CASCADE',\n                    'nullable' => false,\n                ]],\n            ]);\n        }\n\n        if (!$metadata->hasField('locale')) {\n            $metadata->mapField([\n                'fieldName' => 'locale',\n                'type' => 'string',\n                'nullable' => false,\n            ]);\n        }\n\n        // Map unique index.\n        $columns = [\n            $metadata->getSingleAssociationJoinColumnName('translatable'),\n            'locale',\n        ];\n\n        if (!$this->hasUniqueConstraint($metadata, $columns)) {\n            $constraints = $metadata->table['uniqueConstraints'] ?? [];\n\n            $constraints[$metadata->getTableName() . '_uniq_trans'] = [\n                'columns' => $columns,\n            ];\n\n            $metadata->setPrimaryTable([\n                'uniqueConstraints' => $constraints,\n            ]);\n        }\n    }\n\n    /**\n     * Check if a unique constraint has been defined.\n     */\n    private function hasUniqueConstraint(ClassMetadata $metadata, array $columns): bool\n    {\n        if (!isset($metadata->table['uniqueConstraints'])) {\n            return false;\n        }\n\n        foreach ($metadata->table['uniqueConstraints'] as $constraint) {\n            if (!array_diff($constraint['columns'], $columns)) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    private function processTranslatableEntityLocaleAssigner(object $translatableEntityLocaleAssigner): TranslatableEntityLocaleAssignerInterface\n    {\n        if ($translatableEntityLocaleAssigner instanceof ContainerInterface) {\n            trigger_deprecation(\n                'sylius/resource-bundle',\n                '1.4',\n                'Passing an instance of \"%s\" is deprecated. Use \"%s\" instead.',\n                ContainerInterface::class,\n                TranslatableEntityLocaleAssignerInterface::class,\n            );\n\n            /** @var object $translatableEntityLocaleAssigner */\n            $translatableEntityLocaleAssigner = $translatableEntityLocaleAssigner->get('sylius.translatable_entity_locale_assigner');\n        }\n\n        if (!$translatableEntityLocaleAssigner instanceof TranslatableEntityLocaleAssignerInterface) {\n            throw new \\InvalidArgumentException(sprintf(\n                '`$translatableEntityLocaleAssigner` was expected to return an instance of \"%s\" , \"%s\" found',\n                TranslatableEntityLocaleAssignerInterface::class,\n                get_class($translatableEntityLocaleAssigner),\n            ));\n        }\n\n        return $translatableEntityLocaleAssigner;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/ExpressionLanguage/ExpressionLanguage.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\ExpressionLanguage;\n\nuse Psr\\Cache\\CacheItemPoolInterface;\nuse Symfony\\Component\\DependencyInjection\\ExpressionLanguage as BaseExpressionLanguage;\nuse Symfony\\Component\\ExpressionLanguage\\ParserCache\\ParserCacheAdapter;\nuse Symfony\\Component\\ExpressionLanguage\\ParserCache\\ParserCacheInterface;\n\nfinal class ExpressionLanguage extends BaseExpressionLanguage\n{\n    /**\n     * @param mixed $cache\n     */\n    public function __construct($cache = null, array $providers = [])\n    {\n        if (null !== $cache) {\n            if ($cache instanceof ParserCacheInterface) {\n                trigger_deprecation(\n                    'sylius/resource-bundle',\n                    '1.2',\n                    'Passing an instance of \"%s\" as the first constructor argument of \"%s\" is deprecated. Pass an instance of \"%s\" instead.',\n                    ParserCacheInterface::class,\n                    self::class,\n                    CacheItemPoolInterface::class,\n                );\n\n                /** @var CacheItemPoolInterface $cache */\n                $cache = new ParserCacheAdapter($cache);\n            } elseif (!$cache instanceof CacheItemPoolInterface) {\n                throw new \\InvalidArgumentException(sprintf('Cache argument has to implement %s.', CacheItemPoolInterface::class));\n            }\n        }\n\n        array_unshift($providers, new NotNullExpressionFunctionProvider());\n\n        parent::__construct($cache, $providers);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/ExpressionLanguage/NotNullExpressionFunctionProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\ExpressionLanguage;\n\nuse Symfony\\Component\\ExpressionLanguage\\ExpressionFunction;\nuse Symfony\\Component\\ExpressionLanguage\\ExpressionFunctionProviderInterface;\nuse Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException;\n\nfinal class NotNullExpressionFunctionProvider implements ExpressionFunctionProviderInterface\n{\n    public function getFunctions(): array\n    {\n        return [\n            new ExpressionFunction(\n                'notFoundOnNull',\n                /**\n                 * @param mixed $result\n                 */\n                function ($result): string {\n                    return sprintf('(null !== %1$s) ? %1$s : throw new NotFoundHttpException(\\'Requested page is invalid.\\')', $result);\n                },\n                /**\n                 * @param mixed $arguments\n                 * @param mixed $result\n                 *\n                 * @return mixed\n                 */\n                function ($arguments, $result) {\n                    if (null === $result) {\n                        throw new NotFoundHttpException('Requested page is invalid.');\n                    }\n\n                    return $result;\n                },\n            ),\n        ];\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Form/Builder/DefaultFormBuilderInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Form\\Builder;\n\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\n\ninterface DefaultFormBuilderInterface\n{\n    public function build(MetadataInterface $metadata, FormBuilderInterface $formBuilder, array $options): void;\n}\n"
  },
  {
    "path": "src/Bundle/Form/DataTransformer/CollectionToStringTransformer.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Form\\DataTransformer;\n\nuse Doctrine\\Common\\Collections\\ArrayCollection;\nuse Doctrine\\Common\\Collections\\Collection;\nuse Symfony\\Component\\Form\\DataTransformerInterface;\nuse Symfony\\Component\\Form\\Exception\\TransformationFailedException;\n\nfinal class CollectionToStringTransformer implements DataTransformerInterface\n{\n    private string $delimiter;\n\n    public function __construct(string $delimiter)\n    {\n        $this->delimiter = $delimiter;\n    }\n\n    public function transform($value): string\n    {\n        if (!($value instanceof Collection)) {\n            throw new TransformationFailedException(\n                sprintf(\n                    'Expected \"%s\", but got \"%s\"',\n                    Collection::class,\n                    is_object($value) ? get_class($value) : gettype($value),\n                ),\n            );\n        }\n\n        if ($value->isEmpty()) {\n            return '';\n        }\n\n        return implode($this->delimiter, $value->toArray());\n    }\n\n    public function reverseTransform($value): Collection\n    {\n        if (!is_string($value)) {\n            throw new TransformationFailedException(\n                sprintf(\n                    'Expected string, but got \"%s\"',\n                    is_object($value) ? get_class($value) : gettype($value),\n                ),\n            );\n        }\n\n        if ('' === $value) {\n            return new ArrayCollection();\n        }\n\n        /** Explode would return string[]|false for PHP 7.4 and string[] for PHP 8 which messes in PHPStan algorithms */\n        return new ArrayCollection(explode($this->delimiter, $value) ?: []); // @phpstan-ignore-line\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Form/DataTransformer/RecursiveTransformer.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Form\\DataTransformer;\n\nuse Doctrine\\Common\\Collections\\ArrayCollection;\nuse Doctrine\\Common\\Collections\\Collection;\nuse Doctrine\\Common\\Collections\\ReadableCollection;\nuse Symfony\\Component\\Form\\DataTransformerInterface;\nuse Symfony\\Component\\Form\\Exception\\TransformationFailedException;\n\nfinal class RecursiveTransformer implements DataTransformerInterface\n{\n    private DataTransformerInterface $decoratedTransformer;\n\n    public function __construct(DataTransformerInterface $decoratedTransformer)\n    {\n        $this->decoratedTransformer = $decoratedTransformer;\n    }\n\n    /** @param Collection|null $value */\n    public function transform($value): ReadableCollection\n    {\n        if (null === $value) {\n            return new ArrayCollection();\n        }\n\n        $this->assertTransformationValueType($value, Collection::class);\n\n        return $value->map(\n            /**\n             * @param mixed $currentValue\n             *\n             * @return mixed\n             */\n            function ($currentValue) {\n                return $this->decoratedTransformer->transform($currentValue);\n            },\n        );\n    }\n\n    /** @param Collection|null $value */\n    public function reverseTransform($value): ReadableCollection\n    {\n        if (null === $value) {\n            return new ArrayCollection();\n        }\n\n        $this->assertTransformationValueType($value, Collection::class);\n\n        return $value->map(\n            /**\n             * @param mixed $currentValue\n             *\n             * @return mixed\n             */\n            function ($currentValue) {\n                return $this->decoratedTransformer->reverseTransform($currentValue);\n            },\n        );\n    }\n\n    /**\n     * @param mixed $value\n     *\n     * @throws TransformationFailedException\n     */\n    private function assertTransformationValueType($value, string $expectedType): void\n    {\n        if (!($value instanceof $expectedType)) {\n            throw new TransformationFailedException(\n                sprintf(\n                    'Expected \"%s\", but got \"%s\"',\n                    $expectedType,\n                    is_object($value) ? get_class($value) : gettype($value),\n                ),\n            );\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Form/DataTransformer/ResourceToIdentifierTransformer.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Form\\DataTransformer;\n\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\Form\\DataTransformerInterface;\nuse Symfony\\Component\\Form\\Exception\\TransformationFailedException;\nuse Symfony\\Component\\PropertyAccess\\PropertyAccess;\nuse Webmozart\\Assert\\Assert;\n\nfinal class ResourceToIdentifierTransformer implements DataTransformerInterface\n{\n    private RepositoryInterface $repository;\n\n    private string $identifier;\n\n    public function __construct(RepositoryInterface $repository, ?string $identifier = null)\n    {\n        $this->repository = $repository;\n        $this->identifier = $identifier ?? 'id';\n    }\n\n    /**\n     * @inheritDoc\n     */\n    public function transform(mixed $value): mixed\n    {\n        if (null === $value) {\n            return null;\n        }\n\n        /** @psalm-suppress ArgumentTypeCoercion */\n        Assert::isInstanceOf($value, $this->repository->getClassName());\n\n        return PropertyAccess::createPropertyAccessor()->getValue($value, $this->identifier);\n    }\n\n    /**\n     * @inheritDoc\n     */\n    public function reverseTransform(mixed $value): ?ResourceInterface\n    {\n        if (null === $value) {\n            return null;\n        }\n\n        /** @var ResourceInterface|null $resource */\n        $resource = $this->repository->findOneBy([$this->identifier => $value]);\n        if (null === $resource) {\n            throw new TransformationFailedException(sprintf(\n                'Object \"%s\" with identifier \"%s\"=\"%s\" does not exist.',\n                $this->repository->getClassName(),\n                $this->identifier,\n                $value,\n            ));\n        }\n\n        return $resource;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Form/EventSubscriber/AddCodeFormSubscriber.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Form\\EventSubscriber;\n\nuse Sylius\\Resource\\Exception\\UnexpectedTypeException;\nuse Sylius\\Resource\\Model\\CodeAwareInterface;\nuse Symfony\\Component\\EventDispatcher\\EventSubscriberInterface;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType;\nuse Symfony\\Component\\Form\\FormEvent;\nuse Symfony\\Component\\Form\\FormEvents;\n\nfinal class AddCodeFormSubscriber implements EventSubscriberInterface\n{\n    private string $type;\n\n    private array $options;\n\n    public function __construct(?string $type = null, array $options = [])\n    {\n        $this->type = $type ?? TextType::class;\n        $this->options = $options;\n    }\n\n    public static function getSubscribedEvents(): array\n    {\n        return [\n            FormEvents::PRE_SET_DATA => 'preSetData',\n        ];\n    }\n\n    public function preSetData(FormEvent $event): void\n    {\n        $resource = $event->getData();\n        $disabled = false;\n\n        if ($resource instanceof CodeAwareInterface) {\n            $disabled = null !== $resource->getCode();\n        } elseif (null !== $resource) {\n            throw new UnexpectedTypeException($resource, CodeAwareInterface::class);\n        }\n\n        $form = $event->getForm();\n        $form->add('code', $this->type, array_merge(\n            ['label' => 'sylius.ui.code'],\n            $this->options,\n            ['disabled' => $disabled],\n        ));\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Form/Extension/CollectionTypeExtension.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Form\\Extension;\n\nuse Symfony\\Component\\Form\\AbstractTypeExtension;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\CollectionType;\nuse Symfony\\Component\\Form\\FormInterface;\nuse Symfony\\Component\\Form\\FormView;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolver;\n\nfinal class CollectionTypeExtension extends AbstractTypeExtension\n{\n    /**\n     * @psalm-suppress MissingPropertyType\n     */\n    public function buildView(FormView $view, FormInterface $form, array $options): void\n    {\n        $view->vars['button_add_label'] = $options['button_add_label'];\n        $view->vars['button_delete_label'] = $options['button_delete_label'];\n    }\n\n    public function configureOptions(OptionsResolver $resolver): void\n    {\n        $resolver->setDefaults([\n            'button_add_label' => 'sylius.form.collection.add',\n            'button_delete_label' => 'sylius.form.collection.delete',\n        ]);\n    }\n\n    public function getExtendedType(): string\n    {\n        return CollectionType::class;\n    }\n\n    public static function getExtendedTypes(): iterable\n    {\n        return [CollectionType::class];\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Form\\Extension\\HttpFoundation;\n\nuse Symfony\\Component\\Form\\Exception\\UnexpectedTypeException;\nuse Symfony\\Component\\Form\\FormError;\nuse Symfony\\Component\\Form\\FormInterface;\nuse Symfony\\Component\\Form\\RequestHandlerInterface;\nuse Symfony\\Component\\Form\\Util\\ServerParams;\nuse Symfony\\Component\\HttpFoundation\\File\\File;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Webmozart\\Assert\\Assert;\n\n/**\n * Does not compare the form's method with the request's method.\n * Always submits the form, even if there are no fields sent.\n *\n * @internal\n *\n * @see \\Symfony\\Component\\Form\\Extension\\HttpFoundation\\HttpFoundationRequestHandler\n */\nfinal class HttpFoundationRequestHandler implements RequestHandlerInterface\n{\n    private ServerParams $serverParams;\n\n    public function __construct(?ServerParams $serverParams = null)\n    {\n        $this->serverParams = $serverParams ?: new ServerParams();\n    }\n\n    public function handleRequest(FormInterface $form, mixed $request = null): void\n    {\n        if (!$request instanceof Request) {\n            throw new UnexpectedTypeException($request, Request::class);\n        }\n\n        $name = $form->getName();\n        $method = $request->getMethod();\n\n        // For request methods that must not have a request body we fetch data\n        // from the query string. Otherwise we look for data in the request body.\n        if ('GET' === $method || 'HEAD' === $method || 'TRACE' === $method) {\n            if ('' === $name) {\n                /** @var array<string, mixed> $data */\n                $data = $request->query->all();\n            } else {\n                // Don't submit GET requests if the form's name does not exist\n                // in the request\n                if (!$request->query->has($name)) {\n                    return;\n                }\n\n                /** @var array<string, mixed> $data */\n                $data = $request->query->all()[$name];\n            }\n        } else {\n            // Mark the form with an error if the uploaded size was too large\n            // This is done here and not in FormValidator because $_POST is\n            // empty when that error occurs. Hence the form is never submitted.\n            if ($this->serverParams->hasPostMaxSizeBeenExceeded()) {\n                // Submit the form, but don't clear the default values\n                $form->submit(null, false);\n\n                $uploadMaxSizeMessageCallable = $form->getConfig()->getOption('upload_max_size_message');\n\n                Assert::isCallable($uploadMaxSizeMessageCallable);\n\n                $uploadMaxSizeMessage = call_user_func($uploadMaxSizeMessageCallable);\n                Assert::string($uploadMaxSizeMessage);\n\n                $form->addError(new FormError(\n                    $uploadMaxSizeMessage,\n                    null,\n                    ['{{ max }}' => $this->serverParams->getNormalizedIniPostMaxSize()],\n                ));\n\n                return;\n            }\n\n            if ('' === $name) {\n                $params = $request->request->all();\n                $files = $request->files->all();\n            } elseif ($request->request->has($name) || $request->files->has($name)) {\n                /** @psalm-var array|null $default */\n                $default = $form->getConfig()->getCompound() ? [] : null;\n\n                $params = $request->request->all()[$name] ?? $default;\n                $files = $request->files->get($name, $default);\n            } else {\n                // Don't submit the form if it is not present in the request\n                return;\n            }\n\n            if (is_array($params) && is_array($files)) {\n                $data = array_replace_recursive($params, $files);\n            } else {\n                /** @var array<string, mixed> $data */\n                $data = $params ?: $files;\n            }\n        }\n\n        $form->submit($data, 'PATCH' !== $method);\n    }\n\n    public function isFileUpload(mixed $data): bool\n    {\n        return $data instanceof File;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Form/Registry/FormTypeRegistry.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Form\\Registry;\n\nfinal class FormTypeRegistry implements FormTypeRegistryInterface\n{\n    private array $formTypes = [];\n\n    public function add(string $identifier, string $typeIdentifier, string $formType): void\n    {\n        $this->formTypes[$identifier][$typeIdentifier] = $formType;\n    }\n\n    public function get(string $identifier, string $typeIdentifier): ?string\n    {\n        if (!$this->has($identifier, $typeIdentifier)) {\n            return null;\n        }\n\n        return $this->formTypes[$identifier][$typeIdentifier];\n    }\n\n    public function has(string $identifier, string $typeIdentifier): bool\n    {\n        return isset($this->formTypes[$identifier][$typeIdentifier]);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Form/Registry/FormTypeRegistryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Form\\Registry;\n\ninterface FormTypeRegistryInterface\n{\n    public function add(string $identifier, string $typeIdentifier, string $formType): void;\n\n    public function get(string $identifier, string $typeIdentifier): ?string;\n\n    public function has(string $identifier, string $typeIdentifier): bool;\n}\n"
  },
  {
    "path": "src/Bundle/Form/Type/AbstractResourceType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Form\\Type;\n\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolver;\n\nabstract class AbstractResourceType extends AbstractType\n{\n    protected string $dataClass;\n\n    /** @var string[] */\n    protected array $validationGroups = [];\n\n    /**\n     * @param string $dataClass FQCN\n     * @param string[] $validationGroups\n     */\n    public function __construct(string $dataClass, array $validationGroups = [])\n    {\n        $this->dataClass = $dataClass;\n        $this->validationGroups = $validationGroups;\n    }\n\n    public function configureOptions(OptionsResolver $resolver): void\n    {\n        $resolver->setDefaults([\n            'data_class' => $this->dataClass,\n            'validation_groups' => $this->validationGroups,\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Form/Type/ArchivableType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Form\\Type;\n\nuse Sylius\\Resource\\Model\\ArchivableInterface;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\DateTimeType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Symfony\\Component\\Form\\FormEvent;\nuse Symfony\\Component\\Form\\FormEvents;\n\nfinal class ArchivableType extends AbstractType\n{\n    public function buildForm(FormBuilderInterface $builder, array $options): void\n    {\n        $builder\n            ->add('archivedAt', DateTimeType::class)\n            ->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) {\n                /** @var ArchivableInterface $archivable */\n                $archivable = $event->getData();\n\n                $archivedAt = null;\n                if (null === $archivable->getArchivedAt()) {\n                    $archivedAt = new \\DateTime();\n                }\n\n                $archivable->setArchivedAt($archivedAt);\n\n                $event->setData($archivable);\n            })\n        ;\n    }\n\n    public function getBlockPrefix(): string\n    {\n        return 'sylius_archivable';\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Form/Type/DefaultResourceType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Form\\Type;\n\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Builder\\DefaultFormBuilderInterface;\nuse Sylius\\Component\\Registry\\ServiceRegistryInterface;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Webmozart\\Assert\\Assert;\n\nfinal class DefaultResourceType extends AbstractType\n{\n    private RegistryInterface $metadataRegistry;\n\n    private ServiceRegistryInterface $formBuilderRegistry;\n\n    public function __construct(RegistryInterface $metadataRegistry, ServiceRegistryInterface $formBuilderRegistry)\n    {\n        $this->metadataRegistry = $metadataRegistry;\n        $this->formBuilderRegistry = $formBuilderRegistry;\n    }\n\n    public function buildForm(FormBuilderInterface $builder, array $options): void\n    {\n        Assert::string($options['data_class']);\n\n        $metadata = $this->metadataRegistry->getByClass($options['data_class']);\n\n        $driver = $metadata->getDriver();\n\n        Assert::notFalse($driver, sprintf(\n            'Form \"%s\" cannot be used with no driver configured on the resource \"%s\". Please define a form.',\n            __CLASS__,\n            $metadata->getAlias(),\n        ));\n\n        /** @var DefaultFormBuilderInterface $formBuilder */\n        $formBuilder = $this->formBuilderRegistry->get($driver);\n\n        $formBuilder->build($metadata, $builder, $options);\n    }\n\n    public function getBlockPrefix(): string\n    {\n        return 'sylius_resource';\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Form/Type/FixedCollectionType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Form\\Type;\n\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Symfony\\Component\\OptionsResolver\\Options;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolver;\nuse Webmozart\\Assert\\Assert;\n\nfinal class FixedCollectionType extends AbstractType\n{\n    public function buildForm(FormBuilderInterface $builder, array $options): void\n    {\n        Assert::isIterable($options['entries']);\n\n        foreach ($options['entries'] as $entry) {\n            Assert::isCallable($options['entry_type']);\n            Assert::isCallable($options['entry_name']);\n            Assert::isCallable($options['entry_options']);\n\n            $entryType = $options['entry_type']($entry);\n            $entryName = $options['entry_name']($entry);\n            $entryOptions = $options['entry_options']($entry);\n\n            $builder->add($entryName, $entryType, array_replace([\n                'property_path' => '[' . $entryName . ']',\n                'block_name' => 'entry',\n            ], $entryOptions));\n        }\n    }\n\n    public function configureOptions(OptionsResolver $resolver): void\n    {\n        $resolver->setRequired('entries');\n        $resolver->setAllowedTypes('entries', ['array', \\Traversable::class]);\n\n        $resolver->setRequired('entry_type');\n        $resolver->setAllowedTypes('entry_type', ['string', 'callable']);\n        $resolver->setNormalizer('entry_type', $this->optionalCallableNormalizer());\n\n        $resolver->setRequired('entry_name');\n        $resolver->setAllowedTypes('entry_name', ['callable']);\n\n        $resolver->setDefault('entry_options', function () {\n            return [];\n        });\n        $resolver->setAllowedTypes('entry_options', ['array', 'callable']);\n        $resolver->setNormalizer('entry_options', $this->optionalCallableNormalizer());\n    }\n\n    public function getBlockPrefix(): string\n    {\n        return 'sylius_fixed_collection';\n    }\n\n    private function optionalCallableNormalizer(): \\Closure\n    {\n        return\n            /**\n             * @param mixed $value\n             *\n             * @return mixed\n             */\n            function (Options $options, $value) {\n                if (is_callable($value)) {\n                    return $value;\n                }\n\n                return /** @return mixed */ function () use ($value) {\n                    return $value;\n                };\n            }\n        ;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Form/Type/ResourceAutocompleteChoiceType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Form\\Type;\n\nuse Sylius\\Bundle\\ResourceBundle\\Form\\DataTransformer\\CollectionToStringTransformer;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\DataTransformer\\RecursiveTransformer;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\DataTransformer\\ResourceToIdentifierTransformer;\nuse Sylius\\Component\\Registry\\ServiceRegistryInterface;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\HiddenType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Symfony\\Component\\Form\\FormInterface;\nuse Symfony\\Component\\Form\\FormView;\nuse Symfony\\Component\\OptionsResolver\\Options;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolver;\nuse Webmozart\\Assert\\Assert;\n\nclass ResourceAutocompleteChoiceType extends AbstractType\n{\n    protected ServiceRegistryInterface $resourceRepositoryRegistry;\n\n    public function __construct(ServiceRegistryInterface $resourceRepositoryRegistry)\n    {\n        $this->resourceRepositoryRegistry = $resourceRepositoryRegistry;\n    }\n\n    public function buildForm(FormBuilderInterface $builder, array $options): void\n    {\n        Assert::isInstanceOf($options['repository'], RepositoryInterface::class);\n        Assert::nullOrString($options['choice_value']);\n\n        if (!$options['multiple']) {\n            $builder->addModelTransformer(\n                new ResourceToIdentifierTransformer(\n                    $options['repository'],\n                    $options['choice_value'],\n                ),\n            );\n        }\n\n        if ($options['multiple']) {\n            $builder\n                ->addModelTransformer(\n                    new RecursiveTransformer(\n                        new ResourceToIdentifierTransformer(\n                            $options['repository'],\n                            $options['choice_value'],\n                        ),\n                    ),\n                )\n                ->addViewTransformer(new CollectionToStringTransformer(','))\n            ;\n        }\n    }\n\n    /**\n     * @psalm-suppress MissingPropertyType\n     */\n    public function buildView(FormView $view, FormInterface $form, array $options): void\n    {\n        $view->vars['multiple'] = $options['multiple'];\n        $view->vars['choice_name'] = $options['choice_name'];\n        $view->vars['choice_value'] = $options['choice_value'];\n        $view->vars['placeholder'] = $options['placeholder'];\n    }\n\n    public function configureOptions(OptionsResolver $resolver): void\n    {\n        $resolver\n            ->setRequired([\n                'resource',\n                'choice_name',\n                'choice_value',\n            ])\n            ->setDefaults([\n                'multiple' => false,\n                'error_bubbling' => false,\n                'placeholder' => '',\n                'repository' => function (Options $options) {\n                    Assert::string($options['resource']);\n\n                    return $this->resourceRepositoryRegistry->get($options['resource']);\n                },\n            ])\n            ->setAllowedTypes('resource', ['string'])\n            ->setAllowedTypes('multiple', ['bool'])\n            ->setAllowedTypes('choice_name', ['string'])\n            ->setAllowedTypes('choice_value', ['string'])\n            ->setAllowedTypes('placeholder', ['string'])\n        ;\n    }\n\n    public function getParent(): string\n    {\n        return HiddenType::class;\n    }\n\n    public function getBlockPrefix(): string\n    {\n        return 'sylius_resource_autocomplete_choice';\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Form/Type/ResourceToIdentifierType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Form\\Type;\n\nuse Sylius\\Bundle\\ResourceBundle\\Form\\DataTransformer\\ResourceToIdentifierTransformer;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Bridge\\Doctrine\\Form\\Type\\EntityType;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolver;\nuse Webmozart\\Assert\\Assert;\n\nfinal class ResourceToIdentifierType extends AbstractType\n{\n    private RepositoryInterface $repository;\n\n    private MetadataInterface $metadata;\n\n    public function __construct(RepositoryInterface $repository, MetadataInterface $metadata)\n    {\n        $this->repository = $repository;\n        $this->metadata = $metadata;\n    }\n\n    public function buildForm(FormBuilderInterface $builder, array $options): void\n    {\n        $identifier = $options['identifier'];\n        Assert::nullOrString($identifier);\n\n        $builder->addModelTransformer(\n            new ResourceToIdentifierTransformer($this->repository, $identifier),\n        );\n    }\n\n    public function configureOptions(OptionsResolver $resolver): void\n    {\n        $resolver\n            ->setDefaults([\n                'identifier' => 'id',\n            ])\n            ->setAllowedTypes('identifier', 'string')\n        ;\n    }\n\n    public function getParent(): string\n    {\n        return EntityType::class;\n    }\n\n    public function getBlockPrefix(): string\n    {\n        return sprintf('%s_%s_to_identifier', $this->metadata->getApplicationName(), $this->metadata->getName());\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Form/Type/ResourceTranslationsType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Form\\Type;\n\nuse Sylius\\Resource\\Model\\TranslatableInterface;\nuse Sylius\\Resource\\Model\\TranslationInterface;\nuse Sylius\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Symfony\\Component\\Form\\FormEvent;\nuse Symfony\\Component\\Form\\FormEvents;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolver;\nuse Webmozart\\Assert\\Assert;\n\nfinal class ResourceTranslationsType extends AbstractType\n{\n    /** @var string[] */\n    private array $definedLocalesCodes;\n\n    private string $defaultLocaleCode;\n\n    public function __construct(TranslationLocaleProviderInterface $localeProvider)\n    {\n        $this->definedLocalesCodes = $localeProvider->getDefinedLocalesCodes();\n        $this->defaultLocaleCode = $localeProvider->getDefaultLocaleCode();\n    }\n\n    public function buildForm(FormBuilderInterface $builder, array $options): void\n    {\n        $builder->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) {\n            /** @var TranslationInterface[]|null[] $translations */\n            $translations = $event->getData();\n\n            $parentForm = $event->getForm()->getParent();\n            Assert::notNull($parentForm);\n\n            /** @var TranslatableInterface $translatable */\n            $translatable = $parentForm->getData();\n\n            foreach ($translations as $localeCode => $translation) {\n                if (null === $translation) {\n                    unset($translations[$localeCode]);\n\n                    continue;\n                }\n\n                $translation->setLocale($localeCode);\n                $translation->setTranslatable($translatable);\n            }\n\n            $event->setData($translations);\n        });\n    }\n\n    public function configureOptions(OptionsResolver $resolver): void\n    {\n        $resolver->setDefaults([\n            'entries' => $this->definedLocalesCodes,\n            'entry_name' => function (string $localeCode): string {\n                return $localeCode;\n            },\n            'entry_options' => function (string $localeCode): array {\n                return [\n                    'required' => $localeCode === $this->defaultLocaleCode,\n                ];\n            },\n        ]);\n    }\n\n    public function getParent(): string\n    {\n        return FixedCollectionType::class;\n    }\n\n    public function getBlockPrefix(): string\n    {\n        return 'sylius_translations';\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Grid/Controller/ResourcesResolver.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Grid\\Controller;\n\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourcesResolverInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridViewFactoryInterface;\nuse Sylius\\Component\\Grid\\Parameters;\nuse Sylius\\Component\\Grid\\Provider\\GridProviderInterface;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\n\nfinal class ResourcesResolver implements ResourcesResolverInterface\n{\n    private ResourcesResolverInterface $decoratedResolver;\n\n    private GridProviderInterface $gridProvider;\n\n    private ResourceGridViewFactoryInterface $gridViewFactory;\n\n    public function __construct(\n        ResourcesResolverInterface $decoratedResolver,\n        GridProviderInterface $gridProvider,\n        ResourceGridViewFactoryInterface $gridViewFactory,\n    ) {\n        $this->decoratedResolver = $decoratedResolver;\n        $this->gridProvider = $gridProvider;\n        $this->gridViewFactory = $gridViewFactory;\n    }\n\n    /**\n     * @psalm-suppress MissingReturnType\n     */\n    public function getResources(RequestConfiguration $requestConfiguration, RepositoryInterface $repository)\n    {\n        if (!$requestConfiguration->hasGrid()) {\n            return $this->decoratedResolver->getResources($requestConfiguration, $repository);\n        }\n\n        $gridDefinition = $this->gridProvider->get($requestConfiguration->getGrid());\n\n        $request = $requestConfiguration->getRequest();\n        $parameters = new Parameters($request->query->all());\n\n        $gridView = $this->gridViewFactory->create($gridDefinition, $parameters, $requestConfiguration->getMetadata(), $requestConfiguration);\n\n        if ($requestConfiguration->isHtmlRequest()) {\n            return $gridView;\n        }\n\n        return $gridView->getData();\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Grid/Parser/OptionsParser.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Grid\\Parser;\n\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\BcLayerRequestTrait;\nuse Symfony\\Component\\DependencyInjection\\ContainerInterface;\nuse Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\PropertyAccess\\PropertyAccessorInterface;\n\nfinal class OptionsParser implements OptionsParserInterface\n{\n    use BcLayerRequestTrait;\n\n    private ContainerInterface $container;\n\n    private ExpressionLanguage $expression;\n\n    private PropertyAccessorInterface $propertyAccessor;\n\n    public function __construct(\n        ContainerInterface $container,\n        ExpressionLanguage $expression,\n        PropertyAccessorInterface $propertyAccessor,\n    ) {\n        $this->container = $container;\n        $this->expression = $expression;\n        $this->propertyAccessor = $propertyAccessor;\n    }\n\n    /**\n     * @param array|object|null $data\n     */\n    public function parseOptions(array $parameters, Request $request, $data = null): array\n    {\n        return array_map(\n            /**\n             * @param mixed $parameter\n             *\n             * @return mixed\n             */\n            function ($parameter) use ($request, $data) {\n                if (is_array($parameter)) {\n                    return $this->parseOptions($parameter, $request, $data);\n                }\n\n                return $this->parseOption($parameter, $request, $data);\n            },\n            $parameters,\n        );\n    }\n\n    /**\n     * @param mixed $parameter\n     * @param array|object|null $data\n     *\n     * @return mixed\n     */\n    private function parseOption($parameter, Request $request, $data)\n    {\n        if (!is_string($parameter)) {\n            return $parameter;\n        }\n\n        if (0 === strpos($parameter, '$')) {\n            return $this->getFromRequest($request, substr($parameter, 1));\n        }\n\n        if (0 === strpos($parameter, 'expr:')) {\n            return $this->parseOptionExpression(substr($parameter, 5), $request);\n        }\n\n        if (0 === strpos($parameter, 'resource.')) {\n            return $this->parseOptionResourceField(substr($parameter, 9), $data);\n        }\n\n        if (0 === strpos($parameter, 'resource[')) {\n            return $this->parseOptionResourceField(substr($parameter, 8), $data);\n        }\n\n        return $parameter;\n    }\n\n    /**\n     * @return mixed\n     */\n    private function parseOptionExpression(string $expression, Request $request)\n    {\n        $expression = (string) preg_replace_callback(\n            '/\\$(\\w+)/',\n            /** @return callable */\n            function (array $matches) use ($request) {\n                $variable = $this->getFromRequest($request, $matches[1]);\n\n                return is_string($variable) ? sprintf('\"%s\"', addslashes($variable)) : $variable;\n            },\n            $expression,\n        );\n\n        return $this->expression->evaluate($expression, ['container' => $this->container]);\n    }\n\n    /**\n     * @param array|object|null $data\n     *\n     * @return mixed\n     */\n    private function parseOptionResourceField(string $value, $data)\n    {\n        return $this->propertyAccessor->getValue($data, $value);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Grid/Parser/OptionsParserInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Grid\\Parser;\n\nuse Symfony\\Component\\HttpFoundation\\Request;\n\ninterface OptionsParserInterface\n{\n    /**\n     * @param mixed $data\n     */\n    public function parseOptions(array $parameters, Request $request, $data = null): array;\n}\n"
  },
  {
    "path": "src/Bundle/Grid/Renderer/TwigBulkActionGridRenderer.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Grid\\Renderer;\n\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\Parser\\OptionsParserInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridView;\nuse Sylius\\Component\\Grid\\Definition\\Action;\nuse Sylius\\Component\\Grid\\Renderer\\BulkActionGridRendererInterface;\nuse Sylius\\Component\\Grid\\View\\GridViewInterface;\nuse Twig\\Environment;\nuse Webmozart\\Assert\\Assert;\n\nfinal class TwigBulkActionGridRenderer implements BulkActionGridRendererInterface\n{\n    private Environment $twig;\n\n    private OptionsParserInterface $optionsParser;\n\n    private array $bulkActionTemplates;\n\n    public function __construct(\n        Environment $twig,\n        OptionsParserInterface $optionsParser,\n        array $bulkActionTemplates = [],\n    ) {\n        $this->twig = $twig;\n        $this->optionsParser = $optionsParser;\n        $this->bulkActionTemplates = $bulkActionTemplates;\n    }\n\n    public function renderBulkAction(GridViewInterface $gridView, Action $bulkAction, $data = null): string\n    {\n        Assert::isInstanceOf($gridView, ResourceGridView::class);\n\n        $type = $bulkAction->getType();\n        if (!isset($this->bulkActionTemplates[$type])) {\n            throw new \\InvalidArgumentException(sprintf('Missing template for bulk action type \"%s\".', $type));\n        }\n\n        $options = $this->optionsParser->parseOptions(\n            $bulkAction->getOptions(),\n            $gridView->getRequestConfiguration()->getRequest(),\n            $data,\n        );\n\n        return $this->twig->render($this->bulkActionTemplates[$type], [\n            'grid' => $gridView,\n            'action' => $bulkAction,\n            'data' => $data,\n            'options' => $options,\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Grid/Renderer/TwigGridRenderer.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Grid\\Renderer;\n\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\Parser\\OptionsParserInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridView;\nuse Sylius\\Component\\Grid\\Definition\\Action;\nuse Sylius\\Component\\Grid\\Definition\\Field;\nuse Sylius\\Component\\Grid\\Definition\\Filter;\nuse Sylius\\Component\\Grid\\Renderer\\GridRendererInterface;\nuse Sylius\\Component\\Grid\\View\\GridViewInterface;\nuse Twig\\Environment;\n\nfinal class TwigGridRenderer implements GridRendererInterface\n{\n    private GridRendererInterface $gridRenderer;\n\n    private Environment $twig;\n\n    private OptionsParserInterface $optionsParser;\n\n    private array $actionTemplates;\n\n    public function __construct(\n        GridRendererInterface $gridRenderer,\n        Environment $twig,\n        OptionsParserInterface $optionsParser,\n        array $actionTemplates = [],\n    ) {\n        $this->gridRenderer = $gridRenderer;\n        $this->twig = $twig;\n        $this->optionsParser = $optionsParser;\n        $this->actionTemplates = $actionTemplates;\n    }\n\n    public function render(GridViewInterface $gridView, ?string $template = null): string\n    {\n        return $this->gridRenderer->render($gridView, $template);\n    }\n\n    /**\n     * @param mixed $data\n     */\n    public function renderField(GridViewInterface $gridView, Field $field, $data): string\n    {\n        return $this->gridRenderer->renderField($gridView, $field, $data);\n    }\n\n    /**\n     * @param mixed $data\n     */\n    public function renderAction(GridViewInterface $gridView, Action $action, $data = null): string\n    {\n        if (!$gridView instanceof ResourceGridView) {\n            return $this->gridRenderer->renderAction($gridView, $action, $data);\n        }\n\n        $type = $action->getType();\n        $template = method_exists($action, 'getTemplate') ? $action->getTemplate() : null;\n        $template ??= $this->actionTemplates[$type] ?? null;\n\n        if (null === $template) {\n            throw new \\InvalidArgumentException(sprintf('Missing template for action type \"%s\".', $type));\n        }\n\n        $options = $this->optionsParser->parseOptions(\n            $action->getOptions(),\n            $gridView->getRequestConfiguration()->getRequest(),\n            $data,\n        );\n\n        return $this->twig->render($template, [\n            'grid' => $gridView,\n            'action' => $action,\n            'data' => $data,\n            'options' => $options,\n        ]);\n    }\n\n    public function renderFilter(GridViewInterface $gridView, Filter $filter): string\n    {\n        return $this->gridRenderer->renderFilter($gridView, $filter);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Grid/View/LegacyGridViewFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Grid\\View;\n\nuse Sylius\\Bundle\\ResourceBundle\\Context\\Option\\RequestConfigurationOption;\nuse Sylius\\Component\\Grid\\Definition\\Grid;\nuse Sylius\\Component\\Grid\\Parameters;\nuse Sylius\\Component\\Grid\\View\\GridView;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\MetadataOption;\nuse Sylius\\Resource\\Grid\\View\\Factory\\GridViewFactoryInterface;\n\nfinal class LegacyGridViewFactory implements GridViewFactoryInterface\n{\n    public function __construct(\n        private ResourceGridViewFactoryInterface $resourceGridViewFactory,\n        private GridViewFactoryInterface $decorated,\n    ) {\n    }\n\n    public function create(\n        Grid $grid,\n        Context $context,\n        Parameters $parameters,\n        array $driverConfiguration,\n    ): ResourceGridView|GridView {\n        $requestConfiguration = $context->get(RequestConfigurationOption::class)?->requestConfiguration();\n        $metadata = $context->get(MetadataOption::class)?->metadata();\n\n        if (null === $requestConfiguration || null === $metadata) {\n            return $this->decorated->create($grid, $context, $parameters, $driverConfiguration);\n        }\n\n        return $this->resourceGridViewFactory->create($grid, $parameters, $metadata, $requestConfiguration);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Grid/View/ResourceGridView.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Grid\\View;\n\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Component\\Grid\\Definition\\Grid;\nuse Sylius\\Component\\Grid\\Parameters;\nuse Sylius\\Component\\Grid\\View\\GridView;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\n\nclass ResourceGridView extends GridView\n{\n    private MetadataInterface $metadata;\n\n    private RequestConfiguration $requestConfiguration;\n\n    /**\n     * @param mixed $data\n     */\n    public function __construct(\n        $data,\n        Grid $gridDefinition,\n        Parameters $parameters,\n        MetadataInterface $resourceMetadata,\n        RequestConfiguration $requestConfiguration,\n    ) {\n        parent::__construct($data, $gridDefinition, $parameters);\n\n        $this->metadata = $resourceMetadata;\n        $this->requestConfiguration = $requestConfiguration;\n    }\n\n    public function getMetadata(): MetadataInterface\n    {\n        return $this->metadata;\n    }\n\n    public function getRequestConfiguration(): RequestConfiguration\n    {\n        return $this->requestConfiguration;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Grid/View/ResourceGridViewFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Grid\\View;\n\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ParametersParserInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Component\\Grid\\Data\\DataProviderInterface;\nuse Sylius\\Component\\Grid\\Definition\\Grid;\nuse Sylius\\Component\\Grid\\Parameters;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\n\nfinal class ResourceGridViewFactory implements ResourceGridViewFactoryInterface\n{\n    private DataProviderInterface $dataProvider;\n\n    private ParametersParserInterface $parametersParser;\n\n    public function __construct(DataProviderInterface $dataProvider, ParametersParserInterface $parametersParser)\n    {\n        $this->dataProvider = $dataProvider;\n        $this->parametersParser = $parametersParser;\n    }\n\n    public function create(\n        Grid $grid,\n        Parameters $parameters,\n        MetadataInterface $metadata,\n        RequestConfiguration $requestConfiguration,\n    ): ResourceGridView {\n        $driverConfiguration = $grid->getDriverConfiguration();\n        $request = $requestConfiguration->getRequest();\n\n        $grid->setDriverConfiguration($this->parametersParser->parseRequestValues($driverConfiguration, $request));\n\n        return new ResourceGridView($this->dataProvider->getData($grid, $parameters), $grid, $parameters, $metadata, $requestConfiguration);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Grid/View/ResourceGridViewFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Grid\\View;\n\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Component\\Grid\\Definition\\Grid;\nuse Sylius\\Component\\Grid\\Parameters;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\n\ninterface ResourceGridViewFactoryInterface\n{\n    public function create(\n        Grid $grid,\n        Parameters $parameters,\n        MetadataInterface $metadata,\n        RequestConfiguration $requestConfiguration,\n    ): ResourceGridView;\n}\n"
  },
  {
    "path": "src/Bundle/Provider/RequestParameterProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Provider;\n\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class RequestParameterProvider\n{\n    public static function provide(Request $request, string $key, mixed $default = null): mixed\n    {\n        if ($request !== $result = $request->attributes->get($key, $request)) {\n            return $result;\n        }\n\n        if ($request->query->has($key)) {\n            return $request->query->all()[$key];\n        }\n\n        if ($request->request->has($key)) {\n            return $request->request->all()[$key];\n        }\n\n        return $default;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/ResourceBundleInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle;\n\ninterface ResourceBundleInterface\n{\n    public const MAPPING_XML = 'xml';\n\n    public const MAPPING_YAML = 'yaml';\n\n    public const MAPPING_ANNOTATION = 'annotation';\n\n    public const STATE_MACHINE_SYMFONY = 'symfony';\n\n    public const STATE_MACHINE_WINZOU = 'winzou';\n\n    /**\n     * Returns a vector of supported drivers.\n     *\n     * @see SyliusResourceBundle::DRIVER_DOCTRINE_ORM\n     * @see SyliusResourceBundle::DRIVER_DOCTRINE_MONGODB_ODM\n     * @see SyliusResourceBundle::DRIVER_DOCTRINE_PHPCR_ODM\n     */\n    public function getSupportedDrivers(): array;\n}\n"
  },
  {
    "path": "src/Bundle/Resources/config/doctrine/model/AbstractTranslation.orm.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n\n<!--\n\n This file is part of the Sylius package.\n\n (c) Sylius Sp. z o.o.\n\n For the full copyright and license information, please view the LICENSE\n file that was distributed with this source code.\n\n-->\n\n<doctrine-mapping xmlns=\"http://doctrine-project.org/schemas/orm/doctrine-mapping\">\n\n    <mapped-superclass name=\"Sylius\\Resource\\Model\\AbstractTranslation\" />\n\n</doctrine-mapping>\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/console.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Command\\DebugResourceCommand;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->defaults()\n        ->public();\n\n    $services->set('sylius.console.command.resource_debug', DebugResourceCommand::class)\n        ->args([\n            service('sylius.resource_registry'),\n            service('sylius.resource_metadata_collection.factory'),\n        ])\n        ->tag('console.command');\n\n    $services->alias(DebugResourceCommand::class, 'sylius.console.command.resource_debug');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/context.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Context\\Initiator\\LegacyRequestContextInitiator;\nuse Sylius\\Resource\\Context\\Initiator\\RequestContextInitiator;\nuse Sylius\\Resource\\Context\\Initiator\\RequestContextInitiatorInterface;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.context.initiator.request_context', RequestContextInitiator::class);\n\n    $services->alias(RequestContextInitiatorInterface::class, 'sylius.context.initiator.request_context');\n\n    $services->set('sylius.context.initiator.legacy_request_context', LegacyRequestContextInitiator::class)\n        ->decorate('sylius.context.initiator.request_context')\n        ->args([\n            service('sylius.resource_registry'),\n            service('sylius.resource_controller.request_configuration_factory'),\n            service('.inner'),\n            service('sylius.expression_language.vars_resolver.metadata'),\n        ]);\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/controller.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Hateoas\\Representation\\Factory\\PagerfantaFactory;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\DisabledAuthorizationChecker;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\EventDispatcher;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\EventDispatcherInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\FlashHelper;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\FlashHelperInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\NewResourceFactory;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\NewResourceFactoryInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ParametersParser;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ParametersParserInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RedirectHandler;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RedirectHandlerInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfigurationFactory;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfigurationFactoryInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceDeleteHandler;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceDeleteHandlerInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceFormFactory;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceFormFactoryInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourcesCollectionProvider;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourcesCollectionProviderInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourcesResolver;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourcesResolverInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceUpdateHandler;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceUpdateHandlerInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\SingleResourceProvider;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\SingleResourceProviderInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ViewHandler;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ViewHandlerInterface;\nuse Sylius\\Resource\\Symfony\\Controller\\MainController;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.main_controller', MainController::class)\n        ->args([\n            service('sylius.resource_metadata_operation.initiator.http_operation'),\n            service('sylius.context.initiator.request_context'),\n            service('sylius.state_provider.main'),\n            service('sylius.state_processor.main'),\n        ])\n        ->tag('controller.service_arguments');\n\n    $services->set('sylius.resource_controller.parameters_parser', ParametersParser::class)\n        ->args([\n            service('service_container'),\n            service('sylius.expression_language'),\n        ]);\n\n    $services->alias(ParametersParserInterface::class, 'sylius.resource_controller.parameters_parser');\n\n    $services->set('sylius.resource_controller.request_configuration_factory', RequestConfigurationFactory::class)\n        ->args([\n            service('sylius.resource_controller.parameters_parser'),\n            RequestConfiguration::class,\n            '%sylius.resource.settings%',\n        ]);\n\n    $services->alias(RequestConfigurationFactoryInterface::class, 'sylius.resource_controller.request_configuration_factory');\n\n    $services->set('sylius.resource_controller.new_resource_factory', NewResourceFactory::class);\n\n    $services->alias(NewResourceFactoryInterface::class, 'sylius.resource_controller.new_resource_factory');\n\n    $services->set('sylius.resource_controller.single_resource_provider', SingleResourceProvider::class);\n\n    $services->alias(SingleResourceProviderInterface::class, 'sylius.resource_controller.single_resource_provider');\n\n    $services->set('sylius.resource_controller.pagerfanta_representation_factory', PagerfantaFactory::class);\n\n    $services->alias(PagerfantaFactory::class, 'sylius.resource_controller.pagerfanta_representation_factory');\n\n    $services->set('sylius.resource_controller.resources_resolver', ResourcesResolver::class);\n\n    $services->alias(ResourcesResolverInterface::class, 'sylius.resource_controller.resources_resolver');\n\n    $services->set('sylius.resource_controller.resources_collection_provider', ResourcesCollectionProvider::class)\n        ->args([\n            service('sylius.resource_controller.resources_resolver'),\n            service('sylius.resource_controller.pagerfanta_representation_factory')->nullOnInvalid(),\n        ]);\n\n    $services->alias(ResourcesCollectionProviderInterface::class, 'sylius.resource_controller.resources_collection_provider');\n\n    $services->set('sylius.resource_controller.form_factory', ResourceFormFactory::class)\n        ->args([service('form.factory')]);\n\n    $services->alias(ResourceFormFactoryInterface::class, 'sylius.resource_controller.form_factory');\n\n    $services->set('sylius.resource_controller.redirect_handler', RedirectHandler::class)\n        ->args([service('router')]);\n\n    $services->alias(RedirectHandlerInterface::class, 'sylius.resource_controller.redirect_handler');\n\n    $services->set('sylius.resource_controller.authorization_checker.disabled', DisabledAuthorizationChecker::class);\n\n    $services->alias(DisabledAuthorizationChecker::class, 'sylius.resource_controller.authorization_checker.disabled');\n\n    $services->set('sylius.resource_controller.flash_helper', FlashHelper::class)\n        ->args([\n            service('request_stack'),\n            service('translator'),\n            '%locale%',\n        ]);\n\n    $services->alias(FlashHelperInterface::class, 'sylius.resource_controller.flash_helper');\n\n    $services->set('sylius.resource_controller.event_dispatcher', EventDispatcher::class)\n        ->args([service('event_dispatcher')]);\n\n    $services->alias(EventDispatcherInterface::class, 'sylius.resource_controller.event_dispatcher');\n\n    $services->set('sylius.resource_controller.view_handler', ViewHandler::class)\n        ->args([service('fos_rest.view_handler')->nullOnInvalid()]);\n\n    $services->alias(ViewHandlerInterface::class, 'sylius.resource_controller.view_handler');\n\n    $services->set('sylius.resource_controller.resource_update_handler', ResourceUpdateHandler::class)\n        ->args([service('sylius.resource_controller.state_machine')->nullOnInvalid()]);\n\n    $services->alias(ResourceUpdateHandlerInterface::class, 'sylius.resource_controller.resource_update_handler');\n\n    $services->set('sylius.resource_controller.resource_delete_handler', ResourceDeleteHandler::class);\n\n    $services->alias(ResourceDeleteHandlerInterface::class, 'sylius.resource_controller.resource_delete_handler');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/dispatcher.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventDispatcher;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventDispatcherInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventHandler;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventHandlerInterface;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.dispatcher.operation', OperationEventDispatcher::class)\n        ->args([service('event_dispatcher')]);\n\n    $services->alias(OperationEventDispatcherInterface::class, 'sylius.dispatcher.operation');\n\n    $services->set('sylius.event_handler.operation', OperationEventHandler::class)\n        ->args([\n            service('sylius.routing.redirect_handler'),\n            service('sylius.helper.flash'),\n        ]);\n\n    $services->alias(OperationEventHandlerInterface::class, 'sylius.event_handler.operation');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/expression_language.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\ArgumentParser;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\Provider\\ThrowNotFoundOnNullExpressionFunctionProvider;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\RequestVariables;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\SyliusRepositoriesVariables;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\TokenVariables;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\VariablesCollection;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\VarsResolver;\nuse Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.metadata.expression_language', ExpressionLanguage::class);\n\n    $services->set('sylius.resource_factory.expression_language', ExpressionLanguage::class);\n\n    $services->set('sylius.repository.expression_language', ExpressionLanguage::class);\n\n    $services->set('sylius.routing.expression_language', ExpressionLanguage::class);\n\n    $services->set('sylius.expression_language.variables.token', TokenVariables::class)\n        ->args([service('security.token_storage')->nullOnInvalid()])\n        ->tag('sylius.metadata_variables')\n        ->tag('sylius.resource_factory_variables')\n        ->tag('sylius.repository_variables');\n\n    $services->set('sylius.expression_language.variables.request', RequestVariables::class)\n        ->args([service('request_stack')])\n        ->tag('sylius.metadata_variables')\n        ->tag('sylius.resource_factory_variables')\n        ->tag('sylius.repository_variables')\n        ->tag('sylius.routing_variables');\n\n    $services->set('sylius.expression_language.variables.sylius_repositories', SyliusRepositoriesVariables::class)\n        ->args([tagged_locator('sylius.repository')])\n        ->tag('sylius.metadata_variables')\n        ->tag('sylius.resource_factory_variables');\n\n    $services->set('sylius.expression_language.variables_collection.metadata', VariablesCollection::class)\n        ->args([tagged_iterator('sylius.metadata_variables')]);\n\n    $services->set('sylius.expression_language.variables_collection.factory', VariablesCollection::class)\n        ->args([tagged_iterator('sylius.resource_factory_variables')]);\n\n    $services->set('sylius.expression_language.variables_collection.form', VariablesCollection::class)\n        ->args([tagged_iterator('sylius.form_variables')]);\n\n    $services->set('sylius.expression_language.variables_collection.repository', VariablesCollection::class)\n        ->args([tagged_iterator('sylius.repository_variables')]);\n\n    $services->set('sylius.expression_language.variables_collection.routing', VariablesCollection::class)\n        ->args([tagged_iterator('sylius.routing_variables')]);\n\n    $services->set('sylius.expression_language.providers.throw_not_found_on_null', ThrowNotFoundOnNullExpressionFunctionProvider::class)\n        ->tag('sylius.metadata_providers')\n        ->tag('sylius.resource_factory_providers');\n\n    $services->set('sylius.expression_language.vars_resolver.metadata', VarsResolver::class)\n        ->args([service('sylius.expression_language.argument_parser.metadata')]);\n\n    $services->set('sylius.expression_language.argument_parser.metadata', ArgumentParser::class)\n        ->args([\n            service('sylius.metadata.expression_language'),\n            service('sylius.expression_language.variables_collection.metadata'),\n            tagged_iterator('sylius.metadata_providers'),\n        ]);\n\n    $services->set('sylius.expression_language.argument_parser.factory', ArgumentParser::class)\n        ->args([\n            service('sylius.resource_factory.expression_language'),\n            service('sylius.expression_language.variables_collection.factory'),\n            tagged_iterator('sylius.resource_factory_providers'),\n        ]);\n\n    $services->set('sylius.expression_language.argument_parser.form', ArgumentParser::class)\n        ->args([\n            service('sylius.resource_factory.expression_language'),\n            service('sylius.expression_language.variables_collection.form'),\n            tagged_iterator('sylius.resource_factory_providers'),\n        ]);\n\n    $services->set('sylius.expression_language.argument_parser.repository', ArgumentParser::class)\n        ->args([\n            service('sylius.repository.expression_language'),\n            service('sylius.expression_language.variables_collection.repository'),\n            tagged_iterator('sylius.repository_providers'),\n        ]);\n\n    $services->set('sylius.expression_language.argument_parser.routing', ArgumentParser::class)\n        ->args([\n            service('sylius.routing.expression_language'),\n            service('sylius.expression_language.variables_collection.routing'),\n            tagged_iterator('sylius.routing_providers'),\n        ]);\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/form.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\ResourceAutocompleteChoiceType;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\ResourceAutocompleteChoiceType as ResourceAutocompleteChoiceTypeInterface;\nuse Sylius\\Resource\\Symfony\\Form\\Factory\\FormFactory;\nuse Sylius\\Resource\\Symfony\\Form\\Factory\\FormFactoryInterface;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->defaults()\n        ->public();\n\n    $services->set('sylius.form.type.resource_autocomplete_choice', ResourceAutocompleteChoiceType::class)\n        ->args([service('sylius.registry.resource_repository')])\n        ->tag('form.type');\n\n    $services->alias(ResourceAutocompleteChoiceTypeInterface::class, 'sylius.form.type.resource_autocomplete_choice');\n\n    $services->set('sylius.form.factory', FormFactory::class)\n        ->private()\n        ->args([\n            service('form.factory'),\n            service('sylius.expression_language.argument_parser.form'),\n        ]);\n\n    $services->alias(FormFactoryInterface::class, 'sylius.form.factory');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/helper.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\Symfony\\Session\\Flash\\FlashHelper;\nuse Sylius\\Resource\\Symfony\\Session\\Flash\\FlashHelperInterface;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.helper.flash', FlashHelper::class)\n        ->args([service('translator')]);\n\n    $services->alias(FlashHelperInterface::class, 'sylius.helper.flash');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/integrations/doctrine/mongodb-odm.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ODM\\MongoDB\\DocumentRepository;\nuse Sylius\\Bundle\\ResourceBundle\\EventListener\\ODMMappedSuperClassSubscriber;\nuse Sylius\\Bundle\\ResourceBundle\\EventListener\\ODMRepositoryClassSubscriber;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n    $parameters = $container->parameters();\n    $parameters->set('sylius.mongodb_odm.repository.class', DocumentRepository::class);\n\n    $services->defaults()\n        ->public();\n\n    $services->set('sylius.event_subscriber.odm_mapped_super_class', ODMMappedSuperClassSubscriber::class)\n        ->args([service('sylius.resource_registry')])\n        ->tag('doctrine_mongodb.odm.event_subscriber', ['priority' => 8192])\n        ->deprecate('sylius/resource-bundle', '1.3', 'The \"%service_id%\" service is deprecated since sylius/resource-bundle 1.3. Doctrine MongoDB and PHPCR support will no longer be supported in 2.0.');\n\n    $services->set('sylius.event_subscriber.odm_repository_class', ODMRepositoryClassSubscriber::class)\n        ->args([service('sylius.resource_registry')])\n        ->tag('doctrine_mongodb.odm.event_subscriber', ['priority' => 8192])\n        ->deprecate('sylius/resource-bundle', '1.3', 'The \"%service_id%\" service is deprecated since sylius/resource-bundle 1.3. Doctrine MongoDB and PHPCR support will no longer be supported in 2.0.');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/integrations/doctrine/orm.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\ContainerRepositoryFactory;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\EntityRepository;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\Form\\Builder\\DefaultFormBuilder;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\Form\\Builder\\DefaultFormBuilder as DefaultFormBuilderInterface;\nuse Sylius\\Bundle\\ResourceBundle\\EventListener\\ORMMappedSuperClassSubscriber;\nuse Sylius\\Bundle\\ResourceBundle\\EventListener\\ORMRepositoryClassSubscriber;\nuse Sylius\\Bundle\\ResourceBundle\\EventListener\\ORMTranslatableListener as TranslatableListener;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n    $parameters = $container->parameters();\n    $parameters->set('sylius.orm.repository.class', EntityRepository::class);\n    $parameters->set('sylius.translation.translatable_listener.doctrine.orm.class', TranslatableListener::class);\n\n    $services->defaults()\n        ->public();\n\n    $services->set('sylius.event_subscriber.orm_mapped_super_class', ORMMappedSuperClassSubscriber::class)\n        ->args([service('sylius.resource_registry')])\n        ->tag('doctrine.event_listener', ['event' => 'loadClassMetadata', 'priority' => 8192]);\n\n    $services->alias(ORMMappedSuperClassSubscriber::class, 'sylius.event_subscriber.orm_mapped_super_class');\n\n    $services->set('sylius.event_subscriber.orm_repository_class', ORMRepositoryClassSubscriber::class)\n        ->args([service('sylius.resource_registry')])\n        ->tag('doctrine.event_listener', ['event' => 'loadClassMetadata', 'priority' => 8192]);\n\n    $services->alias(ORMRepositoryClassSubscriber::class, 'sylius.event_subscriber.orm_repository_class');\n\n    $services->set('sylius.form_builder.default', DefaultFormBuilder::class)\n        ->private()\n        ->args([service('doctrine.orm.default_entity_manager')])\n        ->tag('sylius.default_resource_form.builder', ['type' => 'doctrine/orm']);\n\n    $services->alias(DefaultFormBuilderInterface::class, 'sylius.form_builder.default')\n        ->private();\n\n    $services->set('sylius.doctrine.orm.container_repository_factory', ContainerRepositoryFactory::class)\n        ->private()\n        ->decorate('doctrine.orm.container_repository_factory')\n        ->args([\n            service('sylius.doctrine.orm.container_repository_factory.inner'),\n            '%sylius.doctrine.orm.container_repository_factory.entities%',\n        ]);\n\n    $services->alias(ContainerRepositoryFactory::class, 'sylius.doctrine.orm.container_repository_factory')\n        ->private();\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/integrations/doctrine/phpcr-odm.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ODM\\PHPCR\\DocumentRepository;\n\nreturn static function (ContainerConfigurator $container) {\n    $parameters = $container->parameters();\n    $parameters->set('sylius.phpcr_odm.repository.class', DocumentRepository::class);\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/integrations/doctrine.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ResourceMappingDriverChain;\nuse Sylius\\Resource\\Doctrine\\Common\\State\\PersistProcessor;\nuse Sylius\\Resource\\Doctrine\\Common\\State\\RemoveProcessor;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set(ResourceMappingDriverChain::class)\n        ->public()\n        ->decorate('doctrine.orm.default_metadata_driver')\n        ->args([\n            service(ResourceMappingDriverChain::class . '.inner'),\n            service('sylius.resource_registry'),\n        ]);\n\n    $services->alias('sylius_resource.doctrine.mapping_driver_chain', ResourceMappingDriverChain::class);\n\n    $services->set(PersistProcessor::class)\n        ->args([service('doctrine')])\n        ->tag('sylius.state_processor');\n\n    $services->set(RemoveProcessor::class)\n        ->args([service('doctrine')])\n        ->tag('sylius.state_processor');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/integrations/grid.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourcesResolverInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\Controller\\ResourcesResolver;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\Parser\\OptionsParser;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\Parser\\OptionsParserInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\Renderer\\TwigBulkActionGridRenderer;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\Renderer\\TwigBulkActionGridRenderer as TwigBulkActionGridRendererInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\Renderer\\TwigGridRenderer;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\Renderer\\TwigGridRenderer as TwigGridRendererInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\LegacyGridViewFactory;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridViewFactory;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridViewFactoryInterface;\nuse Sylius\\Resource\\Grid\\View\\Factory\\GridViewFactory;\nuse Sylius\\Resource\\Grid\\View\\Factory\\GridViewFactoryInterface;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->defaults()\n        ->public();\n\n    $services->set('sylius.grid.resource_view_factory', ResourceGridViewFactory::class)\n        ->args([\n            service('sylius.grid.data_provider'),\n            service('sylius.resource_controller.parameters_parser'),\n        ]);\n\n    $services->alias(ResourceGridViewFactoryInterface::class, 'sylius.grid.resource_view_factory');\n\n    $services->set('sylius.resource_controller.resources_resolver.grid_aware', ResourcesResolver::class)\n        ->decorate('sylius.resource_controller.resources_resolver', null, 256)\n        ->args([\n            service('sylius.resource_controller.resources_resolver.grid_aware.inner'),\n            service('sylius.grid.provider'),\n            service('sylius.grid.resource_view_factory'),\n        ]);\n\n    $services->alias(ResourcesResolverInterface::class, 'sylius.resource_controller.resources_resolver.grid_aware');\n\n    $services->set('sylius.custom_grid_renderer.twig', TwigGridRenderer::class)\n        ->decorate('sylius.grid.renderer.twig', null, 256)\n        ->args([\n            service('sylius.custom_grid_renderer.twig.inner'),\n            service('twig'),\n            service('sylius.grid_options_parser'),\n            '%sylius.grid.templates.action%',\n        ]);\n\n    $services->alias(TwigGridRendererInterface::class, 'sylius.custom_grid_renderer.twig');\n\n    $services->set('sylius.custom_bulk_action_grid_renderer.twig', TwigBulkActionGridRenderer::class)\n        ->decorate('sylius.grid.bulk_action_renderer.twig', null, 256)\n        ->args([\n            service('twig'),\n            service('sylius.grid_options_parser'),\n            '%sylius.grid.templates.bulk_action%',\n        ]);\n\n    $services->alias(TwigBulkActionGridRendererInterface::class, 'sylius.custom_bulk_action_grid_renderer.twig');\n\n    $services->set('sylius.grid_options_parser', OptionsParser::class)\n        ->private()\n        ->args([\n            service('service_container'),\n            service('sylius.expression_language'),\n            service('property_accessor'),\n        ]);\n\n    $services->alias(OptionsParserInterface::class, 'sylius.grid_options_parser')\n        ->private();\n\n    $services->set('sylius.grid.view_factory.legacy', LegacyGridViewFactory::class)\n        ->private()\n        ->decorate('sylius.grid.view_factory.resource')\n        ->args([\n            service('sylius.grid.resource_view_factory'),\n            service('.inner'),\n        ]);\n\n    $services->set('sylius.grid.view_factory.resource', GridViewFactory::class)\n        ->args([service('sylius.grid.data_provider')]);\n\n    $services->alias(GridViewFactoryInterface::class, 'sylius.grid.view_factory.resource');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/integrations/translation.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Bundle\\ResourceBundle\\EventListener\\ORMTranslatableListener;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\ResourceTranslationsType;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\ResourceTranslationsType as ResourceTranslationsTypeInterface;\nuse Sylius\\Component\\Resource\\Translation\\Provider\\ImmutableTranslationLocaleProvider as ComponentImmutableTranslationLocaleProvider;\nuse Sylius\\Component\\Resource\\Translation\\TranslatableEntityLocaleAssigner;\nuse Sylius\\Component\\Resource\\Translation\\TranslatableEntityLocaleAssignerInterface;\nuse Sylius\\Resource\\Translation\\Provider\\ImmutableTranslationLocaleProvider as ResourceImmutableTranslationLocaleProvider;\nuse Sylius\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->defaults()\n        ->public();\n\n    $services->set('sylius.translation_locale_provider.immutable', ResourceImmutableTranslationLocaleProvider::class)\n        ->args([\n            ['' => '%locale%'],\n            '%locale%',\n        ]);\n\n    $services->alias(ComponentImmutableTranslationLocaleProvider::class, 'sylius.translation_locale_provider.immutable')\n        ->deprecate('sylius/resource-bundle', '1.11', 'The \"%alias_id%\" service alias is deprecated since sylius/resource-bundle 1.11 and will be removed in sylius/resource-bundle 2.0. Use Sylius\\Resource\\Translation\\Provider\\ImmutableTranslationLocaleProvider instead.');\n\n    $services->alias(ResourceImmutableTranslationLocaleProvider::class, 'sylius.translation_locale_provider.immutable');\n\n    $services->alias(TranslationLocaleProviderInterface::class, 'sylius.translation_locale_provider.immutable');\n\n    $services->set('sylius.translation.translatable_listener.doctrine.orm', ORMTranslatableListener::class)\n        ->args([\n            service('sylius.resource_registry'),\n            service('sylius.translatable_entity_locale_assigner'),\n        ])\n        ->tag('doctrine.event_listener', ['connection' => 'default', 'event' => 'loadClassMetadata', 'priority' => 99])\n        ->tag('doctrine.event_listener', ['connection' => 'default', 'event' => 'postLoad', 'priority' => 99]);\n\n    $services->alias(ORMTranslatableListener::class, 'sylius.translation.translatable_listener.doctrine.orm');\n\n    $services->set('sylius.form.type.resource_translations', ResourceTranslationsType::class)\n        ->args([service('sylius.translation_locale_provider')])\n        ->tag('form.type');\n\n    $services->alias(ResourceTranslationsTypeInterface::class, 'sylius.form.type.resource_translations');\n\n    $services->set('sylius.translatable_entity_locale_assigner', TranslatableEntityLocaleAssigner::class)\n        ->args([service('sylius.translation_locale_provider')]);\n\n    $services->alias(TranslatableEntityLocaleAssignerInterface::class, 'sylius.translatable_entity_locale_assigner');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/listener.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Negotiation\\Negotiator;\nuse Sylius\\Resource\\Symfony\\EventListener\\AddFormatListener;\nuse Sylius\\Resource\\Symfony\\Validator\\EventListener\\ValidationExceptionListener;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.negotiator', Negotiator::class);\n\n    $services->set('sylius.listener.add_format', AddFormatListener::class)\n        ->args([\n            service('sylius.resource_metadata_operation.initiator.http_operation'),\n            service('sylius.negotiator'),\n        ])\n        ->tag('kernel.event_listener', ['event' => 'kernel.request', 'priority' => 28]);\n\n    $services->set('sylius.listener.exception.validation', ValidationExceptionListener::class)\n        ->args([service('serializer')->nullOnInvalid()])\n        ->tag('kernel.event_listener', ['event' => 'kernel.exception', 'method' => 'onKernelException'])\n        ->lazy();\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/metadata/extractor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\Metadata\\Extractor\\PhpFileResourceExtractor;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.metadata.resource_extractor.php_file', PhpFileResourceExtractor::class)\n        ->args([\n            [],\n            service('service_container'),\n        ]);\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/metadata/inflector.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\Metadata\\Inflector\\Inflector;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.metadata.inflector', Inflector::class);\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/metadata/mutator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\Metadata\\Mutator\\OperationMutatorCollection;\nuse Sylius\\Resource\\Metadata\\Mutator\\ResourceMutatorCollection;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.metadata.mutator_collection.resource', ResourceMutatorCollection::class)\n        ->private();\n\n    $services->set('sylius.metadata.mutator_collection.operation', OperationMutatorCollection::class)\n        ->private();\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/metadata/path_segment_name_generator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\Metadata\\Operation\\DashPathSegmentNameGenerator;\nuse Sylius\\Resource\\Metadata\\Operation\\UnderscorePathSegmentNameGenerator;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.metadata.path_segment_name_generator.underscore', UnderscorePathSegmentNameGenerator::class)\n        ->args([\n            service('sylius.metadata.inflector'),\n        ])\n    ;\n\n    $services->set('sylius.metadata.path_segment_name_generator.dash', DashPathSegmentNameGenerator::class)\n        ->args([\n            service('sylius.metadata.inflector'),\n        ])\n    ;\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/metadata/repository_argument_resolver.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\Symfony\\Request\\RepositoryArgumentResolver;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.repository_argument_resolver.request', RepositoryArgumentResolver::class);\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/metadata/resource_class_list.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\AttributesResourceClassListFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\AttributesResourceClassListFactory as AttributesResourceClassListFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\CachedResourceClassListFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\PhpFileResourceClassListFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\PhpFileResourceClassListFactory as PhpFileResourceClassListFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceClassListFactoryInterface;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.cache.metadata.resource_class_list')\n        ->private()\n        ->parent('cache.system')\n        ->tag('cache.pool');\n\n    $services->alias('sylius.metadata.resource_class_list.factory', 'sylius.metadata.resource_class_list.factory.attributes');\n\n    $services->alias(ResourceClassListFactoryInterface::class, 'sylius.metadata.resource_class_list.factory');\n\n    $services->set('sylius.metadata.resource_class_list.factory.attributes', AttributesResourceClassListFactory::class)\n        ->args(['%sylius.resource.mapping%']);\n\n    $services->alias(AttributesResourceClassListFactoryInterface::class, 'sylius.metadata.resource_class_list.factory.attributes');\n\n    $services->set('sylius.metadata.resource_class_list.cached', CachedResourceClassListFactory::class)\n        ->decorate('sylius.metadata.resource_class_list.factory', null, -10)\n        ->args([\n            service('sylius.cache.metadata.resource_class_list'),\n            service('.inner'),\n        ]);\n\n    $services->set('sylius.metadata.resource_class_list.factory.php_file', PhpFileResourceClassListFactory::class)\n        ->decorate('sylius.metadata.resource_class_list.factory', null, 100)\n        ->args([\n            service('sylius.metadata.resource_extractor.php_file'),\n            service('.inner'),\n        ]);\n\n    $services->alias(PhpFileResourceClassListFactoryInterface::class, 'sylius.metadata.resource_class_list.factory.php_file');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/metadata/resource_metadata_collection.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\Doctrine\\Common\\Metadata\\Resource\\Factory\\DoctrineResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\AttributesResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\CachedResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\EventShortNameResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\FactoryResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\MutatorResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\PhpFileResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\PluralNameResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ProviderResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\RedirectResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\StateMachineResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\TemplatesDirResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\VarsResourceMetadataCollectionFactory;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.cache.metadata.resource_collection')\n        ->private()\n        ->parent('cache.system')\n        ->tag('cache.pool');\n\n    $services->alias('sylius.resource_metadata_collection.factory', 'sylius.resource_metadata_collection.factory.attributes');\n\n    $services->alias(ResourceMetadataCollectionFactoryInterface::class, 'sylius.resource_metadata_collection.factory.attributes');\n\n    $services->set('sylius.resource_metadata_collection.factory.attributes', AttributesResourceMetadataCollectionFactory::class)\n        ->args([\n            service('sylius.resource_registry'),\n            service('sylius.routing.factory.operation_route_name_factory'),\n        ]);\n\n    $services->set('sylius.resource_metadata_collection.factory.php_file', PhpFileResourceMetadataCollectionFactory::class)\n        ->decorate('sylius.resource_metadata_collection.factory', null, 400)\n        ->args([\n            service('sylius.resource_registry'),\n            service('sylius.routing.factory.operation_route_name_factory'),\n            service('sylius.metadata.resource_extractor.php_file'),\n            service('.inner'),\n        ]);\n\n    $services->set('sylius.metadata.resource.metadata_collection_factory.mutator', MutatorResourceMetadataCollectionFactory::class)\n        ->decorate('sylius.resource_metadata_collection.factory', null, 400)\n        ->args([\n            service('sylius.metadata.mutator_collection.resource'),\n            service('sylius.metadata.mutator_collection.operation'),\n            service('.inner'),\n        ]);\n\n    $services->set('sylius.resource_metadata_collection.factory.plural_name', PluralNameResourceMetadataCollectionFactory::class)\n        ->decorate('sylius.resource_metadata_collection.factory', null, 300)\n        ->args([\n            service('.inner'),\n            service('sylius.metadata.inflector'),\n            param('sylius.routing_path_bc_layer'),\n            service('sylius.resource_registry'),\n        ]);\n\n    $services->set('sylius.resource_metadata_collection.factory.state_machine', StateMachineResourceMetadataCollectionFactory::class)\n        ->decorate('sylius.resource_metadata_collection.factory', null, 300)\n        ->args([\n            service('sylius.resource_registry'),\n            service('.inner'),\n            '%sylius.state_machine_component.default%',\n        ]);\n\n    $services->set('sylius.resource_metadata_collection.factory.doctrine', DoctrineResourceMetadataCollectionFactory::class)\n        ->decorate('sylius.resource_metadata_collection.factory', null, 200)\n        ->args([\n            service('sylius.resource_registry'),\n            service('.inner'),\n        ]);\n\n    $services->set('sylius.resource_metadata_collection.factory.redirect', RedirectResourceMetadataCollectionFactory::class)\n        ->decorate('sylius.resource_metadata_collection.factory', null, 200)\n        ->args([\n            service('sylius.routing.factory.operation_route_name_factory'),\n            service('.inner'),\n        ]);\n\n    $services->set('sylius.resource_metadata_collection.factory.vars', VarsResourceMetadataCollectionFactory::class)\n        ->decorate('sylius.resource_metadata_collection.factory')\n        ->args([service('.inner')]);\n\n    $services->set('sylius.resource_metadata_collection.factory.provider', ProviderResourceMetadataCollectionFactory::class)\n        ->decorate('sylius.resource_metadata_collection.factory')\n        ->args([service('.inner')]);\n\n    $services->set('sylius.resource_metadata_collection.factory.resource_factory', FactoryResourceMetadataCollectionFactory::class)\n        ->decorate('sylius.resource_metadata_collection.factory')\n        ->args([\n            service('sylius.resource_registry'),\n            service('.inner'),\n        ]);\n\n    $services->set('sylius.resource_metadata_collection.factory.event_short_name', EventShortNameResourceMetadataCollectionFactory::class)\n        ->decorate('sylius.resource_metadata_collection.factory')\n        ->args([service('.inner')]);\n\n    $services->set('sylius.resource_metadata_collection.factory.templates_dir', TemplatesDirResourceMetadataCollectionFactory::class)\n        ->decorate('sylius.resource_metadata_collection.factory')\n        ->args([\n            service('.inner'),\n            '%sylius.resource.settings%',\n        ]);\n\n    $services->set('sylius.resource_metadata_collection.factory.cached', CachedResourceMetadataCollectionFactory::class)\n        ->decorate('sylius.resource_metadata_collection.factory', null, -10)\n        ->args([\n            service('sylius.cache.metadata.resource_collection'),\n            service('.inner'),\n        ]);\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/metadata/resource_metadata_operation.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\Metadata\\Operation\\HttpOperationInitiator;\nuse Sylius\\Resource\\Metadata\\Operation\\HttpOperationInitiatorInterface;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.resource_metadata_operation.initiator.http_operation', HttpOperationInitiator::class)\n        ->args([\n            service('sylius.resource_registry'),\n            service('sylius.resource_metadata_collection.factory'),\n            service('sylius.expression_language.vars_resolver.metadata'),\n        ]);\n\n    $services->alias(HttpOperationInitiatorInterface::class, 'sylius.resource_metadata_operation.initiator.http_operation');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/metadata.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nreturn static function (ContainerConfigurator $container) {\n    $container->import('metadata/**/**.php');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/routing/loader.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\Symfony\\Routing\\Loader\\ResourceLoader;\nuse Sylius\\Resource\\Symfony\\Routing\\Loader\\ResourceLoader as ResourceLoaderInterface;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.symfony.routing.loader.resource', ResourceLoader::class)\n        ->args([\n            service('sylius.metadata.resource_class_list.factory'),\n            service('sylius.routing.resource.route_collection_factory'),\n        ])\n        ->tag('routing.route_loader');\n\n    $services->alias(ResourceLoaderInterface::class, 'sylius.symfony.routing.loader.resource');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/routing/resource.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\Resource\\ResourceRouteCollectionFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\Resource\\ResourceRouteCollectionFactoryInterface;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.routing.resource.route_collection_factory', ResourceRouteCollectionFactory::class)\n        ->args([\n            service('sylius.routing.factory.operation_route'),\n            service('sylius.resource_metadata_collection.factory'),\n            service('sylius.resource_registry'),\n        ]);\n\n    $services->alias(ResourceRouteCollectionFactoryInterface::class, 'sylius.routing.resource.route_collection_factory');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/routing.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Routing\\CrudRoutesAttributesLoader;\nuse Sylius\\Bundle\\ResourceBundle\\Routing\\ResourceLoader;\nuse Sylius\\Bundle\\ResourceBundle\\Routing\\RouteAttributesFactory;\nuse Sylius\\Bundle\\ResourceBundle\\Routing\\RouteAttributesFactoryInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Routing\\RouteFactory;\nuse Sylius\\Bundle\\ResourceBundle\\Routing\\RoutesAttributesLoader;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\AttributesOperationRouteFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\AttributesOperationRouteFactoryInterface;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\OperationRouteFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\OperationRouteFactoryInterface;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RouteName\\OperationRouteNameFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RouteName\\OperationRouteNameFactoryInterface;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\BulkOperationRoutePathFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\CollectionOperationRoutePathFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\CreateOperationRoutePathFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\DeleteOperationRoutePathFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\OperationRoutePathFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\OperationRoutePathFactoryInterface;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\ShowOperationRoutePathFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\UpdateOperationRoutePathFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\RedirectHandler;\nuse Sylius\\Resource\\Symfony\\Routing\\RedirectHandlerInterface;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n    $container->import('routing/**/**.php');\n\n    $services->defaults()\n        ->public();\n\n    $services->set('sylius.routing.loader.resource', ResourceLoader::class)\n        ->private()\n        ->args([\n            service('sylius.resource_registry'),\n            inline_service(RouteFactory::class),\n            '%kernel.environment%',\n            '%sylius.routing_path_bc_layer%',\n        ])\n        ->tag('routing.loader')\n        ->deprecate('sylius/resource', '1.13', 'The \"%service_id%\" service is deprecated since sylius/resource-bundle 1.13 and will be removed in sylius/resource-bundle 2.0. Use \"sylius.symfony.routing.loader.resource\" instead.');\n\n    $services->alias(ResourceLoader::class, 'sylius.routing.loader.resource')\n        ->private();\n\n    $services->set('sylius.routing.loader.crud_routes_attributes', CrudRoutesAttributesLoader::class)\n        ->private()\n        ->args([\n            '%sylius.resource.mapping%',\n            service('sylius.routing.loader.resource'),\n        ])\n        ->tag('routing.route_loader');\n\n    $services->alias(CrudRoutesAttributesLoader::class, 'sylius.routing.loader.crud_routes_attributes')\n        ->private();\n\n    $services->set('sylius.routing.loader.routes_attributes', RoutesAttributesLoader::class)\n        ->private()\n        ->args([\n            '%sylius.resource.mapping%',\n            service('sylius.routing.factory.route_attributes'),\n            service('sylius.routing.factory.attributes_operation_route'),\n        ])\n        ->tag('routing.route_loader')\n        ->deprecate('sylius/resource', '1.13', 'The \"%service_id%\" service is deprecated since sylius/resource-bundle 1.13 and will be removed in sylius/resource-bundle 2.0. Use \"sylius.symfony.routing.loader.resource\" instead.');\n\n    $services->alias(RoutesAttributesLoader::class, 'sylius.routing.loader.routes_attributes')\n        ->private();\n\n    $services->set('sylius.routing.factory.operation_route_name_factory', OperationRouteNameFactory::class)\n        ->private();\n\n    $services->alias(OperationRouteNameFactoryInterface::class, 'sylius.routing.factory.operation_route_name_factory');\n\n    $services->set('sylius.routing.factory.operation_route_path_factory.default', OperationRoutePathFactory::class)\n        ->private();\n\n    $services->alias('sylius.routing.factory.operation_route_path_factory', 'sylius.routing.factory.operation_route_path_factory.default');\n\n    $services->alias(OperationRoutePathFactoryInterface::class, 'sylius.routing.factory.operation_route_path_factory');\n\n    $services->set('sylius.routing.factory.operation_route_path_factory.collection', CollectionOperationRoutePathFactory::class)\n        ->decorate('sylius.routing.factory.operation_route_path_factory.default', null, 60)\n        ->args([\n            service('.inner'),\n            service('sylius.path_segment_name_generator'),\n        ])\n    ;\n\n    $services->set('sylius.routing.factory.operation_route_path_factory.create', CreateOperationRoutePathFactory::class)\n        ->decorate('sylius.routing.factory.operation_route_path_factory.default', null, -50)\n        ->args([\n            service('.inner'),\n            service('sylius.path_segment_name_generator'),\n        ])\n    ;\n\n    $services->set('sylius.routing.factory.operation_route_path_factory.bulk_operation', BulkOperationRoutePathFactory::class)\n        ->decorate('sylius.routing.factory.operation_route_path_factory.default', null, -40)\n        ->args([\n            service('.inner'),\n            service('sylius.path_segment_name_generator'),\n        ]);\n\n    $services->set('sylius.routing.factory.operation_route_path_factory.update', UpdateOperationRoutePathFactory::class)\n        ->decorate('sylius.routing.factory.operation_route_path_factory.default', null, -30)\n        ->args([\n            service('.inner'),\n            service('sylius.path_segment_name_generator'),\n        ])\n    ;\n\n    $services->set('sylius.routing.factory.operation_route_path_factory.delete', DeleteOperationRoutePathFactory::class)\n        ->decorate('sylius.routing.factory.operation_route_path_factory.default', null, -20)\n        ->args([\n            service('.inner'),\n            service('sylius.path_segment_name_generator'),\n        ])\n    ;\n\n    $services->set('sylius.routing.factory.operation_route_path_factory.show', ShowOperationRoutePathFactory::class)\n        ->decorate('sylius.routing.factory.operation_route_path_factory.default', null, -10)\n        ->args([\n            service('.inner'),\n            service('sylius.path_segment_name_generator'),\n        ])\n    ;\n\n    $services->set('sylius.routing.factory.route_attributes', RouteAttributesFactory::class)\n        ->private();\n\n    $services->alias(RouteAttributesFactoryInterface::class, 'sylius.routing.factory.route_attributes');\n\n    $services->set('sylius.routing.factory.attributes_operation_route', AttributesOperationRouteFactory::class)\n        ->private()\n        ->args([\n            service('sylius.resource_registry'),\n            service('sylius.routing.factory.operation_route'),\n            service('sylius.resource_metadata_collection.factory'),\n        ])\n        ->deprecate('sylius/resource-bundle', '1.13', 'The \"%service_id%\" service is deprecated since sylius/resource-bundle 1.13 and will be removed in sylius/resource-bundle 2.0. Use \"sylius.routing.resource.route_collection_factory\" instead.');\n\n    $services->alias(AttributesOperationRouteFactoryInterface::class, 'sylius.routing.factory.attributes_operation_route')\n        ->deprecate('sylius/resource-bundle', '1.13', 'The \"%alias_id%\" service is deprecated since sylius/resource-bundle 1.13 and will be removed in sylius/resource-bundle 2.0. Use \"sylius.routing.resource.route_collection_factory\" instead.');\n\n    $services->set('sylius.routing.factory.operation_route', OperationRouteFactory::class)\n        ->private()\n        ->args([\n            service('sylius.routing.factory.operation_route_path_factory'),\n            service('sylius.path_segment_name_generator'),\n            param('sylius.routing_path_bc_layer'),\n        ]);\n\n    $services->alias(OperationRouteFactoryInterface::class, 'sylius.routing.factory.operation_route');\n\n    $services->set('sylius.routing.redirect_handler', RedirectHandler::class)\n        ->args([\n            service('router'),\n            service('sylius.expression_language.argument_parser.routing'),\n            service('sylius.routing.factory.operation_route_name_factory'),\n            service('sylius.grid.filter_storage')->nullOnInvalid(),\n        ]);\n\n    $services->alias(RedirectHandlerInterface::class, 'sylius.routing.redirect_handler');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/security.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\Metadata\\OperationAccessCheckerInterface;\nuse Sylius\\Resource\\Symfony\\Security\\OperationAccessChecker;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.security.operation_access_checker', OperationAccessChecker::class)\n        ->args([\n            service('sylius.expression_language')->nullOnInvalid(),\n            service('security.authentication.trust_resolver')->nullOnInvalid(),\n            service('security.role_hierarchy')->nullOnInvalid(),\n            service('security.token_storage')->nullOnInvalid(),\n            service('security.authorization_checker')->nullOnInvalid(),\n        ]);\n\n    $services->alias(OperationAccessCheckerInterface::class, 'sylius.security.operation_access_checker');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/state/processor/write.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\State\\Processor;\nuse Sylius\\Resource\\State\\Processor\\BulkAwareProcessor;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\State\\DispatchPostWriteEventProcessor;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\State\\DispatchPreWriteEventProcessor;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.state_processor.locator', Processor::class)\n        ->args([tagged_locator('sylius.state_processor')]);\n\n    $services->set('sylius.state_processor.dispatch_pre_write_event', DispatchPreWriteEventProcessor::class)\n        ->decorate('sylius.state_processor.locator', null, 200)\n        ->args([\n            service('.inner'),\n            service('sylius.dispatcher.operation'),\n            service('sylius.event_handler.operation'),\n        ]);\n\n    $services->set('sylius.state_processor.dispatch_post_write_event', DispatchPostWriteEventProcessor::class)\n        ->decorate('sylius.state_processor.locator', null, 200)\n        ->args([\n            service('.inner'),\n            service('sylius.dispatcher.operation'),\n            service('sylius.event_handler.operation'),\n        ]);\n\n    $services->set('sylius.state_processor.bulk_aware', BulkAwareProcessor::class)\n        ->decorate('sylius.state_processor.locator', null, 100)\n        ->args([service('.inner')]);\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/state/processor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\State\\Processor\\FlashProcessor;\nuse Sylius\\Resource\\State\\Processor\\RespondProcessor;\nuse Sylius\\Resource\\State\\Processor\\WriteProcessor;\nuse Sylius\\Resource\\Symfony\\Serializer\\State\\SerializeProcessor;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->alias('sylius.state_processor.main', 'sylius.state_processor.respond');\n\n    $services->set('sylius.state_processor.respond', RespondProcessor::class)\n        ->args([service('sylius.state_responder')]);\n\n    $services->set('sylius.state_processor.write', WriteProcessor::class)\n        ->decorate('sylius.state_processor.main', null, 100)\n        ->args([\n            service('.inner'),\n            service('sylius.state_processor.locator'),\n        ]);\n\n    $services->set('sylius.state_processor.serialize', SerializeProcessor::class)\n        ->decorate('sylius.state_processor.main', null, 200)\n        ->args([\n            service('.inner'),\n            service('serializer')->nullOnInvalid(),\n        ]);\n\n    $services->set('sylius.state_processor.flash', FlashProcessor::class)\n        ->decorate('sylius.state_processor.main', null, 300)\n        ->args([\n            service('.inner'),\n            service('sylius.helper.flash'),\n        ]);\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/state/provider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\State\\Provider\\FactoryProvider;\nuse Sylius\\Resource\\State\\Provider\\ReadProvider;\nuse Sylius\\Resource\\State\\Provider\\SecurityProvider;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\State\\DispatchPostReadEventProvider;\nuse Sylius\\Resource\\Symfony\\Form\\State\\FormProvider;\nuse Sylius\\Resource\\Symfony\\Serializer\\State\\DeserializeProvider;\nuse Sylius\\Resource\\Symfony\\Validator\\State\\ValidateProvider;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.state_provider.read', ReadProvider::class)\n        ->decorate('sylius.state_provider.locator')\n        ->args([service('.inner')]);\n\n    $services->alias('sylius.state_provider.main', 'sylius.state_provider.read');\n\n    $services->set('sylius.state_provider.factory', FactoryProvider::class)\n        ->decorate('sylius.state_provider.read', null, 500)\n        ->args([\n            service('.inner'),\n            service('sylius.state_factory'),\n        ]);\n\n    $services->set('sylius.state_provider.dispatch_post_read_event', DispatchPostReadEventProvider::class)\n        ->decorate('sylius.state_provider.read', null, 400)\n        ->args([\n            service('.inner'),\n            service('sylius.dispatcher.operation'),\n        ]);\n\n    $services->set('sylius.state_provider.deserialize', DeserializeProvider::class)\n        ->decorate('sylius.state_provider.read', null, 300)\n        ->args([\n            service('.inner'),\n            service('serializer')->nullOnInvalid(),\n        ]);\n\n    $services->set('sylius.state_provider.form', FormProvider::class)\n        ->decorate('sylius.state_provider.read', null, 200)\n        ->args([\n            service('.inner'),\n            service('sylius.form.factory'),\n        ]);\n\n    $services->set('sylius.state_provider.validate', ValidateProvider::class)\n        ->decorate('sylius.state_provider.read', null, 100)\n        ->args([\n            service('.inner'),\n            service('validator'),\n        ]);\n\n    $services->set('sylius.state_provider.security', SecurityProvider::class)\n        ->decorate('sylius.state_provider.read', null, -100)\n        ->args([\n            service('.inner'),\n            service('sylius.security.operation_access_checker'),\n        ]);\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/state.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\Doctrine\\Common\\State\\PersistProcessor;\nuse Sylius\\Resource\\State\\Factory;\nuse Sylius\\Resource\\State\\FactoryInterface;\nuse Sylius\\Resource\\State\\Provider;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Sylius\\Resource\\State\\Responder;\nuse Sylius\\Resource\\State\\ResponderInterface;\nuse Sylius\\Resource\\Symfony\\Request\\State\\ApiResponder;\nuse Sylius\\Resource\\Symfony\\Request\\State\\TwigResponder;\nuse Sylius\\Resource\\Symfony\\Response\\ApiHeadersInitiator;\nuse Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n    $container->import('state/**/*.php');\n\n    $services->set('sylius.resource_factory.expression_language', ExpressionLanguage::class);\n\n    $services->set('sylius.state_provider.locator', Provider::class)\n        ->args([tagged_locator('sylius.state_provider')]);\n\n    $services->alias(ProviderInterface::class, 'sylius.state_provider');\n\n    $services->set('sylius.state_factory', Factory::class)\n        ->args([\n            tagged_locator('sylius.resource_factory'),\n            service('sylius.expression_language.argument_parser.factory'),\n        ]);\n\n    $services->alias(FactoryInterface::class, 'sylius.state_factory');\n\n    $services->set('sylius.state_responder', Responder::class)\n        ->args([tagged_locator('sylius.state_responder')]);\n\n    $services->alias(ResponderInterface::class, 'sylius.state_responder');\n\n    $services->set('Sylius\\Resource\\Symfony\\Request\\State\\Provider')\n        ->args([\n            tagged_locator('sylius.repository'),\n            service('sylius.repository_argument_resolver.request'),\n            service('sylius.expression_language.argument_parser.repository'),\n        ])\n        ->tag('sylius.state_provider');\n\n    $services->set('Sylius\\Resource\\StateMachine\\State\\ApplyStateMachineTransitionProcessor')\n        ->args([\n            service('sylius.state_machine.operation'),\n            service(PersistProcessor::class)->nullOnInvalid(),\n        ])\n        ->tag('sylius.state_processor');\n\n    $services->set('Sylius\\Resource\\Symfony\\Request\\State\\Responder')\n        ->args([tagged_locator('sylius.state_responder')])\n        ->tag('sylius.state_responder');\n\n    $services->set('sylius.state_responder.html', TwigResponder::class)\n        ->args([\n            service('sylius.routing.redirect_handler'),\n            service('sylius.twig.context.factory'),\n            service('twig')->nullOnInvalid(),\n        ])\n        ->tag('sylius.state_responder');\n\n    $services->set('sylius.headers_initiator.api', ApiHeadersInitiator::class);\n\n    $services->set('sylius.state_responder.api', ApiResponder::class)\n        ->args([service('sylius.headers_initiator.api')])\n        ->tag('sylius.state_responder');\n\n    $services->set('Sylius\\Resource\\Grid\\State\\RequestGridProvider')\n        ->args([\n            service('sylius.grid.view_factory.resource')->nullOnInvalid(),\n            service('sylius.grid.provider')->nullOnInvalid(),\n        ])\n        ->tag('sylius.state_provider');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/state_machine.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Resource\\StateMachine\\OperationStateMachine;\nuse Sylius\\Resource\\StateMachine\\OperationStateMachineInterface;\nuse Sylius\\Resource\\Symfony\\Workflow\\OperationStateMachine as SymfonyOperationStateMachine;\nuse Sylius\\Resource\\Winzou\\StateMachine\\OperationStateMachine as WinzouOperationStateMachine;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.state_machine.operation', OperationStateMachine::class)\n        ->args([tagged_locator('sylius_resource.state_machine', indexAttribute: 'key')]);\n\n    $services->alias(OperationStateMachineInterface::class, 'sylius.state_machine.operation');\n\n    $services->alias('sylius.state_machine.operation.default', 'sylius.state_machine.operation.winzou');\n\n    $services->set('sylius.state_machine.operation.symfony', SymfonyOperationStateMachine::class)\n        ->args([service('workflow.registry')->nullOnInvalid()])\n        ->tag('sylius_resource.state_machine', ['key' => 'symfony']);\n\n    $services->set('sylius.state_machine.operation.winzou', WinzouOperationStateMachine::class)\n        ->args([service('sm.factory')->nullOnInvalid()])\n        ->tag('sylius_resource.state_machine', ['key' => 'winzou']);\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/storage.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Storage\\CookieStorage;\nuse Sylius\\Bundle\\ResourceBundle\\Storage\\CookieStorage as CookieStorageInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Storage\\SessionStorage;\nuse Sylius\\Bundle\\ResourceBundle\\Storage\\SessionStorage as SessionStorageInterface;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->defaults()\n        ->public();\n\n    $services->set('sylius.storage.session', SessionStorage::class)\n        ->args([service('request_stack')]);\n\n    $services->alias(SessionStorageInterface::class, 'sylius.storage.session');\n\n    $services->set('sylius.storage.cookie', CookieStorage::class)\n        ->tag('kernel.event_subscriber');\n\n    $services->alias(CookieStorageInterface::class, 'sylius.storage.cookie');\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services/twig.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Twig\\Context\\LegacyContextFactory;\nuse Sylius\\Resource\\Twig\\Context\\Factory\\ContextFactory;\nuse Sylius\\Resource\\Twig\\Context\\Factory\\ContextFactoryInterface;\nuse Sylius\\Resource\\Twig\\Context\\Factory\\DefaultContextFactory;\nuse Sylius\\Resource\\Twig\\Context\\Factory\\RequestContextFactory;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n\n    $services->set('sylius.twig.context.factory', ContextFactory::class)\n        ->args([tagged_locator('sylius.twig_context_factory')]);\n\n    $services->set('sylius.twig.context.factory.default', DefaultContextFactory::class)\n        ->tag('sylius.twig_context_factory');\n\n    $services->alias(ContextFactoryInterface::class, 'sylius.twig.context.factory.default');\n\n    $services->set('sylius.twig.context.factory.request', RequestContextFactory::class)\n        ->decorate('sylius.twig.context.factory')\n        ->args([service('.inner')]);\n\n    $services->set('sylius.twig.context.factory.legacy', LegacyContextFactory::class)\n        ->decorate('sylius.twig.context.factory')\n        ->args([service('.inner')]);\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/services.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Symfony\\Component\\DependencyInjection\\Loader\\Configurator;\n\nuse Sylius\\Bundle\\ResourceBundle\\ExpressionLanguage\\ExpressionLanguage as BundleExpressionLanguage;\nuse Sylius\\Bundle\\ResourceBundle\\ExpressionLanguage\\ExpressionLanguage as BundleExpressionLanguageInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Extension\\CollectionTypeExtension;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Extension\\CollectionTypeExtension as CollectionTypeExtensionInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Extension\\HttpFoundation\\HttpFoundationRequestHandler;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\DefaultResourceType;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\DefaultResourceType as DefaultResourceTypeInterface;\nuse Sylius\\Component\\Registry\\ServiceRegistry;\nuse Sylius\\Resource\\Generator\\RandomnessGenerator;\nuse Sylius\\Resource\\Generator\\RandomnessGeneratorInterface;\nuse Sylius\\Resource\\Metadata\\Registry;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\n\nreturn static function (ContainerConfigurator $container) {\n    $services = $container->services();\n    $parameters = $container->parameters();\n    $container->import('services/console.php');\n    $container->import('services/context.php');\n    $container->import('services/controller.php');\n    $container->import('services/dispatcher.php');\n    $container->import('services/expression_language.php');\n    $container->import('services/form.php');\n    $container->import('services/helper.php');\n    $container->import('services/listener.php');\n    $container->import('services/metadata.php');\n    $container->import('services/routing.php');\n    $container->import('services/security.php');\n    $container->import('services/state.php');\n    $container->import('services/state_machine.php');\n    $container->import('services/storage.php');\n    $container->import('services/twig.php');\n\n    $parameters->set('sylius.state_machine.class', 'Sylius\\Resource\\StateMachine\\StateMachine');\n\n    $services->defaults()\n        ->public();\n\n    $services->set('sylius.random_generator', RandomnessGenerator::class);\n\n    $services->alias(RandomnessGeneratorInterface::class, 'sylius.random_generator');\n\n    $services->alias(\\Sylius\\Component\\Resource\\Generator\\RandomnessGeneratorInterface::class, 'sylius.random_generator')\n        ->deprecate('sylius/resource-bundle', '1.11', 'The \"%alias_id%\" service alias is deprecated since sylius/resource-bundle 1.11 and will be removed in sylius/resource-bundle 2.0. Use Sylius\\Resource\\Generator\\RandomnessGeneratorInterface instead.');\n\n    $services->set('sylius.form.type_extension.form.request_handler', HttpFoundationRequestHandler::class)\n        ->private()\n        ->decorate('form.type_extension.form.request_handler', null, 256);\n\n    $services->set('sylius.resource_registry', Registry::class)\n        ->private();\n\n    $services->alias(RegistryInterface::class, 'sylius.resource_registry')\n        ->private();\n\n    $services->alias(\\Sylius\\Component\\Resource\\Metadata\\RegistryInterface::class, 'sylius.resource_registry')\n        ->private()\n        ->deprecate('sylius/resource-bundle', '1.11', 'The \"%alias_id%\" service alias is deprecated since sylius/resource-bundle 1.11 and will be removed in sylius/resource-bundle 2.0. Use Sylius\\Resource\\Metadata\\RegistryInterface instead.');\n\n    $services->set('sylius.expression_language', BundleExpressionLanguage::class)\n        ->private();\n\n    $services->alias(BundleExpressionLanguageInterface::class, 'sylius.expression_language')\n        ->private();\n\n    $services->set('sylius.form.extension.type.collection', CollectionTypeExtension::class)\n        ->tag('form.type_extension', ['extended_type' => 'Symfony\\Component\\Form\\Extension\\Core\\Type\\CollectionType']);\n\n    $services->alias(CollectionTypeExtensionInterface::class, 'sylius.form.extension.type.collection');\n\n    $services->set('sylius.form.type.default', DefaultResourceType::class)\n        ->args([\n            service('sylius.resource_registry'),\n            service('sylius.registry.form_builder'),\n        ])\n        ->tag('form.type');\n\n    $services->alias(DefaultResourceTypeInterface::class, 'sylius.form.type.default');\n\n    $services->set('sylius.registry.resource_repository', ServiceRegistry::class)\n        ->private()\n        ->args([\n            'Doctrine\\Persistence\\ObjectRepository',\n            'resource repository',\n        ]);\n\n    $services->set('sylius.registry.form_builder', ServiceRegistry::class)\n        ->private()\n        ->args([\n            'Sylius\\Bundle\\ResourceBundle\\Form\\Builder\\DefaultFormBuilderInterface',\n            'form builder',\n        ]);\n};\n"
  },
  {
    "path": "src/Bundle/Resources/config/validation/AbstractTranslation.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<!--\n\n This file is part of the Sylius package.\n\n (c) Sylius Sp. z o.o.\n\n For the full copyright and license information, please view the LICENSE\n file that was distributed with this source code.\n\n-->\n\n<constraint-mapping xmlns=\"http://symfony.com/schema/dic/constraint-mapping\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/services/constraint-mapping-1.0.xsd\">\n    <class name=\"Sylius\\Resource\\Model\\AbstractTranslation\">\n        <constraint name=\"Symfony\\Bridge\\Doctrine\\Validator\\Constraints\\UniqueEntity\">\n            <option name=\"fields\">\n                <value>locale</value>\n                <value>translatable</value>\n            </option>\n            <option name=\"groups\">sylius</option>\n            <option name=\"message\">sylius.resource.translation.locale.unique</option>\n        </constraint>\n        <property name=\"locale\">\n            <constraint name=\"NotBlank\">\n                <option name=\"groups\">sylius</option>\n                <option name=\"message\">sylius.resource.translation.locale.not_blank</option>\n            </constraint>\n            <constraint name=\"Locale\">\n                <option name=\"groups\">sylius</option>\n                <option name=\"message\">sylius.resource.translation.locale.invalid</option>\n            </constraint>\n        </property>\n    </class>\n</constraint-mapping>\n"
  },
  {
    "path": "src/Bundle/Resources/config/validation/TranslatableInterface.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<!--\n\n This file is part of the Sylius package.\n\n (c) Sylius Sp. z o.o.\n\n For the full copyright and license information, please view the LICENSE\n file that was distributed with this source code.\n\n-->\n\n<constraint-mapping xmlns=\"http://symfony.com/schema/dic/constraint-mapping\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/services/constraint-mapping-1.0.xsd\">\n    <class name=\"Sylius\\Resource\\Model\\TranslatableInterface\">\n        <getter property=\"translations\">\n            <constraint name=\"Valid\" />\n        </getter>\n    </class>\n</constraint-mapping>\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.ar.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: 'تم بنجاح تحديث %resource%.'\n        update: 'تم بنجاح تحديث %resource%.'\n        delete: 'تم بنجاح حذف %resource%.'\n        move: 'وقد تم بنجاح نقل %resource%.'\n        generate: 'تم بنجاح إنشاء %resource%.'\n        revert: 'تم بنجاح حذف %resource%.'\n        restore_deleted: 'تم إسترجاع %resource% بنجاح.'\n        enable: 'تم تمكين %resource% بنجاح.'\n        disable: 'تم تعطيل %resource% بنجاح.'\n        delete_error: 'لا يمكن حذف، %resource% قيد الاستخدام.'\n        race_condition_error: 'لا يمكن تحديث، %resource% تعديل سابقا.'\n        something_went_wrong_error: 'حدث خطأ ما، يرجى المحاولة مرة أخرى.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.be.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% быў паспяхова створаны.'\n        update: '%resource% быў паспяхова абноўлены.'\n        delete: '%resource% быў паспяхова выдалены.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.bg.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% е създаден успешно.'\n        update: '%resource% е актуализиран успешно.'\n        delete: '%resource% е изтрит успешно.'\n        move: '%resource% е преместен успешно.'\n        generate: '%resource% е успешно генериран.'\n        revert: '%resource% е върнат успешно.'\n        restore_deleted: '%resource% е възстановен успешно.'\n        enable: '%resource% е включен успешно.'\n        disable: '%resource% е изключен успешно.'\n        delete_error: 'Не може да изтриете, %resource% той се използва.'\n        race_condition_error: 'Не може да се актуализира, %resource% е бил променен преди това.'\n        something_went_wrong_error: 'Нещо се обърка, моля, опитайте отново.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.cs.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% byl úspěšně vytvořen.'\n        update: '%resource% byl úspěšně aktualizován.'\n        delete: '%resource% byl úspěšně smazán.'\n        bulk_delete: '%resources% byly úspěšně smazány.'\n        move: '%resource% byl úspěšně přesunut.'\n        generate: '% resource%s byly úspěšně vytvořeny.'\n        revert: '%resource% byl úspěšně obnoven.'\n        restore_deleted: '%resource% byl úspěšně obnoven.'\n        enable: '%resource% byl úspěšně povolen.'\n        disable: '%resource% byl úspěšně zakázán.'\n        delete_error: 'Nelze odstranit, %resource% je používán.'\n        race_condition_error: 'Nelze aktualizovat, %resource% byl změněn.'\n        something_went_wrong_error: 'Něco se pokazilo. Zkuste to prosím znovu.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.da.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% er blevet oprettet.'\n        update: '%resource% er blevet opdateret.'\n        delete: '%resource% er blevet slettet.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.de.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% wurde erfolgreich erstellt.'\n        update: '%resource% wurde erfolgreich aktualisiert.'\n        delete: '%resource% wurde erfolgreich gelöscht.'\n        bulk_delete: '%resources% wurden erfolgreich gelöscht.'\n        move: '%resource% wurde erfolgreich verschoben.'\n        generate: 'Mehrere Elemente (%resource%) wurden erfolgreich generiert.'\n        revert: '%resource% wurden erfolgreich zurückgesetzt.'\n        restore_deleted: '%resource% wurde erfolgreich wiederhergestellt.'\n        enable: '%resource% wurde erfolgreich aktiviert.'\n        disable: '%resource% wurde erfolgreich deaktiviert.'\n        delete_error: 'Löschen fehlgeschlagen, %resource% wird benutzt.'\n        race_condition_error: 'Kann nicht aktualisiert werden, die %resource% wurde zuvor geändert.'\n        something_went_wrong_error: 'Etwas ist schief gelaufen, bitte versuchen Sie es erneut.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.de_CH.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% wurde erfolgreich erstellt.'\n        update: '%resource% wurde erfolgreich aktualisiert.'\n        delete: '%resource% wurde erfolgreich gelöscht.'\n        bulk_delete: '%resources% wurden erfolgreich gelöscht.'\n        move: '%resource% wurde erfolgreich verschoben.'\n        generate: 'Mehrere Elemente (%resource%) wurden erfolgreich generiert.'\n        revert: '%resource% wurden erfolgreich zurückgesetzt.'\n        restore_deleted: '%resource% wurde erfolgreich wiederhergestellt.'\n        enable: '%resource% wurde erfolgreich aktiviert.'\n        disable: '%resource% wurde erfolgreich deaktiviert.'\n        delete_error: 'Löschen fehlgeschlagen, %resource% wird benutzt.'\n        race_condition_error: 'Kann nicht aktualisiert werden, die %resource% wurde zuvor geändert.'\n        something_went_wrong_error: 'Etwas ist schief gelaufen, bitte versuchen Sie es erneut.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.el.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: 'Το %resource% δημιουργήθηκε με επιτυχία.'\n        update: 'Το %resource% ενημερώθηκε με επιτυχία.'\n        delete: 'Το %resource% διαγράφηκε με επιτυχία.'\n        move: '%resource% μεταφέρθηκε με επιτυχία.'\n        generate: '%resource% δημιουργήθηκε με επιτυχία.'\n        revert: '%resource% έχει επανέλθει με επιτυχία.'\n        restore_deleted: '%resource%. Επιτυχής επαναφορά.'\n        enable: '%resource% ενεργοποιήθηκε με επιτυχία.'\n        disable: '%resource% απενεργοποιήθηκε με επιτυχία.'\n        delete_error: 'Αδύνατη η διαγραφή, %resource% είναι σε χρήση.'\n        race_condition_error: 'Δεν είναι δυνατή η ενημέρωση, %resource% έχει προηγουμένως τροποποιηθεί.'\n        something_went_wrong_error: 'Κάτι πήγε στραβά, παρακαλώ προσπαθήστε ξανά.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.en.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% has been successfully created.'\n        update: '%resource% has been successfully updated.'\n        delete: '%resource% has been successfully deleted.'\n        bulk_delete: '%resources% have been successfully deleted.'\n        move: '%resource% has been successfully moved.'\n        generate: '%resource%s have been successfully generated.'\n        revert: '%resource% has been successfully reverted.'\n        restore_deleted: '%resource% has been successfully restored.'\n        enable: '%resource% has been successfully enabled.'\n        disable: '%resource% has been successfully disabled.'\n        delete_error: 'Cannot delete, the %resource% is in use.'\n        race_condition_error: 'Cannot update, the %resource% was previously modified.'\n        something_went_wrong_error: 'Something went wrong, please try again.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.es.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: 'El %resource% se ha creado con éxito.'\n        update: 'El %resource% se ha actualizado con éxito.'\n        delete: 'El %resource% se ha eliminado con éxito.'\n        move: 'El %resource% se ha movido con éxito.'\n        generate: 'Los %resource%s se han generado con éxito.'\n        revert: 'El %resource% se ha revertido con éxito.'\n        restore_deleted: 'El %resource% se ha restaurado con éxito.'\n        enable: 'El %resource% se ha activado con éxito.'\n        disable: 'El %resource% se ha desactivado con éxito.'\n        delete_error: 'No se puede eliminar, el %resource% está en uso.'\n        race_condition_error: 'No se puede actualizar, el recurso %resource% fue modificado previamente.'\n        something_went_wrong_error: 'Algo salió mal. Por favor, inténtalo de nuevo.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.fa.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% با موفقیت ساخته شد.'\n        update: '%resource% با موفقیت به روز شد.'\n        delete: '%resource% با موفقیت حذف شد.'\n        move: '%resource% با موفقیت منتقل شد.'\n        generate: '%resource% با موفقیت ایجاد شد.'\n        revert: '%resource% با موفقیت به تنظیمات اولیه بازگردانده شد.'\n        restore_deleted: '%resource% با موفقیت بازگردانده شد.'\n        enable: '%resource% با موفقیت فعال شد.'\n        disable: '%resource% با موفقیت غیرفعال شد.'\n        delete_error: 'امکان حذف وجود ندارد. %resource% در حال استفاده می باشد.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.fr.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% a bien été créé.'\n        update: '%resource% a bien été mis à jour.'\n        delete: '%resource% a bien été supprimé.'\n        bulk_delete: '%resources% ont bien été supprimés.'\n        move: '%resource% a été déplacé avec succès.'\n        generate: '%resource%s ont été générés avec succès.'\n        revert: 'Les modifications de %resource% ont bien été annulées.'\n        restore_deleted: '%resource% a bien été restauré.'\n        enable: '%resource% a bien été activé.'\n        disable: '%resource% a bien été désactivé.'\n        delete_error: 'Impossible de supprimer, %resource% est en cours d''utilisation.'\n        race_condition_error: 'Mise à jour impossible, %resource% a été modifiée précédemment.'\n        something_went_wrong_error: 'Une erreur s''est produite, merci de réessayer.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.hr.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% je uspješno izvršen.'\n        update: '%resource% je uspješno ažuriran.'\n        delete: '%resource% je uspješno obrisan.'\n        bulk_delete: '%resources% je uspješno obrisan.'\n        move: '%resource% je uspješno pomaknut.'\n        generate: '%resource% je uspješno generiran.'\n        revert: '%resource% je uspješno vraćen.'\n        restore_deleted: '%resource% je uspješno obnovljen.'\n        enable: '%resource% je uspješno omogućen.'\n        disable: '%resource% je uspješno onemogućen.'\n        delete_error: 'Nemoguće izbrisati, %resource% se koristi.'\n        race_condition_error: 'Nije moguće ažurirati, %resource% je prethodno modificiran.'\n        something_went_wrong_error: 'Nešto je pošlo po zlu. Molimo pokušajte ponovno.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.hu.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% sikeresen létrehozva.'\n        update: '%resource% sikeresen frissítve.'\n        delete: '%resource% sikeresen törölve.'\n        move: '%resource% sikeresen áthelyezve.'\n        generate: '%resource% sikeresen legenerálva.'\n        revert: '%resource% sikeresen visszavonva.'\n        restore_deleted: '%resource% sikeresen visszaállítva.'\n        enable: '%resource% sikeresen engedélyezve.'\n        disable: '%resource% sikeresen le lett tiltva.'\n        delete_error: 'A %resource% nem törölhető, mert használatban van.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.id.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% telah berhasil dibuat.'\n        update: '%resource% telah berhasil diupdate.'\n        delete: '%resource% telah berhasil dihapus.'\n        move: '%resource% telah berhasil dipindahkan.'\n        generate: '%resource% s telah berhasil dihasilkan.'\n        revert: '%resource% telah berhasil dikembalikan.'\n        restore_deleted: '%resource% telah berhasil dipulihkan.'\n        enable: '%resource% telah berhasil diaktifkan.'\n        disable: '%resource% telah berhasil dinonaktifkan.'\n        delete_error: 'Tidak dapat menghapus,%resource% sedang digunakan.'\n        race_condition_error: 'Tidak dapat diperbarui,%resource% sebelumnya telah dimodifikasi.'\n        something_went_wrong_error: 'Ada yang tidak beres, coba lagi.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.it.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% è stato creato correttamente.'\n        update: '%resource% è stato aggiornato con successo.'\n        delete: '%resource% è stato eliminato correttamente.'\n        move: '%resource% è stato spostato correttamente.'\n        generate: '% resource%s sono stati generati correttamente.'\n        revert: '%resource% è stato resettato correttamente.'\n        restore_deleted: '%resource% è stato ripristinato con successo.'\n        enable: '%resource% è stato attivato con successo.'\n        disable: '%resource% è stato disattivato con successo.'\n        delete_error: 'Non è possibile eliminare, il %resource% è in uso.'\n        race_condition_error: 'Non è possibile aggiornare, il %resource% è stato modificato in precedenza.'\n        something_went_wrong_error: 'Qualcosa è andato storto. Ti preghiamo di riprovare.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.ja.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource%の登録が完了しました。'\n        update: '%resource%の更新が完了しました。'\n        delete: '%resource%の削除が完了しました。'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.lt.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% sėkmingai sukurtas.'\n        update: '%resource% sėkmingai atnaujintas.'\n        delete: '%resource% sėkmingai pašalintas.'\n        move: '%resource% perkeltas sėkmingai.'\n        generate: '% resource%s sėkmingai sugeneruotas.'\n        revert: '%resource% sėkmingai atstatytas.'\n        restore_deleted: '%resource% sėkmingai atstatytas.'\n        enable: '%resource% sėkmingai įgalintas.'\n        disable: '%resource% sėkmingai išjungtas.'\n        delete_error: 'Negalite panaikinti, nes %resource% yra naudojamas.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.nl.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% is succesvol aangemaakt.'\n        update: '%resource% is succesvol bijgewerkt.'\n        delete: '%resource% is succesvol verwijderd.'\n        bulk_delete: '%resources% zijn succesvol verwijderd.'\n        move: '%resource% is verplaatst.'\n        generate: '% resource%s zijn aangemaakt.'\n        revert: '%resource% is met succes hersteld.'\n        restore_deleted: '%resource% is succesvol hersteld.'\n        enable: '%resource% is ingeschakeld.'\n        disable: '%resource% is uitgeschakeld.'\n        delete_error: 'Verwijderen niet mogelijk, %resource% is nog steeds in gebruik.'\n        race_condition_error: 'Kan niet geüpdate worden, de %resource% is eerder bewerkt.'\n        something_went_wrong_error: 'Er is een fout opgetreden, probeer het nogmaals.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.no.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% er opprettet.'\n        update: '%resource% er oppdatert.'\n        delete: '%resource% er slettet.'\n        move: '%resource% har blitt flyttet.'\n        generate: '%resource%s har blitt generert.'\n        revert: '%resource% har blitt tilbakestilt.'\n        restore_deleted: '%resource% har blitt gjenopprettet.'\n        enable: '%resource% er aktivert.'\n        disable: '%resource% er deaktivert.'\n        delete_error: 'Kan ikke slette, %resource% er i bruk.'\n        race_condition_error: 'Kan ikke oppdatere, %resource% ble endret.'\n        something_went_wrong_error: 'Det har oppstått en feil. Vennligst prøv igjen.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.pl.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% został pomyślnie utworzony.'\n        update: '%resource% został pomyślnie uaktualniony.'\n        delete: '%resource% został pomyślnie usunięty.'\n        move: '%resource% został pomyślnie przeniesiony.'\n        generate: '%resource%s zostały pomyślnie wygenerowane.'\n        revert: '%resource% został pomyślnie przywrócony.'\n        restore_deleted: '%resource% został pomyślnie odzyskany.'\n        enable: '%resource% został pomyślnie włączony.'\n        disable: '%resource% został pomyślnie wyłączony.'\n        delete_error: 'Nie można usunąć, %resource% jest w użyciu.'\n        race_condition_error: 'Nie można uaktualnić, %resource% został już wcześniej zmodyfikowany.'\n        something_went_wrong_error: 'Coś poszło nie tak, spróbuj ponownie.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.pt.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% foi criado com sucesso.'\n        update: '%resource% foi atualizado com sucesso.'\n        delete: '%resource% foi eliminado com sucesso.'\n        move: '%resource% foi movido com sucesso.'\n        generate: '%resource%s foi/foram criado(s) com sucesso.'\n        revert: '%resource% foi revertido com sucesso.'\n        restore_deleted: '%resource% foi restaurado com sucesso.'\n        enable: '%resource% foi ativado com sucesso.'\n        disable: '%resource% foi desativado com sucesso.'\n        delete_error: 'Não é possível eliminar, o %resource% está em uso.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.pt_BR.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% foi criado com sucesso.'\n        update: '%resource% foi atualizado com sucesso.'\n        delete: '%resource% foi excluído com sucesso.'\n        move: '%resource% foi movida com sucesso.'\n        generate: '%recurso%s %fo%ram %gerado%s com sucesso.'\n        revert: '%resource% foi revertido com sucesso.'\n        restore_deleted: '%resource% foi restaurado com sucesso.'\n        enable: '%resource% foi ativado com sucesso.'\n        disable: '%resource% foi desativado com sucesso.'\n        delete_error: 'Não é possível excluir, o %resource% está em uso.'\n        race_condition_error: 'Não é possível atualizar, o %resource% foi previamente modificado.'\n        something_went_wrong_error: 'Algo deu errado, tente de novo.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.ro.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% a fost creată cu succes.'\n        update: '%resource% a fost actualizată cu succes.'\n        delete: '%resource% a fost ștearsă cu succes.'\n        move: '%resource% a fost mutat cu succes.'\n        generate: '%resource% a fost generat cu succes.'\n        revert: '%resource% a revenit la starea inițială cu succes.'\n        restore_deleted: '%resource% a revenit la starea inițială cu succes.'\n        enable: '%resource% a fost activat cu succes.'\n        disable: '%resource% a fost dezactivat cu succes.'\n        delete_error: 'Nu poate fi șters, %resource% este utilizat.'\n        race_condition_error: 'Nu poate fi actualizat, %resource% a fost modificat anterior.'\n        something_went_wrong_error: 'A apărut o problemă. Te rugăm să mai încerci o dată.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.ru.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% успешно создан.'\n        update: '%resource% успешно изменен.'\n        delete: '%resource% удален успешно.'\n        move: '%resource% успешно перемещен.'\n        generate: '% resource%ы созданы успешно.'\n        revert: '%resource% успешно откачен.'\n        restore_deleted: '%resource% успешно восстановлен.'\n        enable: '%resource% успешно включен.'\n        disable: '%resource% успешно отключен.'\n        delete_error: 'Не удается удалить %resource%, т. к. он используется.'\n        race_condition_error: 'Не удается обновить, %resource% был изменен ранее.'\n        something_went_wrong_error: 'Что-то пошло не так. Попробуйте еще раз.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.sk.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% bol úspešne vytvorený.'\n        update: '%resource% bol úspešne aktualizovaný.'\n        delete: '%resource% bol úspešne odstránený.'\n        bulk_delete: '%resources% bol úspešne odstránený.'\n        move: '%resource% bol úspešne premiestnený.'\n        generate: '% resource% boli úspešne vytvorené.'\n        revert: '%resource% bol úspešne navrátený.'\n        restore_deleted: '%resource% bol úspešne obnovený.'\n        enable: '%resource% bol úspešne aktivovaný.'\n        disable: '%resource% bol úspešne deaktivovaný.'\n        delete_error: 'Nie je možné odstrániť, %resource% sa používa.'\n        race_condition_error: 'Nemôžete aktualizovať, %resource% bol zmenený.'\n        something_went_wrong_error: 'Niečo sa pokazilo, skúste to prosím znova.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.sl.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% je bil uspešno ustvarjen.'\n        update: '%resource% je bil uspešno posodobljen.'\n        delete: '%resource% je bil uspešno izbrisan.'\n        move: '%resource% je bil uspešno premaknjen.'\n        generate: '%resource% so bili uspešno generirani.'\n        revert: '%resource% je bila uspešno povrnjen.'\n        restore_deleted: '%resource% je bil uspešno obnovljen.'\n        enable: '%resource% je bil uspešno omogočen.'\n        disable: '%resource% je bil uspešno onemogočen.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.sq.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% u krijua me sukses.'\n        update: '%resource% u përditësua me sukses.'\n        delete: '%resource% u fshi me sukses.'\n        move: '%resource% u zhvendos me sukses.'\n        generate: '%resource%s u gjenerua me sukses.'\n        revert: '%resource% u anulua me sukses.'\n        restore_deleted: '%resource% u rivendos me sukses.'\n        enable: '%resource% u aktivizua me sukses.'\n        disable: '%resource% u çaktivizua me sukses.'\n        delete_error: 'Nuk mund te fshihet, %resource% eshte ne perdorim.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.sr.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% је успешно креиран.'\n        update: '%resource% је успешно ажуриран.'\n        delete: '%resource% је успешно обрисан.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.sr_CS.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% je uspešno kreiran.'\n        update: '%resource% je uspešno ažuriran.'\n        delete: '%resource% je uspešno obrisan.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.th.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% ถูกสร้างเรียบร้อยแล้ว'\n        update: '%resource% ถูกปรับปรุงเรียบร้อยแล้ว'\n        delete: '%resource% ถูกลบทิ้งแล้ว'\n        move: '%resource% ถูกลบทิ้งแล้ว'\n        generate: '%resource% ถูกสร้างเรียบร้อยแล้ว'\n        revert: '%resource% ถูกเรียกกลับมาเรียบร้อยแล้ว'\n        restore_deleted: '%resource% ถูกกู้คืนเรียบร้อยแล้ว'\n        enable: '%resource% มีการเปิดใช้เรียบร้อยแล้ว'\n        disable: '%resource% ได้ถูกปิดใช้งานเรียบร้อยแล้ว'\n        delete_error: 'ไม่สามารถลบ %resource% ขณะใช้งาน'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.tr.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% başarılı olarak oluşturuldu.'\n        update: '%resource% başarılı olarak güncellendi.'\n        delete: '%resource% başarılı olarak silindi.'\n        move: '%resource% başarıyla taşındı.'\n        generate: '% resource%s başarıyla oluşturdu.'\n        revert: '%resource% başarıyla döndürüldü.'\n        restore_deleted: '%resource% başarılı olarak silindi.'\n        enable: '%resource% başarıyla etkinleştirildi.'\n        disable: '%resource% başarıyla devre dışı bırakıldı.'\n        delete_error: 'Silinemez,%resource%kullanılıyor.'\n        race_condition_error: 'Güncellenemez,%resource% önceden değiştirilmiş.'\n        something_went_wrong_error: 'Birşeyler ters gitti, lütfen tekrar deneyin.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.uk.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% був успішно створений.'\n        update: '%resource% був успішно оновлений.'\n        delete: '%resource% був успішно видалений.'\n        move: '%resource% був успішно переміщений.'\n        generate: '%resource%и були успішно згенеровані.'\n        revert: '%resource% був успішно повернутий.'\n        restore_deleted: '%resource% був успішно відновлений.'\n        enable: '%resource% був успішно ввімкнений.'\n        disable: '%resource% був успішно вимкнений.'\n        delete_error: 'Неможливо видалити, %resource% знаходиться у використанні.'\n        race_condition_error: 'Не вдається оновити, %resource% був змінений раніше.'\n        something_went_wrong_error: 'Щось пішло не так. Будь ласка, спробуйте ще раз.'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/flashes.zh_CN.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        create: '%resource% 创建成功。'\n        update: '%resource% 更新成功。'\n        delete: '%resource% 删除成功。'\n        move: '%resource% 移动成功。'\n        generate: '%resource%s 已生成成功。'\n        revert: '%resource% 已经被成功地还原。'\n        restore_deleted: '%resource% 已经被成功地还原。'\n        enable: '%resource% 已成功启用。'\n        disable: '%resource% 已被成功地禁用。'\n        delete_error: '不能删除，%resource% 正在使用中。'\n        race_condition_error: '%resource% 已经被修改，不能更新。'\n        something_went_wrong_error: '出现错误。请重试。'\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.ar.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: اضافة\n            delete: حذف\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.be.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Дадаць\n            delete: Выдаліць\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.bg.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Добави\n            delete: Изтрий\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.ca.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            delete: Suprimir\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.cs.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Přidat\n            delete: Odstranit\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.da.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Tilføj\n            delete: Slet\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.de.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Hinzufügen\n            delete: Löschen\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.de_CH.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Hinzufügen\n            delete: Löschen\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.el.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Προσθήκη\n            delete: Διαγραφή\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.en.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Add\n            delete: Delete\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.es.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Añadir\n            delete: Eliminar\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.fa.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: ﺍﻓﺰﻭﺩﻥ\n            delete: حذف\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.fi.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Lisää\n            delete: Poista\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.fr.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Ajouter\n            delete: Supprimer\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.he.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: הוסף\n            delete: מחק\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.hr.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Dodaj\n            delete: sylius.account.address.action.delete\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.hu.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Hozzáadás\n            delete: Törlés\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.id.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Tambah\n            delete: Menghapus\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.it.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Aggiungi\n            delete: Cancella\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.ja.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            delete: sylius.account.address.action.delete\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.lt.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Pridėti\n            delete: Šalinti\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.nl.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Toevoegen\n            delete: Verwijderen\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.no.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Legg til\n            delete: Slett\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.pl.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Dodaj\n            delete: Usuń\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.pt.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Adicionar\n            delete: Eliminar\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.pt_BR.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Adicionar\n            delete: Excluir\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.ro.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Adăugați\n            delete: Șterge\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.ru.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Добавить\n            delete: Удалить\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.sk.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Pridať\n            delete: Odstrániť\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.sl.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Dodaj\n            delete: Zbriši\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.sq.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Shto\n            delete: Fshi\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.sr.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            delete: Обриши\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.sr_CS.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Dodaj\n            delete: Obrisati\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.sv.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Lägg tilll\n            delete: Radera\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.th.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: เพิ่ม\n            delete: ลบ\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.tr.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Ekle\n            delete: Sil\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.uk.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: Додати\n            delete: Видалити\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.zh_CN.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: 新增\n            delete: 删除\n"
  },
  {
    "path": "src/Bundle/Resources/translations/messages.zh_TW.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    form:\n        collection:\n            add: 新增\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.ar.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"الموارد المقدمة معطلة\"\n        not_disabled: \"الموارد المقدمة مفعلة\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.bg.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Този ресурс е изключен\"\n        not_disabled: \"Този ресурс е включен\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.cs.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Uvedený prostředek je zakázán\"\n        not_disabled: \"Uvedený prostředek je povolen\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.da.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Den valgte ressource er deaktiveret\"\n        not_disabled: \"Den valgte ressource er aktiveret\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.de.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Gewählte Ressource ist deaktiviert\"\n        not_disabled: \"Gewählte Ressource ist aktiviert\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.de_CH.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Gewählte Ressource ist deaktiviert\"\n        not_disabled: \"Gewählte Ressource ist aktiviert\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.el.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Το συγκεκριμένο αντικείμενο είναι απενεργοποιημένο\"\n        not_disabled: \"Το συγκεκριμένο αντικείμενο είναι ενεργοποιημένο\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.en.yml",
    "content": "sylius:\n    resource:\n        not_enabled: \"Given resource is disabled\"\n        not_disabled: \"Given resource is enabled\"\n        translation:\n            locale:\n                not_blank: Please enter the locale.\n                invalid: This value is not a valid locale.\n                unique: A translation for the {{ value }} locale code already exists.\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.es.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"El recurso indicado está desactivado\"\n        not_disabled: \"El recurso está activado\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.fa.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"منبع تعریف شده، غیر فعال گردیده\"\n        not_disabled: \"منبع تعریف شده فعال گردید\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.fr.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"La ressource spécifiée est désactivée\"\n        not_disabled: \"La ressource spécifiée est activée\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.he.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"המשאב אינו זמין\"\n        not_disabled: \"המשאב זמין כעת\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.hr.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Resurs nije omogućen\"\n        not_disabled: \"Resurs je omogućen\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.hu.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Az adott erőforrás le van tiltva\"\n        not_disabled: \"Az adott erőforrás engedélyezve van\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.id.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Sumber daya yang diberikan dinonaktifkan\"\n        not_disabled: \"Sumber daya yang diberikan diaktifkan\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.it.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"La data risorsa è disattivata\"\n        not_disabled: \"La data risorsa è abilitata\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.lt.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Resursas yra išjungtas\"\n        not_disabled: \"Resursas yra įjungtas\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.nl.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Deze resource is uitgeschakeld\"\n        not_disabled: \"Deze resource is ingeschakeld\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.pl.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Podany zasób jest wyłączony\"\n        not_disabled: \"Podany zasób jest włączony\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.pt.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"O recurso está desactivado\"\n        not_disabled: \"O recurso está desativado\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.pt_BR.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"O recurso fornecido está desativado\"\n        not_disabled: \"O recurso fornecido está ativado\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.ro.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Resursa este dezactivată\"\n        not_disabled: \"Resursa este activată\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.ru.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Данный ресурс отключен\"\n        not_disabled: \"Данный ресурс включен\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.sk.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Zdroj je vypnutý\"\n        not_disabled: \"Zdroj je zapnutý\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.sl.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Dani vir je onemogočen\"\n        not_disabled: \"Dani vir je omogočen\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.sq.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Burimi i zgjedhur është i çaktivizuar\"\n        not_disabled: \"Burimi i zgjedhur është aktivizuar\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.sr_CS.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Traženi resurs je isključen\"\n        not_disabled: \"Resurs je omogućen\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.th.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"ข้อมูลถูกปิดการใช้งาน\"\n        not_disabled: \"ข้อมูลถูกเปิดการใช้งาน\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.tr.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Verilen kaynak devre dışı\"\n        not_disabled: \"Verilen kaynak etkin\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.uk.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"Даний ресурс вимкнений\"\n        not_disabled: \"Даний ресурс увімкнений\"\n"
  },
  {
    "path": "src/Bundle/Resources/translations/validators.zh_CN.yml",
    "content": "# This file is part of the Sylius package.\n# (c) Sylius Sp. z o.o.\n\nsylius:\n    resource:\n        not_enabled: \"该资源已被禁用\"\n        not_disabled: \"该资源已启用\"\n"
  },
  {
    "path": "src/Bundle/Resources/views/Macros/actions.html.twig",
    "content": "{% macro create(url) %}\n<div class=\"form-actions\">\n    <button type=\"submit\" class=\"btn btn-primary btn-lg\"><i class=\"glyphicon glyphicon-ok\"></i> {{ 'sylius.ui.create'|trans }}</button>\n    <a href=\"{{ app.request.headers.get('referer', url) }}\" class=\"btn btn-danger btn-lg\"><i class=\"glyphicon glyphicon-remove\"></i> {{ 'sylius.ui.cancel'|trans }}</a>\n</div>\n{% endmacro %}\n\n{% macro update(url) %}\n<div class=\"form-actions\">\n    <button type=\"submit\" class=\"btn btn-primary btn-lg\"><i class=\"glyphicon glyphicon-save\"></i> {{ 'sylius.ui.save_changes'|trans }}</button>\n    <a href=\"{{ app.request.headers.get('referer', url) }}\" class=\"btn btn-danger btn-lg\"><i class=\"glyphicon glyphicon-remove\"></i> {{ 'sylius.ui.cancel'|trans }}</a>\n</div>\n{% endmacro %}\n"
  },
  {
    "path": "src/Bundle/Resources/views/Macros/buttons.html.twig",
    "content": "{% macro show(url, message) %}\n<a href=\"{{ url }}\" class=\"btn btn-default\">\n   <i class=\"glyphicon glyphicon-book\"></i><span>{{ message is empty ? 'sylius.ui.details'|trans : message }}</span>\n</a>\n{% endmacro %}\n\n{% macro generic(url, message, icon) %}\n<a href=\"{{ url }}\" class=\"btn btn-default\">\n    {% if icon is not empty %}<i class=\"glyphicon glyphicon-{{ icon }}\"></i>{% endif %}<span>{{ message }}</span>\n</a>\n{% endmacro %}\n\n{% macro create(url, message) %}\n<a href=\"{{ url }}\" class=\"btn btn-primary\">\n    <i class=\"glyphicon glyphicon-plus-sign\"></i><span>{{ message is empty ? 'sylius.ui.create'|trans : message }}</span>\n</a>\n{% endmacro %}\n\n{% macro edit(url, message) %}\n<a href=\"{{ url }}\" class=\"btn btn-primary\">\n    <i class=\"glyphicon glyphicon-pencil\"></i><span>{{ message is empty ? 'sylius.ui.edit'|trans : message }}</span>\n</a>\n{% endmacro %}\n\n{% macro delete(url, message, disabled=false, modal=true) %}\n{% if disabled %}\n<span class=\"btn btn-danger disabled\">\n    <i class=\"glyphicon glyphicon-trash\"></i><span>{{ message is empty ? 'sylius.ui.delete'|trans : message }}</span>\n</span>\n{% else %}\n<form action=\"{{ url }}\" method=\"post\" class=\"delete-action-form\" novalidate>\n    <input type=\"hidden\" name=\"_method\" value=\"DELETE\">\n    <button class=\"btn btn-danger{% if modal %} btn-confirm{% endif %}\" type=\"submit\">\n        <i class=\"glyphicon glyphicon-trash\"></i> <span>{{ message is empty ? 'sylius.ui.delete'|trans : message }}</span>\n    </button>\n</form>\n{% endif %}\n{% endmacro %}\n\n{% macro manage(url, message) %}\n<a href=\"{{ url }}\" class=\"btn btn-success\">\n    <i class=\"glyphicon glyphicon-folder-open\"></i><span>{{ message is empty ? 'sylius.ui.manage'|trans : message }}</span>\n</a>\n{% endmacro %}\n\n{% macro move(url, direction, first=false, last=false, message='') %}\n<form action=\"{{ url }}\" method=\"post\" class=\"delete-action-form\" novalidate>\n    <input type=\"hidden\" name=\"_method\" value=\"PUT\">\n    <button title=\"{{ message is empty ? ('sylius.ui.move_'~direction)|trans : message }}\" class=\"btn btn-default {% if ('up' == direction and first) or ('down' == direction and last) %}disabled{% endif %}\" type=\"submit\">\n        <i class=\"glyphicon glyphicon-arrow-{{ direction }}\"></i>\n    </button>\n</form>\n{% endmacro %}\n\n{% macro patch(url, message, icon, button) %}\n<form action=\"{{ url }}\" method=\"post\" class=\"delete-action-form\" novalidate>\n    <input type=\"hidden\" name=\"_method\" value=\"PATCH\">\n    <button class=\"btn btn-{{ button|default('success') }}\" type=\"submit\">\n        <i class=\"glyphicon glyphicon-{{ icon|default('transfer') }}\"></i> <span>{{ message }}</span>\n    </button>\n</form>\n{% endmacro %}\n\n{% macro enable(url, message, icon, button) %}\n<form action=\"{{ url }}\" method=\"post\" class=\"delete-action-form\" novalidate>\n    <input type=\"hidden\" name=\"_method\" value=\"PATCH\">\n    <button class=\"btn btn-{{ button|default('success') }}\" type=\"submit\">\n        <i class=\"glyphicon glyphicon-{{ icon|default('ok') }}\"></i> <span>{{ message is empty ? 'sylius.ui.enable'|trans : message }}</span>\n    </button>\n</form>\n{% endmacro %}\n\n{% macro disable(url, message, icon, button) %}\n<form action=\"{{ url }}\" method=\"post\" class=\"delete-action-form\" novalidate>\n    <input type=\"hidden\" name=\"_method\" value=\"PATCH\">\n    <button class=\"btn btn-{{ button|default('danger') }}\" type=\"submit\">\n        <i class=\"glyphicon glyphicon-{{ icon|default('remove') }}\"></i> <span>{{ message is empty ? 'sylius.ui.disable'|trans : message }}</span>\n    </button>\n</form>\n{% endmacro %}\n"
  },
  {
    "path": "src/Bundle/Resources/views/Macros/notification.html.twig",
    "content": "{# Display all the flashes messages #}\n{% macro flashes() %}\n    {% for type, flashes in app.session.flashBag.all %}\n        <div id=\"flashesMessage\" class=\"alert alert-{{ type }}\">\n            <ul class=\"list-unstyled\">\n                {% for flash in flashes %}\n                    <li>{{ flash }}</li>\n                {% endfor %}\n            </ul>\n        </div>\n    {% endfor %}\n{% endmacro %}\n\n\n{#\n    Display a bootstrap alert :\n    - text : Message to print (string or array)\n    - type : danger | warning | success | info (Default : info)\n#}\n{% macro alert(text, type) %}\n    {% set type = 'alert-' ~ type|default('info') %}\n\n    {% if text|default %}\n    <div class=\"alert {{ type }}\">\n        {% if text is iterable %}\n            <ul class=\"form-type-errors list-unstyled\">\n                {% for line in text %}\n                    <li>\n                        <p class=\"text-{{ type }}\">\n                            {{ line.message|trans(line.messageParameters) }}\n                        </p>\n                    </li>\n                {% endfor %}\n            </ul>\n        {% else %}\n            {{ text|trans }}\n        {% endif %}\n    </div>\n    {% endif %}\n{% endmacro %}\n\n{% macro danger(text) %}\n    {% from _self import alert %}\n    {{ alert(text, 'danger') }}\n{% endmacro %}\n\n{% macro error(text) %}\n    {% from _self import danger %}\n    {{ danger(text) }}\n{% endmacro %}\n\n{% macro warning(text) %}\n    {% from _self import alert %}\n    {{ alert(text, 'warning') }}\n{% endmacro %}\n\n{% macro success(text) %}\n    {% from _self import alert %}\n    {{ alert(text, 'success') }}\n{% endmacro %}\n\n{% macro info(text) %}\n    {% from _self import alert %}\n    {{ alert(text, 'info') }}\n{% endmacro %}\n"
  },
  {
    "path": "src/Bundle/Resources/views/Twig/paginate.html.twig",
    "content": "<a href=\"#\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\">\n    {{ paginator.maxPerPage }}&nbsp;\n    <i class=\"icon-angle-down\"></i>\n</a>\n\n<ul class=\"dropdown-menu pull-left\" role=\"menu\">\n    {% for limit, url in limits %}\n    <li>\n        <a href=\"{{ url }}\">{{ limit }}</a>\n    </li>\n    {% endfor %}\n</ul>\n/ {{ paginator.nbResults }}\n"
  },
  {
    "path": "src/Bundle/Resources/views/Twig/sorting.html.twig",
    "content": "<a href=\"{{ url }}\">\n    {{ label }}\n    {% if icon -%}\n        {%- if currentOrder == 'desc' -%}\n            <i class=\"glyphicon glyphicon-chevron-down\"></i>\n        {%- else -%}\n            <i class=\"glyphicon glyphicon-chevron-up\"></i>\n        {%- endif %}\n    {%- endif %}\n</a>\n"
  },
  {
    "path": "src/Bundle/Resources/views/forms.html.twig",
    "content": "{% block collection_widget -%}\n    {% from '@SyliusResource/Macros/notification.html.twig' import error %}\n    {% set attr = attr|merge({'class': attr.class|default ~ ' controls collection-widget'}) %}\n\n    {% apply spaceless %}\n        <div data-form-type=\"collection\"\n             {{ block('widget_container_attributes') }}\n             {% if prototype is defined and allow_add %}\n             data-prototype='{{ _self.collectionItem(prototype, allow_delete, button_delete_label, '__name__')|e }}'\n             {%- endif -%}>\n\n            {{ error(form.vars.errors) }}\n\n            {% if prototypes|default is iterable %}\n                {% for key, subPrototype in prototypes %}\n                    <input type=\"hidden\"\n                           data-form-prototype=\"{{ key }}\"\n                           value=\"{{ _self.collectionItem(subPrototype, allow_delete, button_delete_label, '__name__')|e }}\" />\n                {% endfor %}\n            {% endif %}\n\n            <div data-form-collection=\"list\"\n                 class=\"row collection-list\">\n                {% for child in form %}\n                    {{ _self.collectionItem(child, allow_delete, button_delete_label, loop.index0) }}\n                {% endfor %}\n            </div>\n\n            {% if prototype is defined and allow_add %}\n                <a href=\"#\" class=\"btn btn-success btn-block\"\n                   data-form-collection=\"add\">\n                    <i class=\"glyphicon glyphicon-plus\"></i>\n                    {{ button_add_label|trans }}\n                </a>\n            {% endif %}\n        </div>\n    {% endapply %}\n{%- endblock collection_widget %}\n\n{% macro collectionItem(form, allow_delete, button_delete_label, index) %}\n    {% apply spaceless %}\n        <div data-form-collection=\"item\"\n             data-form-collection-index=\"{{ index }}\"\n             class=\"collection-item\">\n            <div class=\"collection-box{% if form|length == 1 %} unique-field{% endif %}\">\n                {% if allow_delete %}\n                    <p class=\"text-right\">\n                        <a href=\"#\" data-form-collection=\"delete\" class=\"btn btn-danger\">\n                            <i class=\"glyphicon glyphicon-remove collection-button-remove\"></i>\n                            {{ button_delete_label|trans }}\n                        </a>\n                    </p>\n                {% endif %}\n                {% if not form.children|length %}\n                    {{ form_widget(form) }}\n                {% else %}\n                    {{ form_rest(form) }}\n                {% endif %}\n            </div>\n        </div>\n    {% endapply %}\n{% endmacro %}\n"
  },
  {
    "path": "src/Bundle/Routing/Configuration.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Routing;\n\nuse Symfony\\Component\\Config\\Definition\\Builder\\ArrayNodeDefinition;\nuse Symfony\\Component\\Config\\Definition\\Builder\\TreeBuilder;\nuse Symfony\\Component\\Config\\Definition\\ConfigurationInterface;\n\nfinal class Configuration implements ConfigurationInterface\n{\n    /**\n     * @return TreeBuilder<'array'>\n     */\n    public function getConfigTreeBuilder(): TreeBuilder\n    {\n        $treeBuilder = new TreeBuilder('routing');\n        /** @var ArrayNodeDefinition<TreeBuilder<'array'>> $rootNode */\n        $rootNode = $treeBuilder->getRootNode();\n\n        $rootNode\n            ->children()\n                ->scalarNode('alias')->isRequired()->cannotBeEmpty()->end()\n                ->scalarNode('path')->defaultValue(null)->end()\n                ->scalarNode('identifier')->defaultValue('id')->end()\n                ->arrayNode('criteria')\n                    ->useAttributeAsKey('identifier')\n                    ->scalarPrototype()\n                    ->end()\n                ->end()\n                ->booleanNode('filterable')->end()\n                ->variableNode('form')->cannotBeEmpty()->end()\n                ->scalarNode('serialization_version')->cannotBeEmpty()->end()\n                ->scalarNode('section')->cannotBeEmpty()->end()\n                ->scalarNode('redirect')->cannotBeEmpty()->end()\n                ->scalarNode('templates')->cannotBeEmpty()->end()\n                ->scalarNode('grid')->cannotBeEmpty()->end()\n                ->booleanNode('permission')->defaultValue(false)->end()\n                ->scalarNode('condition')->cannotBeEmpty()->end()\n                ->arrayNode('except')\n                    ->scalarPrototype()->end()\n                ->end()\n                ->arrayNode('only')\n                    ->scalarPrototype()->end()\n                ->end()\n                ->variableNode('vars')->cannotBeEmpty()->end()\n            ->end()\n        ;\n\n        return $treeBuilder;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Routing/CrudRoutesAttributesLoader.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Routing;\n\nuse Sylius\\Component\\Resource\\Annotation\\SyliusCrudRoutes as LegacySyliusCrudRoutes;\nuse Sylius\\Resource\\Annotation\\SyliusCrudRoutes;\nuse Sylius\\Resource\\Reflection\\ClassReflection;\nuse Sylius\\Resource\\Reflection\\ReflectionClassRecursiveIterator;\nuse Symfony\\Bundle\\FrameworkBundle\\Routing\\RouteLoaderInterface;\nuse Symfony\\Component\\Routing\\RouteCollection;\nuse Symfony\\Component\\Yaml\\Yaml;\n\nfinal class CrudRoutesAttributesLoader implements RouteLoaderInterface\n{\n    private array $mapping;\n\n    private ResourceLoader $resourceLoader;\n\n    public function __construct(\n        array $mapping,\n        ResourceLoader $resourceLoader,\n    ) {\n        $this->mapping = $mapping;\n        $this->resourceLoader = $resourceLoader;\n    }\n\n    public function __invoke(): RouteCollection\n    {\n        $routeCollection = new RouteCollection();\n        $paths = $this->mapping['paths'] ?? [];\n\n        foreach (ReflectionClassRecursiveIterator::getReflectionClassesFromDirectories($paths) as $reflectionClass) {\n            $className = $reflectionClass->getName();\n            $this->addRoutesForSyliusCrudRoutesAttributes($routeCollection, $className);\n        }\n\n        return $routeCollection;\n    }\n\n    /**\n     * @param class-string $className\n     */\n    private function addRoutesForSyliusCrudRoutesAttributes(RouteCollection $routeCollection, string $className): void\n    {\n        $attributes = ClassReflection::getClassAttributes($className, SyliusCrudRoutes::class);\n        $attributes = array_merge($attributes, ClassReflection::getClassAttributes($className, LegacySyliusCrudRoutes::class));\n\n        foreach ($attributes as $reflectionAttribute) {\n            $resource = Yaml::dump($reflectionAttribute->getArguments());\n            $resourceRouteCollection = $this->resourceLoader->load($resource);\n            $routeCollection->addCollection($resourceRouteCollection);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Routing/ResourceLoader.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Routing;\n\nuse Behat\\Transliterator\\Transliterator;\nuse Gedmo\\Sluggable\\Util\\Urlizer;\nuse Sylius\\Resource\\Exception\\RuntimeException;\nuse Sylius\\Resource\\Metadata\\Inflector\\Inflector;\nuse Sylius\\Resource\\Metadata\\Inflector\\InflectorInterface;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Symfony\\Component\\Config\\Definition\\Processor;\nuse Symfony\\Component\\Config\\Loader\\Loader;\nuse Symfony\\Component\\Routing\\Route;\nuse Symfony\\Component\\Routing\\RouteCollection;\nuse Symfony\\Component\\Yaml\\Yaml;\n\n/**\n * @deprecated use Sylius\\Resource\\Symfony\\Routing\\Loader\\ResourceLoader instead\n */\nfinal class ResourceLoader extends Loader\n{\n    private InflectorInterface $inflector;\n\n    public function __construct(\n        private RegistryInterface $resourceRegistry,\n        private RouteFactoryInterface $routeFactory,\n        ?string $env = null,\n        private ?bool $routingPathBcLayer = null,\n        ?InflectorInterface $inflector = null,\n    ) {\n        parent::__construct($env);\n\n        $this->inflector = $inflector ?? new Inflector();\n    }\n\n    public function load($resource, $type = null): RouteCollection\n    {\n        $processor = new Processor();\n        $configurationDefinition = new Configuration();\n\n        $configuration = Yaml::parse($resource);\n        $configuration = $processor->processConfiguration($configurationDefinition, ['routing' => $configuration]);\n\n        if (!empty($configuration['only']) && !empty($configuration['except'])) {\n            throw new \\InvalidArgumentException('You can configure only one of \"except\" & \"only\" options.');\n        }\n\n        $routesToGenerate = ['show', 'index', 'create', 'update', 'delete', 'bulkDelete'];\n\n        if (!empty($configuration['only'])) {\n            $routesToGenerate = $configuration['only'];\n        }\n        if (!empty($configuration['except'])) {\n            $routesToGenerate = array_diff($routesToGenerate, $configuration['except']);\n        }\n\n        $isApi = $type === 'sylius.resource_api';\n\n        /** @var MetadataInterface $metadata */\n        $metadata = $this->resourceRegistry->get($configuration['alias']);\n        $routes = $this->routeFactory->createRouteCollection();\n\n        $rootPath = $configuration['path'] ?? $this->getRootPath($metadata->getPluralName());\n        $identifier = sprintf('{%s}', $configuration['identifier']);\n\n        /** @var bool $bcLayerEnabled */\n        $bcLayerEnabled = $this->routingPathBcLayer ?? true;\n        $trailingSlash = $bcLayerEnabled ? '/' : '';\n\n        if (in_array('index', $routesToGenerate, true)) {\n            $indexRoute = $this->createRoute($metadata, $configuration, $rootPath . $trailingSlash, 'index', ['GET'], $isApi);\n            $routes->add($this->getRouteName($metadata, $configuration, 'index'), $indexRoute);\n        }\n\n        if (in_array('create', $routesToGenerate, true)) {\n            $createRoute = $this->createRoute($metadata, $configuration, $isApi ? $rootPath . $trailingSlash : $rootPath . '/new', 'create', $isApi ? ['POST'] : ['GET', 'POST'], $isApi);\n            $routes->add($this->getRouteName($metadata, $configuration, 'create'), $createRoute);\n        }\n\n        if (in_array('update', $routesToGenerate, true)) {\n            $httpMethods = ['GET', 'PUT', 'PATCH'];\n            if (!$bcLayerEnabled) {\n                $httpMethods[] = 'POST';\n            }\n\n            $updateRoute = $this->createRoute($metadata, $configuration, $isApi ? $rootPath . '/' . $identifier : $rootPath . '/' . $identifier . '/edit', 'update', $isApi ? ['PUT', 'PATCH'] : $httpMethods, $isApi);\n            $routes->add($this->getRouteName($metadata, $configuration, 'update'), $updateRoute);\n        }\n\n        if (in_array('show', $routesToGenerate, true)) {\n            $showRoute = $this->createRoute($metadata, $configuration, $rootPath . '/' . $identifier, 'show', ['GET'], $isApi);\n            $routes->add($this->getRouteName($metadata, $configuration, 'show'), $showRoute);\n        }\n\n        if (!$isApi && in_array('bulkDelete', $routesToGenerate, true)) {\n            $httpMethods = ['DELETE'];\n            if (!$bcLayerEnabled) {\n                $httpMethods[] = 'POST';\n            }\n\n            $bulkDeleteRoute = $this->createRoute($metadata, $configuration, $rootPath . '/' . 'bulk-delete', 'bulkDelete', $httpMethods, $isApi);\n            $routes->add($this->getRouteName($metadata, $configuration, 'bulk_delete'), $bulkDeleteRoute);\n        }\n\n        if (in_array('delete', $routesToGenerate, true)) {\n            $httpMethods = ['DELETE'];\n            if (!$bcLayerEnabled) {\n                $httpMethods[] = 'POST';\n            }\n\n            $deleteRoute = $this->createRoute($metadata, $configuration, $isApi ? $rootPath . '/' . $identifier : $rootPath . '/' . $identifier . ($bcLayerEnabled ? '' : '/delete'), 'delete', $isApi ? ['DELETE'] : $httpMethods, $isApi);\n            $routes->add($this->getRouteName($metadata, $configuration, 'delete'), $deleteRoute);\n        }\n\n        return $routes;\n    }\n\n    public function supports($resource, $type = null): bool\n    {\n        return 'sylius.resource' === $type || 'sylius.resource_api' === $type;\n    }\n\n    private function getRootPath(string $pluralName): string\n    {\n        if ($this->routingPathBcLayer) {\n            if (!class_exists(Urlizer::class) || !class_exists(Transliterator::class)) {\n                throw new RuntimeException('Cannot use the routing bc-layer when the \"behat/transliterator\" package is not installed. Try to disable the routing path bc-layer in the Sylius Resource Bundle configuration using \"sylius_resource.routing_path_bc_layer: false\"');\n            }\n\n            return sprintf('/%s', Urlizer::urlize($pluralName));\n        }\n\n        return $this->inflector->dashize($pluralName);\n    }\n\n    private function createRoute(\n        MetadataInterface $metadata,\n        array $configuration,\n        string $path,\n        string $actionName,\n        array $methods,\n        bool $isApi = false,\n    ): Route {\n        $defaults = [\n            '_controller' => $metadata->getServiceId('controller') . sprintf('::%sAction', $actionName),\n        ];\n\n        if ($isApi && 'index' === $actionName) {\n            $defaults['_sylius']['serialization_groups'] = ['Default'];\n        }\n        if ($isApi && in_array($actionName, ['show', 'create', 'update'], true)) {\n            $defaults['_sylius']['serialization_groups'] = ['Default', 'Detailed'];\n        }\n        if ($isApi && 'delete' === $actionName) {\n            $defaults['_sylius']['csrf_protection'] = false;\n        }\n        if (isset($configuration['grid']) && 'index' === $actionName) {\n            $defaults['_sylius']['grid'] = $configuration['grid'];\n        }\n        if (isset($configuration['form']) && in_array($actionName, ['create', 'update'], true)) {\n            $defaults['_sylius']['form'] = $configuration['form'];\n        }\n        if (isset($configuration['serialization_version'])) {\n            $defaults['_sylius']['serialization_version'] = $configuration['serialization_version'];\n        }\n        if (isset($configuration['section'])) {\n            $defaults['_sylius']['section'] = $configuration['section'];\n        }\n        if (!empty($configuration['criteria'])) {\n            $defaults['_sylius']['criteria'] = $configuration['criteria'];\n        }\n        if (array_key_exists('filterable', $configuration)) {\n            $defaults['_sylius']['filterable'] = $configuration['filterable'];\n        }\n        if (isset($configuration['templates']) && in_array($actionName, ['show', 'index', 'create', 'update'], true)) {\n            $defaults['_sylius']['template'] = sprintf(\n                false === strpos($configuration['templates'], ':') ? '%s/%s.html.twig' : '%s:%s.html.twig',\n                $configuration['templates'],\n                $actionName,\n            );\n        }\n        if (isset($configuration['redirect']) && in_array($actionName, ['create', 'update'], true)) {\n            $defaults['_sylius']['redirect'] = $this->getRouteName($metadata, $configuration, $configuration['redirect']);\n        }\n        if (isset($configuration['permission'])) {\n            $defaults['_sylius']['permission'] = $configuration['permission'];\n        }\n        if (isset($configuration['vars']['all'])) {\n            $defaults['_sylius']['vars'] = $configuration['vars']['all'];\n        }\n\n        if (isset($configuration['vars'][$actionName])) {\n            $vars = $configuration['vars']['all'] ?? [];\n            $defaults['_sylius']['vars'] = array_merge($vars, $configuration['vars'][$actionName]);\n        }\n\n        if ($actionName === 'bulkDelete') {\n            $defaults['_sylius']['paginate'] = false;\n            $defaults['_sylius']['repository'] = [\n                'method' => 'findById',\n                'arguments' => ['$ids'],\n            ];\n        }\n\n        $condition = $configuration['condition'] ?? '';\n\n        return $this->routeFactory->createRoute($path, $defaults, [], [], '', [], $methods, $condition);\n    }\n\n    private function getRouteName(MetadataInterface $metadata, array $configuration, string $actionName): string\n    {\n        $sectionPrefix = isset($configuration['section']) ? $configuration['section'] . '_' : '';\n\n        return sprintf('%s_%s%s_%s', $metadata->getApplicationName(), $sectionPrefix, $metadata->getName(), $actionName);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Routing/RouteAttributesFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Routing;\n\nuse Sylius\\Component\\Resource\\Annotation\\SyliusRoute as LegacySyliusRoute;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\nuse Sylius\\Resource\\Reflection\\ClassReflection;\nuse Symfony\\Component\\Routing\\Route;\nuse Symfony\\Component\\Routing\\RouteCollection;\nuse Webmozart\\Assert\\Assert;\n\nfinal class RouteAttributesFactory implements RouteAttributesFactoryInterface\n{\n    public function createRouteForClass(RouteCollection $routeCollection, string $className): void\n    {\n        $attributes = ClassReflection::getClassAttributes($className, SyliusRoute::class);\n        $attributes = array_merge($attributes, ClassReflection::getClassAttributes($className, LegacySyliusRoute::class));\n\n        foreach ($attributes as $reflectionAttribute) {\n            $arguments = $reflectionAttribute->getArguments();\n\n            Assert::keyExists($arguments, 'name', 'Your route should have a name attribute.');\n\n            $syliusOptions = [];\n\n            if (isset($arguments['template'])) {\n                $syliusOptions['template'] = $arguments['template'];\n            }\n\n            if (isset($arguments['vars'])) {\n                $syliusOptions['vars'] = $arguments['vars'];\n            }\n\n            if (isset($arguments['criteria'])) {\n                $syliusOptions['criteria'] = $arguments['criteria'];\n            }\n\n            if (isset($arguments['repository'])) {\n                $syliusOptions['repository'] = $arguments['repository'];\n            }\n\n            if (isset($arguments['serializationGroups'])) {\n                $syliusOptions['serialization_groups'] = $arguments['serializationGroups'];\n            }\n\n            if (isset($arguments['serializationVersion'])) {\n                $syliusOptions['serialization_version'] = $arguments['serializationVersion'];\n            }\n\n            if (isset($arguments['form'])) {\n                $syliusOptions['form'] = $arguments['form'];\n            }\n\n            if (isset($arguments['section'])) {\n                $syliusOptions['section'] = $arguments['section'];\n            }\n\n            if (isset($arguments['permission'])) {\n                $syliusOptions['permission'] = $arguments['permission'];\n            }\n\n            if (isset($arguments['grid'])) {\n                $syliusOptions['grid'] = $arguments['grid'];\n            }\n\n            if (isset($arguments['csrfProtection'])) {\n                $syliusOptions['csrf_protection'] = $arguments['csrfProtection'];\n            }\n\n            if (isset($arguments['redirect'])) {\n                $syliusOptions['redirect'] = $arguments['redirect'];\n            }\n\n            if (isset($arguments['stateMachine'])) {\n                $syliusOptions['state_machine'] = $arguments['stateMachine'];\n            }\n\n            if (isset($arguments['event'])) {\n                $syliusOptions['event'] = $arguments['event'];\n            }\n\n            if (isset($arguments['returnContent'])) {\n                $syliusOptions['return_content'] = $arguments['returnContent'];\n            }\n\n            $route = new Route(\n                $arguments['path'],\n                [\n                    '_controller' => $arguments['controller'] ?? null,\n                    '_sylius' => $syliusOptions,\n                ],\n                $arguments['requirements'] ?? [],\n                $arguments['options'] ?? [],\n                $arguments['host'] ?? '',\n                $arguments['schemes'] ?? [],\n                $arguments['methods'] ?? [],\n            );\n\n            $routeCollection->add($arguments['name'], $route, $arguments['priority'] ?? 0);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Routing/RouteAttributesFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Routing;\n\nuse Symfony\\Component\\Routing\\RouteCollection;\n\ninterface RouteAttributesFactoryInterface\n{\n    /** @psalm-param class-string $className */\n    public function createRouteForClass(RouteCollection $routeCollection, string $className): void;\n}\n"
  },
  {
    "path": "src/Bundle/Routing/RouteFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Routing;\n\nuse Symfony\\Component\\Routing\\Route;\nuse Symfony\\Component\\Routing\\RouteCollection;\n\nfinal class RouteFactory implements RouteFactoryInterface\n{\n    public function createRouteCollection(): RouteCollection\n    {\n        return new RouteCollection();\n    }\n\n    public function createRoute(\n        string $path,\n        array $defaults = [],\n        array $requirements = [],\n        array $options = [],\n        string $host = '',\n        array $schemes = [],\n        array $methods = [],\n        string $condition = '',\n    ): Route {\n        return new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition);\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Routing/RouteFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Routing;\n\nuse Symfony\\Component\\Routing\\Route;\nuse Symfony\\Component\\Routing\\RouteCollection;\n\ninterface RouteFactoryInterface\n{\n    /**\n     * @return RouteCollection\n     */\n    public function createRouteCollection();\n\n    /**\n     * @param string $path The path pattern to match\n     * @param array $defaults An array of default parameter values\n     * @param array $requirements An array of requirements for parameters (regexes)\n     * @param array $options An array of options\n     * @param string $host The host pattern to match\n     * @param array $schemes An array of restricted URI schemes\n     * @param array $methods An array of restricted HTTP methods\n     * @param string $condition A condition that should evaluate to true for the route to match\n     */\n    public function createRoute(\n        string $path,\n        array $defaults = [],\n        array $requirements = [],\n        array $options = [],\n        string $host = '',\n        array $schemes = [],\n        array $methods = [],\n        string $condition = '',\n    ): Route;\n}\n"
  },
  {
    "path": "src/Bundle/Routing/RoutesAttributesLoader.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Routing;\n\nuse Sylius\\Resource\\Reflection\\ReflectionClassRecursiveIterator;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\AttributesOperationRouteFactoryInterface;\nuse Symfony\\Bundle\\FrameworkBundle\\Routing\\RouteLoaderInterface;\nuse Symfony\\Component\\Routing\\RouteCollection;\n\n/**\n * @deprecated use Sylius\\Resource\\Symfony\\Routing\\Loader\\ResourceLoader instead\n */\nfinal class RoutesAttributesLoader implements RouteLoaderInterface\n{\n    public function __construct(\n        private array $mapping,\n        private RouteAttributesFactoryInterface $routesAttributesFactory,\n        private AttributesOperationRouteFactoryInterface $attributesOperationRouteFactory,\n    ) {\n    }\n\n    public function __invoke(): RouteCollection\n    {\n        $routeCollection = new RouteCollection();\n        $paths = $this->mapping['paths'] ?? [];\n\n        foreach (ReflectionClassRecursiveIterator::getReflectionClassesFromDirectories($paths) as $reflectionClass) {\n            $className = $reflectionClass->getName();\n            $this->routesAttributesFactory->createRouteForClass($routeCollection, $className);\n            $this->attributesOperationRouteFactory->createRouteForClass($routeCollection, $className);\n        }\n\n        return $routeCollection;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Storage/CookieStorage.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Storage;\n\nuse Sylius\\Resource\\Storage\\StorageInterface;\nuse Symfony\\Component\\EventDispatcher\\EventSubscriberInterface;\nuse Symfony\\Component\\HttpFoundation\\Cookie;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpKernel\\Event\\RequestEvent;\nuse Symfony\\Component\\HttpKernel\\Event\\ResponseEvent;\nuse Symfony\\Component\\HttpKernel\\KernelEvents;\nuse Webmozart\\Assert\\Assert;\n\nfinal class CookieStorage implements StorageInterface, EventSubscriberInterface\n{\n    private ParameterBag $requestCookies;\n\n    private ParameterBag $responseCookies;\n\n    public function __construct()\n    {\n        $this->requestCookies = new ParameterBag();\n        $this->responseCookies = new ParameterBag();\n    }\n\n    public static function getSubscribedEvents(): array\n    {\n        return [\n            KernelEvents::REQUEST => [['onKernelRequest', 1024]],\n            KernelEvents::RESPONSE => [['onKernelResponse', -1024]],\n        ];\n    }\n\n    public function onKernelRequest(RequestEvent $event): void\n    {\n        if (!$event->isMainRequest()) {\n            return;\n        }\n\n        $this->requestCookies = new ParameterBag($event->getRequest()->cookies->all());\n        $this->responseCookies = new ParameterBag();\n    }\n\n    public function onKernelResponse(ResponseEvent $event): void\n    {\n        if (!$event->isMainRequest()) {\n            return;\n        }\n\n        $response = $event->getResponse();\n        /** @var string|null $value */\n        foreach ($this->responseCookies as $name => $value) {\n            Assert::nullOrString($value);\n\n            $response->headers->setCookie(new Cookie($name, $value));\n        }\n\n        $this->requestCookies = new ParameterBag();\n        $this->responseCookies = new ParameterBag();\n    }\n\n    public function has(string $name): bool\n    {\n        return !in_array($this->get($name), ['', null], true);\n    }\n\n    public function get(string $name, $default = null)\n    {\n        return $this->responseCookies->get($name, $this->requestCookies->get($name, $default));\n    }\n\n    public function set(string $name, $value): void\n    {\n        $this->responseCookies->set($name, $value);\n    }\n\n    public function remove(string $name): void\n    {\n        $this->set($name, null);\n    }\n\n    public function all(): array\n    {\n        return array_merge($this->responseCookies->all(), $this->requestCookies->all());\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Storage/SessionStorage.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Storage;\n\nuse Sylius\\Resource\\Exception\\StorageUnavailableException;\nuse Sylius\\Resource\\Storage\\StorageInterface;\nuse Symfony\\Component\\HttpFoundation\\Exception\\SessionNotFoundException;\nuse Symfony\\Component\\HttpFoundation\\RequestStack;\nuse Symfony\\Component\\HttpFoundation\\Session\\SessionInterface;\n\nfinal class SessionStorage implements StorageInterface\n{\n    /** @var RequestStack|SessionInterface */\n    private $requestStack;\n\n    /**\n     * @param RequestStack|SessionInterface $requestStack\n     */\n    public function __construct(/* RequestStack */ $requestStack)\n    {\n        /** @phpstan-ignore-next-line */\n        if (!$requestStack instanceof SessionInterface && !$requestStack instanceof RequestStack) {\n            throw new \\InvalidArgumentException(sprintf('The first argument of \"%s\" should be instance of \"%s\" or \"%s\"', __METHOD__, SessionInterface::class, RequestStack::class));\n        }\n\n        if ($requestStack instanceof SessionInterface) {\n            trigger_deprecation(\n                'sylius/resource-bundle',\n                '1.10',\n                'Passing an instance of \"%s\" as the constructor argument for \"%s\" is deprecated and will not be supported in 2.0. Pass an instance of \"%s\" instead.',\n                SessionInterface::class,\n                self::class,\n                RequestStack::class,\n            );\n        }\n\n        $this->requestStack = $requestStack;\n    }\n\n    public function has(string $name): bool\n    {\n        return $this->getSession()->has($name);\n    }\n\n    public function get(string $name, $default = null)\n    {\n        return $this->getSession()->get($name, $default);\n    }\n\n    public function set(string $name, $value): void\n    {\n        $this->getSession()->set($name, $value);\n    }\n\n    public function remove(string $name): void\n    {\n        $this->getSession()->remove($name);\n    }\n\n    public function all(): array\n    {\n        return $this->getSession()->all();\n    }\n\n    /**\n     * @throws StorageUnavailableException\n     */\n    private function getSession(): SessionInterface\n    {\n        try {\n            if ($this->requestStack instanceof SessionInterface) {\n                return $this->requestStack;\n            }\n\n            /** @phpstan-ignore-next-line */\n            return $this->requestStack->getSession();\n        } catch (SessionNotFoundException $exception) {\n            throw new StorageUnavailableException($exception->getMessage(), $exception);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/SyliusResourceBundle.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle;\n\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\CsrfTokenManagerPass;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\DoctrineContainerRepositoryFactoryPass;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\DoctrineTargetEntitiesResolverPass;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\Helper\\TargetEntitiesResolver;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\PagerfantaBridgePass;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\RegisterFormBuilderPass;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\RegisterFqcnControllersPass;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\RegisterResourceRepositoryPass;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\RegisterResourcesPass;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\RegisterResourceStateMachinePass;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\RegisterStateMachinePass;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\TwigPass;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\UnregisterFosRestDefinitionsPass;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\UnregisterHateoasDefinitionsPass;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\WinzouStateMachinePass;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\PagerfantaExtension;\nuse Sylius\\Resource\\Symfony\\DependencyInjection\\Compiler\\DisableMetadataCachePass;\nuse Sylius\\Resource\\Symfony\\DependencyInjection\\Compiler\\FallbackToKernelDefaultLocalePass;\nuse Sylius\\Resource\\Symfony\\DependencyInjection\\Compiler\\MetadataMutatorPass;\nuse Symfony\\Component\\DependencyInjection\\Compiler\\PassConfig;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\HttpKernel\\Bundle\\Bundle;\n\nfinal class SyliusResourceBundle extends Bundle\n{\n    public const DRIVER_DOCTRINE_ORM = 'doctrine/orm';\n\n    public const DRIVER_DOCTRINE_MONGODB_ODM = 'doctrine/mongodb-odm';\n\n    public const DRIVER_DOCTRINE_PHPCR_ODM = 'doctrine/phpcr-odm';\n\n    public const NO_DRIVER = false;\n\n    public function build(ContainerBuilder $container): void\n    {\n        parent::build($container);\n\n        $container->addCompilerPass(new CsrfTokenManagerPass());\n        $container->addCompilerPass(new DisableMetadataCachePass());\n        $container->addCompilerPass(new FallbackToKernelDefaultLocalePass());\n        $container->addCompilerPass(new DoctrineContainerRepositoryFactoryPass());\n        $container->addCompilerPass(new DoctrineTargetEntitiesResolverPass(new TargetEntitiesResolver()), PassConfig::TYPE_BEFORE_OPTIMIZATION, 1);\n        $container->addCompilerPass(new MetadataMutatorPass());\n        $container->addCompilerPass(new RegisterFormBuilderPass());\n        $container->addCompilerPass(new RegisterFqcnControllersPass());\n        $container->addCompilerPass(new RegisterResourceRepositoryPass());\n        $container->addCompilerPass(new RegisterResourcesPass());\n        $container->addCompilerPass(new RegisterStateMachinePass());\n        $container->addCompilerPass(new RegisterResourceStateMachinePass());\n        $container->addCompilerPass(new UnregisterFosRestDefinitionsPass());\n        $container->addCompilerPass(new UnregisterHateoasDefinitionsPass());\n        $container->addCompilerPass(new TwigPass());\n        $container->addCompilerPass(new WinzouStateMachinePass());\n\n        $container->registerExtension(new PagerfantaExtension(true));\n        $container->addCompilerPass(new PagerfantaBridgePass(true), PassConfig::TYPE_BEFORE_OPTIMIZATION, -1); // Should run after all passes from BabDevPagerfantaBundle\n    }\n\n    /**\n     * @return string[]\n     */\n    public static function getAvailableDrivers(): array\n    {\n        return [\n            self::DRIVER_DOCTRINE_ORM,\n            self::DRIVER_DOCTRINE_MONGODB_ODM,\n            self::DRIVER_DOCTRINE_PHPCR_ODM,\n        ];\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Twig/Context/LegacyContextFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Twig\\Context;\n\nuse Sylius\\Bundle\\ResourceBundle\\Context\\Option\\RequestConfigurationOption;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\MetadataOption;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Twig\\Context\\Factory\\ContextFactoryInterface;\n\nfinal class LegacyContextFactory implements ContextFactoryInterface\n{\n    public function __construct(private ContextFactoryInterface $decorated)\n    {\n    }\n\n    public function create(mixed $data, Operation $operation, Context $context): array\n    {\n        $twigContext = $this->decorated->create($data, $operation, $context);\n\n        $requestConfiguration = $context->get(RequestConfigurationOption::class)?->requestConfiguration();\n        $metadata = $context->get(MetadataOption::class)?->metadata();\n\n        if (null !== $requestConfiguration) {\n            $twigContext['configuration'] = $requestConfiguration;\n        }\n\n        if (null !== $metadata) {\n            $twigContext['metadata'] = $metadata;\n        }\n\n        return $twigContext;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Validator/Constraints/Disabled.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Validator\\Constraints;\n\nuse Sylius\\Bundle\\ResourceBundle\\Validator\\DisabledValidator;\nuse Symfony\\Component\\Validator\\Constraint;\n\n#[\\Attribute]\nfinal class Disabled extends Constraint\n{\n    public string $message = 'sylius.resource.not_disabled';\n\n    public function getTargets(): array\n    {\n        return [self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT];\n    }\n\n    public function validatedBy(): string\n    {\n        return DisabledValidator::class;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Validator/Constraints/Enabled.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Validator\\Constraints;\n\nuse Sylius\\Bundle\\ResourceBundle\\Validator\\EnabledValidator;\nuse Symfony\\Component\\Validator\\Constraint;\n\n#[\\Attribute]\nfinal class Enabled extends Constraint\n{\n    public string $message = 'sylius.resource.not_enabled';\n\n    public function getTargets(): array\n    {\n        return [self::PROPERTY_CONSTRAINT, self::CLASS_CONSTRAINT];\n    }\n\n    public function validatedBy(): string\n    {\n        return EnabledValidator::class;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Validator/Constraints/UniqueWithinCollectionConstraint.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Validator\\Constraints;\n\nuse Sylius\\Bundle\\ResourceBundle\\Validator\\UniqueWithinCollectionConstraintValidator;\nuse Symfony\\Component\\Validator\\Constraint;\n\n#[\\Attribute]\nfinal class UniqueWithinCollectionConstraint extends Constraint\n{\n    public string $message = 'This code must be unique within this collection.';\n\n    public string $attributePath = 'code';\n\n    public function validatedBy(): string\n    {\n        return UniqueWithinCollectionConstraintValidator::class;\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Validator/DisabledValidator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Validator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Validator\\Constraints\\Disabled;\nuse Sylius\\Resource\\Model\\ToggleableInterface;\nuse Symfony\\Component\\Validator\\Constraint;\nuse Symfony\\Component\\Validator\\ConstraintValidator;\nuse Webmozart\\Assert\\Assert;\n\nfinal class DisabledValidator extends ConstraintValidator\n{\n    public function validate(mixed $value, Constraint $constraint): void\n    {\n        Assert::isInstanceOf($constraint, Disabled::class);\n\n        if (null === $value) {\n            return;\n        }\n\n        if (!$value instanceof ToggleableInterface) {\n            throw new \\InvalidArgumentException(sprintf(\n                '\"%s\" validates \"%s\" instances only',\n                __CLASS__,\n                ToggleableInterface::class,\n            ));\n        }\n\n        if ($value->isEnabled()) {\n            $this->context->addViolation($constraint->message);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Validator/EnabledValidator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Validator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Validator\\Constraints\\Enabled;\nuse Sylius\\Resource\\Model\\ToggleableInterface;\nuse Symfony\\Component\\Validator\\Constraint;\nuse Symfony\\Component\\Validator\\ConstraintValidator;\nuse Webmozart\\Assert\\Assert;\n\nfinal class EnabledValidator extends ConstraintValidator\n{\n    public function validate(mixed $value, Constraint $constraint): void\n    {\n        Assert::isInstanceOf($constraint, Enabled::class);\n\n        if (null === $value) {\n            return;\n        }\n\n        if (!$value instanceof ToggleableInterface) {\n            throw new \\InvalidArgumentException(sprintf(\n                '\"%s\" validates \"%s\" instances only',\n                __CLASS__,\n                ToggleableInterface::class,\n            ));\n        }\n\n        if (!$value->isEnabled()) {\n            $this->context->addViolation($constraint->message);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Bundle/Validator/UniqueWithinCollectionConstraintValidator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Validator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Validator\\Constraints\\UniqueWithinCollectionConstraint;\nuse Symfony\\Component\\PropertyAccess\\PropertyAccess;\nuse Symfony\\Component\\Validator\\Constraint;\nuse Symfony\\Component\\Validator\\ConstraintValidator;\nuse Webmozart\\Assert\\Assert;\n\nfinal class UniqueWithinCollectionConstraintValidator extends ConstraintValidator\n{\n    /** @param iterable $value */\n    public function validate(mixed $value, Constraint $constraint): void\n    {\n        Assert::isInstanceOf($constraint, UniqueWithinCollectionConstraint::class);\n\n        $propertyAccessor = PropertyAccess::createPropertyAccessor();\n        $collectionOfEntitiesCodes = [];\n\n        foreach ($value as $key => $entity) {\n            /** @var int|string|null $checkingAttribute */\n            $checkingAttribute = $propertyAccessor->getValue($entity, $constraint->attributePath);\n\n            if (null === $checkingAttribute) {\n                continue;\n            }\n\n            if (!array_key_exists($checkingAttribute, $collectionOfEntitiesCodes)) {\n                $collectionOfEntitiesCodes[$checkingAttribute] = $key;\n\n                continue;\n            }\n\n            $this->context\n                ->buildViolation($constraint->message)\n                ->atPath(sprintf('[%d].%s', $key, $constraint->attributePath))\n                ->addViolation()\n            ;\n\n            if (false !== $collectionOfEntitiesCodes[$checkingAttribute]) {\n                $this->context\n                    ->buildViolation($constraint->message)\n                    ->atPath(sprintf('[%d].%s', $collectionOfEntitiesCodes[$checkingAttribute], $constraint->attributePath))\n                    ->addViolation()\n                ;\n\n                $collectionOfEntitiesCodes[$checkingAttribute] = false;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/Component/.gitignore",
    "content": "/vendor/\n!/vendor/.gitignore\n\n/bin/\n\n/composer.phar\n/composer.lock\n\n/.phpunit.result.cache\n"
  },
  {
    "path": "src/Component/LICENSE",
    "content": "Copyright (c) 2011-2023 (c) Sylius Sp. z o.o.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is furnished\nto do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "src/Component/README.md",
    "content": "Resource Component\n==================\n\nResource management layer for Sylius and PHP apps.\n\nSylius\n------\n\n![Sylius](https://demo.sylius.com/assets/shop/img/logo.png)\n\nSylius is an Open Source eCommerce solution built from decoupled components with powerful API and the highest quality code. [Read more on sylius.com](http://sylius.com).\n\nDocumentation\n-------------\n\nDocumentation is available on [**docs.sylius.com**](http://docs.sylius.com/en/latest/components_and_bundles/components/Resource/index.html).\n\nContributing\n------------\n\n[This page](http://docs.sylius.com/en/latest/contributing/index.html) contains all the information about contributing to Sylius.\n\nFollow Sylius' Development\n--------------------------\n\nIf you want to keep up with the updates and latest features, follow us on the following channels:\n\n* [Official Blog](https://sylius.com/blog)\n* [Sylius on Twitter](https://twitter.com/Sylius)\n* [Sylius on Facebook](https://facebook.com/SyliusEcommerce)\n\nBug tracking\n------------\n\nSylius uses [GitHub issues](https://github.com/Sylius/Sylius/issues).\nIf you have found bug, please create an issue.\n\nMIT License\n-----------\n\nLicense can be found [here](https://github.com/Sylius/Sylius/blob/master/LICENSE).\n\nAuthors\n-------\n\nThe component was originally created by [Paweł Jędrzejewski](http://pjedrzejewski.com).\nSee the list of [contributors](https://github.com/Sylius/Resource/contributors).\n"
  },
  {
    "path": "src/Component/composer.json",
    "content": "{\n    \"name\": \"sylius/resource\",\n    \"type\": \"library\",\n    \"description\": \"Basic resource interfaces for PHP applications.\",\n    \"keywords\": [\n        \"shop\",\n        \"ecommerce\",\n        \"resource\",\n        \"api\",\n        \"sylius\",\n        \"doctrine\"\n    ],\n    \"homepage\": \"http://sylius.com\",\n    \"license\": \"MIT\",\n    \"authors\": [\n        {\n            \"name\": \"Paweł Jędrzejewski\",\n            \"homepage\": \"http://pjedrzejewski.com\"\n        },\n        {\n            \"name\": \"Sylius project\",\n            \"homepage\": \"http://sylius.com\"\n        },\n        {\n            \"name\": \"Community contributions\",\n            \"homepage\": \"http://github.com/Sylius/Sylius/contributors\"\n        }\n    ],\n    \"require\": {\n        \"php\": \"^8.2\",\n        \"doctrine/collections\": \"^1.8 || ^2.0\",\n        \"doctrine/inflector\": \"^1.4 || ^2.0\",\n        \"gedmo/doctrine-extensions\": \"^2.4.12 || ^3.0\",\n        \"pagerfanta/core\": \"^3.7 || ^4.0\",\n        \"symfony/event-dispatcher\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/form\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/framework-bundle\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/http-foundation\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/http-kernel\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/property-access\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/routing\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/security-core\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/security-csrf\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/string\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/translation\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/validator\": \"^6.4 || ^7.4 || ^8.0\",\n        \"willdurand/negotiation\": \"^3.1\"\n    },\n    \"require-dev\": {\n        \"behat/transliterator\": \"^1.3\",\n        \"doctrine/orm\": \"^2.18 || ^3.3\",\n        \"matthiasnoback/symfony-dependency-injection-test\": \"^6.1.0\",\n        \"phpunit/phpunit\": \"^10.0\",\n        \"sylius/grid\": \"^1.13 || ^1.15@alpha\",\n        \"sylius/grid-bundle\": \"^1.13 || ^1.15@alpha\",\n        \"symfony/serializer\": \"^6.4 || ^7.4 || ^8.0\",\n        \"symfony/workflow\": \"^6.4 || ^7.4 || ^8.0\",\n        \"twig/twig\": \"^3.0\"\n    },\n    \"conflict\": {\n        \"doctrine/orm\": \"<2.18\",\n        \"twig/twig\": \"<3.0\",\n        \"winzou/state-machine\": \"<0.4\"\n    },\n    \"extra\": {\n        \"branch-alias\": {\n            \"dev-master\": \"1.9-dev\"\n        }\n    },\n    \"autoload\": {\n        \"psr-4\": {\n            \"Sylius\\\\Component\\\\Resource\\\\\": \"legacy/src/\",\n            \"Sylius\\\\Resource\\\\\": \"src/\"\n        }\n    },\n    \"autoload-dev\": {\n        \"psr-4\": {\n            \"Sylius\\\\Component\\\\Resource\\\\Tests\\\\\": \"legacy/tests/\",\n            \"Sylius\\\\Resource\\\\Tests\\\\\": \"tests/\"\n        }\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/phpspec.yml.dist",
    "content": "suites:\n    main:\n        namespace: Sylius\\Component\\Resource\n        psr4_prefix: Sylius\\Component\\Resource\n        src_path: legacy\n        spec_path: legacy\n"
  },
  {
    "path": "src/Component/legacy/src/Annotation/SyliusCrudRoutes.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Annotation;\n\nclass_exists(\\Sylius\\Resource\\Annotation\\SyliusCrudRoutes::class);\n\nif (false) {\n    #[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\n    final class SyliusCrudRoutes extends \\Sylius\\Resource\\Annotation\\SyliusCrudRoutes\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Annotation/SyliusRoute.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Annotation;\n\nclass_exists(\\Sylius\\Resource\\Annotation\\SyliusRoute::class);\n\nif (false) {\n    #[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\n    final class SyliusRoute extends \\Sylius\\Resource\\Annotation\\SyliusRoute\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Exception/DeleteHandlingException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Exception;\n\nclass_exists(\\Sylius\\Resource\\Exception\\DeleteHandlingException::class);\n\nif (false) {\n    class DeleteHandlingException extends \\Sylius\\Resource\\Exception\\DeleteHandlingException\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Exception/RaceConditionException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Exception;\n\nclass_exists(\\Sylius\\Resource\\Exception\\RaceConditionException::class);\n\nif (false) {\n    class RaceConditionException extends \\Sylius\\Resource\\Exception\\RaceConditionException\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Exception/UnexpectedTypeException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Exception;\n\nclass_exists(\\Sylius\\Resource\\Exception\\UnexpectedTypeException::class);\n\nif (false) {\n    class UnexpectedTypeException extends \\Sylius\\Resource\\Exception\\UnexpectedTypeException\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Exception/UnsupportedMethodException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Exception;\n\nclass_exists(\\Sylius\\Resource\\Exception\\UnsupportedMethodException::class);\n\nif (false) {\n    class UnsupportedMethodException extends \\Sylius\\Resource\\Exception\\UnsupportedMethodException\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Exception/UpdateHandlingException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Exception;\n\nclass_exists(\\Sylius\\Resource\\Exception\\UpdateHandlingException::class);\n\nif (false) {\n    class UpdateHandlingException extends \\Sylius\\Resource\\Exception\\UpdateHandlingException\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Exception/VariantWithNoOptionsValuesException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Exception;\n\nclass_exists(\\Sylius\\Resource\\Exception\\VariantWithNoOptionsValuesException::class);\n\nif (false) {\n    trigger_deprecation(\n        'sylius/resource-bundle',\n        '1.13',\n        'The \"%s\" class is deprecated and will be removed in 2.0.',\n        VariantWithNoOptionsValuesException::class,\n    );\n\n    /** @deprecated since SyliusResourceBundle 1.13 and will be removed in 2.0. */\n    final class VariantWithNoOptionsValuesException extends \\Sylius\\Resource\\Exception\\VariantWithNoOptionsValuesException\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Factory/Factory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Factory;\n\nclass_exists(\\Sylius\\Resource\\Factory\\Factory::class);\n\nif (false) {\n    /**\n     * @inheritDoc\n     */\n    final class Factory extends \\Sylius\\Resource\\Factory\\Factory\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Factory/FactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Factory;\n\ninterface_exists(\\Sylius\\Resource\\Factory\\FactoryInterface::class);\n\nif (false) {\n    /**\n     * @inheritDoc\n     */\n    interface FactoryInterface extends \\Sylius\\Resource\\Factory\\FactoryInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Factory/TranslatableFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Factory;\n\nclass_exists(\\Sylius\\Resource\\Factory\\TranslatableFactory::class);\n\nif (false) {\n    final class TranslatableFactory extends \\Sylius\\Resource\\Factory\\TranslatableFactory\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Factory/TranslatableFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Factory;\n\ninterface_exists(\\Sylius\\Resource\\Factory\\TranslatableFactoryInterface::class);\n\nif (false) {\n    /**\n     * @inheritDoc\n     */\n    interface TranslatableFactoryInterface extends \\Sylius\\Resource\\Factory\\TranslatableFactoryInterface\n    {\n        /**\n         * @inheritDoc\n         */\n        public function createNew();\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Generator/RandomnessGenerator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Generator;\n\nclass_exists(\\Sylius\\Resource\\Generator\\RandomnessGenerator::class);\n\nif (false) {\n    final class RandomnessGenerator extends \\Sylius\\Resource\\Generator\\RandomnessGenerator\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Generator/RandomnessGeneratorInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Generator;\n\ninterface_exists(\\Sylius\\Resource\\Generator\\RandomnessGeneratorInterface::class);\n\nif (false) {\n    interface RandomnessGeneratorInterface extends \\Sylius\\Resource\\Generator\\RandomnessGeneratorInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Metadata/Metadata.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Metadata;\n\nclass_exists(\\Sylius\\Resource\\Metadata\\Metadata::class);\n\nif (false) {\n    final class Metadata extends \\Sylius\\Resource\\Metadata\\Metadata\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Metadata/MetadataInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Metadata;\n\ninterface_exists(\\Sylius\\Resource\\Metadata\\MetadataInterface::class);\n\nif (false) {\n    interface MetadataInterface extends \\Sylius\\Resource\\Metadata\\MetadataInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Metadata/Registry.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Metadata;\n\nclass_exists(\\Sylius\\Resource\\Metadata\\Registry::class);\n\nif (false) {\n    final class Registry extends \\Sylius\\Resource\\Metadata\\Registry\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Metadata/RegistryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Metadata;\n\ninterface_exists(\\Sylius\\Resource\\Metadata\\RegistryInterface::class);\n\nif (false) {\n    interface RegistryInterface extends \\Sylius\\Resource\\Metadata\\RegistryInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Model/AbstractTranslation.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Model;\n\nclass_exists(\\Sylius\\Resource\\Model\\AbstractTranslation::class);\n\nif (false) {\n    class AbstractTranslation extends \\Sylius\\Resource\\Model\\AbstractTranslation\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Model/ArchivableInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Model;\n\ninterface_exists(\\Sylius\\Resource\\Model\\ArchivableInterface::class);\n\nif (false) {\n    interface ArchivableInterface extends \\Sylius\\Resource\\Model\\ArchivableInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Model/ArchivableTrait.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Model;\n\ntrait_exists(\\Sylius\\Resource\\Model\\ArchivableTrait::class);\n\nif (false) {\n    trait ArchivableTrait\n    {\n        use \\Sylius\\Resource\\Model\\ArchivableTrait;\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Model/CodeAwareInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Model;\n\ninterface_exists(\\Sylius\\Resource\\Model\\CodeAwareInterface::class);\n\nif (false) {\n    interface CodeAwareInterface extends \\Sylius\\Resource\\Model\\CodeAwareInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Model/ResourceInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Model;\n\ninterface_exists(\\Sylius\\Resource\\Model\\ResourceInterface::class);\n\nif (false) {\n    interface ResourceInterface extends \\Sylius\\Resource\\Model\\ResourceInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Model/ResourceLogEntry.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Model;\n\nclass_exists(\\Sylius\\Resource\\Model\\ResourceLogEntry::class);\n\nif (false) {\n    abstract class ResourceLogEntry extends \\Sylius\\Resource\\Model\\ResourceLogEntry\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Model/SlugAwareInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Model;\n\ninterface_exists(\\Sylius\\Resource\\Model\\SlugAwareInterface::class);\n\nif (false) {\n    interface SlugAwareInterface extends \\Sylius\\Resource\\Model\\SlugAwareInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Model/TimestampableInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Model;\n\ninterface_exists(\\Sylius\\Resource\\Model\\TimestampableInterface::class);\n\nif (false) {\n    interface TimestampableInterface extends \\Sylius\\Resource\\Model\\TimestampableInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Model/TimestampableTrait.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Model;\n\ntrait_exists(\\Sylius\\Resource\\Model\\TimestampableTrait::class);\n\nif (false) {\n    trait TimestampableTrait\n    {\n        use \\Sylius\\Resource\\Model\\TimestampableTrait;\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Model/ToggleableInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Model;\n\ninterface_exists(\\Sylius\\Resource\\Model\\ToggleableInterface::class);\n\nif (false) {\n    interface ToggleableInterface extends \\Sylius\\Resource\\Model\\ToggleableInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Model/ToggleableTrait.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Model;\n\ntrait_exists(\\Sylius\\Resource\\Model\\ToggleableTrait::class);\n\nif (false) {\n    trait ToggleableTrait\n    {\n        use \\Sylius\\Resource\\Model\\ToggleableTrait;\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Model/TranslatableInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Model;\n\ninterface_exists(\\Sylius\\Resource\\Model\\TranslatableInterface::class);\n\nif (false) {\n    interface TranslatableInterface extends \\Sylius\\Resource\\Model\\TranslatableInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Model/TranslatableTrait.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Model;\n\ntrait_exists(\\Sylius\\Resource\\Model\\TranslatableTrait::class);\n\nif (false) {\n    trait TranslatableTrait\n    {\n        use \\Sylius\\Resource\\Model\\TranslatableTrait;\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Model/TranslationInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Model;\n\ninterface_exists(\\Sylius\\Resource\\Model\\TranslationInterface::class);\n\nif (false) {\n    interface TranslationInterface extends \\Sylius\\Resource\\Model\\TranslationInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Model/VersionedInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Model;\n\ninterface_exists(\\Sylius\\Resource\\Model\\VersionedInterface::class);\n\nif (false) {\n    interface VersionedInterface extends \\Sylius\\Resource\\Model\\VersionedInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Reflection/ClassReflection.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Reflection;\n\nclass_exists(\\Sylius\\Resource\\Reflection\\ClassReflection::class);\n\nif (false) {\n    final class ClassReflection extends \\Sylius\\Resource\\Reflection\\ClassReflection\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Repository/Exception/ExistingResourceException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Repository\\Exception;\n\nclass_exists(\\Sylius\\Resource\\Doctrine\\Persistence\\Exception\\ResourceExistsException::class);\n\nif (false) {\n    class ExistingResourceException extends \\Sylius\\Resource\\Doctrine\\Persistence\\Exception\\ResourceExistsException\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Repository/InMemoryRepository.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Repository;\n\nclass_exists(\\Sylius\\Resource\\Doctrine\\Persistence\\InMemoryRepository::class);\n\nif (false) {\n    class InMemoryRepository extends \\Sylius\\Resource\\Doctrine\\Persistence\\InMemoryRepository\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Repository/RepositoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Repository;\n\ninterface_exists(\\Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface::class);\n\nif (false) {\n    /**\n     * @inheritDoc\n     */\n    interface RepositoryInterface extends \\Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/ResourceActions.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource;\n\nclass_exists(\\Sylius\\Resource\\ResourceActions::class);\n\nif (false) {\n    final class ResourceActions extends \\Sylius\\Resource\\ResourceActions\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/StateMachine/StateMachine.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\StateMachine;\n\nclass_exists(\\Sylius\\Resource\\StateMachine\\StateMachine::class);\n\nif (false) {\n    final class StateMachine extends \\Sylius\\Resource\\StateMachine\\StateMachine\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/StateMachine/StateMachineInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\StateMachine;\n\ninterface_exists(\\Sylius\\Resource\\StateMachine\\StateMachineInterface::class);\n\nif (false) {\n    interface StateMachineInterface extends \\Sylius\\Resource\\StateMachine\\StateMachineInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Storage/StorageInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Storage;\n\ninterface_exists(\\Sylius\\Resource\\Storage\\StorageInterface::class);\n\nif (false) {\n    interface StorageInterface extends \\Sylius\\Resource\\Storage\\StorageInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Translation/Provider/ImmutableTranslationLocaleProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Translation\\Provider;\n\nclass_exists(\\Sylius\\Resource\\Translation\\Provider\\ImmutableTranslationLocaleProvider::class);\n\nif (false) {\n    final class ImmutableTranslationLocaleProvider extends \\Sylius\\Resource\\Translation\\Provider\\ImmutableTranslationLocaleProvider\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Translation/Provider/TranslationLocaleProviderInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Translation\\Provider;\n\ninterface_exists(\\Sylius\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface::class);\n\nif (false) {\n    interface TranslationLocaleProviderInterface extends \\Sylius\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Translation/TranslatableEntityLocaleAssigner.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Translation;\n\nclass_exists(\\Sylius\\Resource\\Translation\\TranslatableEntityLocaleAssigner::class);\n\nif (false) {\n    final class TranslatableEntityLocaleAssigner extends \\Sylius\\Resource\\Translation\\TranslatableEntityLocaleAssigner\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/src/Translation/TranslatableEntityLocaleAssignerInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Translation;\n\ninterface_exists(\\Sylius\\Resource\\Translation\\TranslatableEntityLocaleAssignerInterface::class);\n\nif (false) {\n    interface TranslatableEntityLocaleAssignerInterface extends \\Sylius\\Resource\\Translation\\TranslatableEntityLocaleAssignerInterface\n    {\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyClassOne.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nfinal class DummyClassOne\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyClassTwo.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nfinal class DummyClassTwo\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyMultiResourcesWithOperations.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Show;\n\n#[AsResource(alias: 'app.order')]\n#[Index]\n#[Create]\n#[AsResource(alias: 'app.cart')]\n#[Index]\n#[Show]\nfinal class DummyMultiResourcesWithOperations\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyOperationsWithoutResource.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\n\n#[Index]\n#[Create]\nfinal class DummyOperationsWithoutResource\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResource.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\n\n#[AsResource]\nfinal class DummyResource\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResourceWithAlias.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\n\n#[AsResource(alias: 'app.dummy')]\nfinal class DummyResourceWithAlias\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResourceWithDenormalizationContext.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\n\n#[AsResource(alias: 'app.dummy', denormalizationContext: ['groups' => ['dummy:write']])]\n#[Create]\n#[Update]\n#[Index]\n#[Show]\nfinal class DummyResourceWithDenormalizationContext\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResourceWithFormOptions.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Update;\n\n#[AsResource(alias: 'app.dummy')]\n#[Create(formOptions: ['html5' => false])]\n#[Update(formOptions: ['html5' => true])]\nfinal class DummyResourceWithFormOptions\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResourceWithFormType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Update;\n\n#[AsResource(alias: 'app.dummy', formType: 'App\\Form\\DummyType')]\n#[Create]\n#[Update]\nfinal class DummyResourceWithFormType\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResourceWithGrid.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\n\n#[AsResource(alias: 'app.dummy')]\n#[Create]\n#[Update]\n#[Index(grid: 'app_dummy')]\n#[Show]\nfinal class DummyResourceWithGrid\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResourceWithName.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\n\n#[AsResource(alias: 'app.dummy', name: 'book')]\n#[Create]\n#[Update]\n#[Index]\n#[Show]\nfinal class DummyResourceWithName\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResourceWithNormalizationContext.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\n\n#[AsResource(alias: 'app.dummy', normalizationContext: ['groups' => ['dummy:read']])]\n#[Create]\n#[Update]\n#[Index]\n#[Show]\nfinal class DummyResourceWithNormalizationContext\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResourceWithOperations.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\n\n#[AsResource(alias: 'app.dummy')]\n#[Index]\n#[Create]\n#[Update]\n#[Show]\nfinal class DummyResourceWithOperations\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResourceWithPluralName.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\n\n#[AsResource(alias: 'app.dummy', pluralName: 'books')]\n#[Create]\n#[Update]\n#[Index]\n#[Show]\nfinal class DummyResourceWithPluralName\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResourceWithRouteCondition.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\n\n#[AsResource(alias: 'app.dummy', routeCondition: 'custom_condition')]\n#[Create]\n#[Update]\n#[Index]\n#[Show]\nfinal class DummyResourceWithRouteCondition\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResourceWithRoutePrefix.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\n\n#[AsResource(alias: 'app.dummy', routePrefix: '/admin')]\n#[Create]\n#[Update]\n#[Index]\n#[Show]\nfinal class DummyResourceWithRoutePrefix\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResourceWithRoutePriorities.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\n\n#[AsResource(alias: 'app.dummy', routePriority: 1)]\n#[Show(routePriority: -100)]\n#[Create]\n#[Update]\n#[Index]\nfinal class DummyResourceWithRoutePriorities\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResourceWithRouteRequirements.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\n\n#[AsResource(alias: 'app.dummy', routePrefix: '/{_locale}', routeRequirements: ['_locale' => 'en|fr|pl'])]\n#[Show(path: '/{page}', routeRequirements: ['_locale' => 'en|fr|pl', 'page' => '\\d+'])]\n#[Create]\n#[Update]\n#[Index]\nfinal class DummyResourceWithRouteRequirements\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResourceWithSections.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Show;\n\n#[AsResource(alias: 'app.dummy', section: 'admin')]\n#[Index]\n#[Create]\n#[AsResource(alias: 'app.dummy', section: 'shop')]\n#[Index]\n#[Show]\nfinal class DummyResourceWithSections\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResourceWithSectionsAndNestedOperations.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Show;\n\n#[AsResource(\n    alias: 'app.dummy',\n    section: 'admin',\n    operations: [\n        new Index(),\n        new Create(),\n    ],\n)]\n#[AsResource(\n    alias: 'app.dummy',\n    section: 'shop',\n    operations: [\n        new Index(),\n        new Show(),\n    ],\n)]\nfinal class DummyResourceWithSectionsAndNestedOperations\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/DummyResourceWithValidationContext.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Update;\n\n#[AsResource(alias: 'app.dummy', validationContext: ['groups' => ['sylius']])]\n#[Create]\n#[Update]\nfinal class DummyResourceWithValidationContext\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/ProcessorWithCallable.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nfinal class ProcessorWithCallable\n{\n    public static function process(): \\stdClass\n    {\n        return new \\stdClass();\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/ProviderWithCallable.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nfinal class ProviderWithCallable\n{\n    public static function provide(): \\stdClass\n    {\n        return new \\stdClass();\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/RepositoryWithCallables.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nfinal class RepositoryWithCallables\n{\n    public function __invoke(string $id): \\stdClass\n    {\n        return self::find($id);\n    }\n\n    public static function find(string $id): \\stdClass\n    {\n        $stdClass = new \\stdClass();\n        $stdClass->id = $id;\n\n        return $stdClass;\n    }\n\n    public static function findOneBy(array $criteria, ?array $orderBy = null): array\n    {\n        return [];\n    }\n\n    public function __call(string $method, mixed $arguments): array\n    {\n        return [];\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/ResponderWithCallable.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nfinal class ResponderWithCallable\n{\n    public static function respond(): Response\n    {\n        return new Response();\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Dummy/TraitPass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Dummy;\n\ntrait TraitPass\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Exception/DeleteHandlingExceptionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Exception;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Exception\\DeleteHandlingException;\nuse Sylius\\Resource\\Exception\\DeleteHandlingException as NewDeleteHandlingException;\n\nfinal class DeleteHandlingExceptionTest extends TestCase\n{\n    public function testItShouldBeAnAliasOfDeleteHandlingException(): void\n    {\n        $this->assertInstanceOf(NewDeleteHandlingException::class, new DeleteHandlingException());\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Exception/RaceConditionExceptionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Exception;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Exception\\RaceConditionException;\nuse Sylius\\Resource\\Exception\\RaceConditionException as NewRaceConditionException;\n\nfinal class RaceConditionExceptionTest extends TestCase\n{\n    public function testItShouldBeAnAliasOfRaceConditionException(): void\n    {\n        $this->assertInstanceOf(NewRaceConditionException::class, new RaceConditionException());\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Exception/UnexpectedTypeExceptionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Exception;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Exception\\UnexpectedTypeException;\nuse Sylius\\Resource\\Exception\\UnexpectedTypeException as NewUnexpectedTypeException;\n\nfinal class UnexpectedTypeExceptionTest extends TestCase\n{\n    public function testItShouldBeAnAliasOfUnexpectedTypeException(): void\n    {\n        $this->assertInstanceOf(NewUnexpectedTypeException::class, new UnexpectedTypeException('stringValue', '\\ExpectedType'));\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Exception/UnsupportedMethodExceptionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Exception;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Exception\\UnsupportedMethodException;\nuse Sylius\\Resource\\Exception\\UnsupportedMethodException as NewUnsupportedMethodException;\n\nfinal class UnsupportedMethodExceptionTest extends TestCase\n{\n    public function testItShouldBeAnAliasOfUnsupportedMethodException(): void\n    {\n        $this->assertInstanceOf(NewUnsupportedMethodException::class, new UnsupportedMethodException('methodName'));\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Exception/UpdateHandlingExceptionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Exception;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Exception\\UpdateHandlingException;\nuse Sylius\\Resource\\Exception\\UpdateHandlingException as NewUpdateHandlingException;\n\nfinal class UpdateHandlingExceptionTest extends TestCase\n{\n    public function testItShouldBeAnAliasOfUpdateHandlingException(): void\n    {\n        $this->assertInstanceOf(NewUpdateHandlingException::class, new UpdateHandlingException());\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Factory/FactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Factory;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Factory\\Factory;\nuse Sylius\\Component\\Resource\\Factory\\FactoryInterface as LegacyFactoryInterface;\nuse Sylius\\Resource\\Factory\\Factory as NewFactory;\nuse Sylius\\Resource\\Factory\\FactoryInterface;\n\nfinal class FactoryTest extends TestCase\n{\n    private Factory $factory;\n\n    protected function setUp(): void\n    {\n        $this->factory = new Factory(\\stdClass::class);\n    }\n\n    /** @test */\n    public function it_implements_factory_interface(): void\n    {\n        $this->assertInstanceOf(FactoryInterface::class, $this->factory);\n    }\n\n    /** @test */\n    public function it_implements_legacy_factory_interface(): void\n    {\n        $this->assertInstanceOf(LegacyFactoryInterface::class, $this->factory);\n    }\n\n    /** @test */\n    public function it_is_an_alias_of_the_factory(): void\n    {\n        $this->assertInstanceOf(NewFactory::class, $this->factory);\n    }\n\n    /** @test */\n    public function it_creates_a_new_instance_of_a_resource(): void\n    {\n        $this->assertInstanceOf(\\stdClass::class, $this->factory->createNew());\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Factory/TranslatableFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Factory;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Factory\\TranslatableFactory;\nuse Sylius\\Component\\Resource\\Factory\\TranslatableFactoryInterface as LegacyTranslatableFactoryInterface;\nuse Sylius\\Resource\\Factory\\FactoryInterface;\nuse Sylius\\Resource\\Factory\\TranslatableFactory as NewTranslatableFactory;\nuse Sylius\\Resource\\Factory\\TranslatableFactoryInterface;\nuse Sylius\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface;\n\nfinal class TranslatableFactoryTest extends TestCase\n{\n    private FactoryInterface|MockObject $factory;\n\n    private TranslationLocaleProviderInterface|MockObject $localeProvider;\n\n    private TranslatableFactory $translatableFactory;\n\n    protected function setUp(): void\n    {\n        $this->factory = $this->createMock(FactoryInterface::class);\n        $this->localeProvider = $this->createMock(TranslationLocaleProviderInterface::class);\n\n        $this->translatableFactory = new TranslatableFactory($this->factory, $this->localeProvider);\n    }\n\n    /** @test */\n    public function it_implements_translatable_factory_interface(): void\n    {\n        $this->assertInstanceOf(TranslatableFactoryInterface::class, $this->translatableFactory);\n    }\n\n    /** @test */\n    public function it_implements_legacy_translatable_factory_interface(): void\n    {\n        $this->assertInstanceOf(LegacyTranslatableFactoryInterface::class, $this->translatableFactory);\n    }\n\n    /** @test */\n    public function it_should_be_an_alias_of_translatable_factory(): void\n    {\n        $this->assertInstanceOf(NewTranslatableFactory::class, $this->translatableFactory);\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Fixtures/SampleBookResourceInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Fixtures;\n\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\ninterface SampleBookResourceInterface extends ResourceInterface\n{\n    /**\n     * @return string\n     */\n    public function getName();\n\n    /**\n     * @return int\n     */\n    public function getRating();\n\n    /**\n     * @return string\n     */\n    public function getTitle();\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Metadata/MetadataTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Metadata;\n\nuse Doctrine\\Inflector\\InflectorFactory;\nuse Doctrine\\Inflector\\Rules\\Patterns;\nuse Doctrine\\Inflector\\Rules\\Ruleset;\nuse Doctrine\\Inflector\\Rules\\Substitution;\nuse Doctrine\\Inflector\\Rules\\Substitutions;\nuse Doctrine\\Inflector\\Rules\\Transformations;\nuse Doctrine\\Inflector\\Rules\\Word;\nuse PHPUnit\\Framework\\Assert;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Metadata\\Metadata as ComponentMetadata;\nuse Sylius\\Component\\Resource\\Metadata\\MetadataInterface as LegacyMetadataInterface;\nuse Sylius\\Resource\\Metadata\\Metadata;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\n\n/**\n * @psalm-suppress PropertyNotSetInConstructor Having some issues with custom PHPUnit annotations\n */\nfinal class MetadataTest extends TestCase\n{\n    private ComponentMetadata $legacyMetadata;\n\n    protected function setUp(): void\n    {\n        $this->legacyMetadata = ComponentMetadata::fromAliasAndConfiguration('sylius.product', ['driver' => 'doctrine/orm']);\n    }\n\n    /** @test */\n    public function it_implements_metadata_interface(): void\n    {\n        $this->assertInstanceOf(MetadataInterface::class, $this->legacyMetadata);\n    }\n\n    /** @test */\n    public function it_implements_legacy_metadata_interface(): void\n    {\n        $this->assertInstanceOf(LegacyMetadataInterface::class, $this->legacyMetadata);\n    }\n\n    /** @test */\n    public function it_should_be_an_alias_of_metadata(): void\n    {\n        $this->assertInstanceOf(Metadata::class, $this->legacyMetadata);\n    }\n\n    /**\n     * @test\n     *\n     * @runInSeparateProcess\n     *\n     * @preserveGlobalState disabled\n     */\n    public function it_uses_a_custom_inflector(): void\n    {\n        $factory = InflectorFactory::create();\n        $factory->withPluralRules(new Ruleset(\n            new Transformations(),\n            new Patterns(),\n            new Substitutions(new Substitution(new Word('taxon'), new Word('taxons'))),\n        ));\n        $inflector = $factory->build();\n\n        Metadata::setInflector($inflector);\n\n        $metadata = Metadata::fromAliasAndConfiguration('app.taxon', ['driver' => 'whatever']);\n\n        Assert::assertSame('taxons', $metadata->getPluralName());\n    }\n\n    /** @test */\n    public function it_uses_a_default_inflector(): void\n    {\n        $metadata = Metadata::fromAliasAndConfiguration('app.taxon', ['driver' => 'whatever']);\n\n        Assert::assertSame('taxa', $metadata->getPluralName());\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Metadata/RegistryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Metadata;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Metadata\\Registry;\nuse Sylius\\Component\\Resource\\Metadata\\RegistryInterface as LegacyRegistryInterface;\nuse Sylius\\Resource\\Metadata\\Registry as NewRegistry;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\n\nfinal class RegistryTest extends TestCase\n{\n    private Registry $registry;\n\n    protected function setUp(): void\n    {\n        $this->registry = new Registry();\n    }\n\n    public function testItImplementsRegistryInterface(): void\n    {\n        $this->assertInstanceOf(RegistryInterface::class, $this->registry);\n    }\n\n    public function testItImplementsLegacyRegistryInterface(): void\n    {\n        $this->assertInstanceOf(LegacyRegistryInterface::class, $this->registry);\n    }\n\n    public function testItShouldBeAnAliasOfRegistry(): void\n    {\n        $this->assertInstanceOf(NewRegistry::class, $this->registry);\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Model/AbstractTranslationTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Model;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Model\\AbstractTranslation;\nuse Sylius\\Resource\\Model\\AbstractTranslation as NewAbstractTranslation;\nuse Sylius\\Resource\\Model\\TranslationInterface;\n\nfinal class AbstractTranslationTest extends TestCase\n{\n    private ConcreteTranslation $translation;\n\n    protected function setUp(): void\n    {\n        $this->translation = new ConcreteTranslation();\n    }\n\n    public function testItIsATranslation(): void\n    {\n        $this->assertInstanceOf(TranslationInterface::class, $this->translation);\n    }\n\n    public function testItShouldBeAnAliasOfAbstractTranslation(): void\n    {\n        $this->assertInstanceOf(NewAbstractTranslation::class, $this->translation);\n    }\n}\n\nclass ConcreteTranslation extends AbstractTranslation\n{\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Reflection/ClassInfoTraitTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Reflection;\n\nuse App\\Entity\\Book;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Reflection\\ClassInfoTrait;\n\nfinal class ClassInfoTraitTest extends TestCase\n{\n    private function getClassInfoTraitImplementation(): object\n    {\n        return new class() {\n            use ClassInfoTrait {\n                ClassInfoTrait::getRealClassName as public;\n            }\n        };\n    }\n\n    /**\n     * @dataProvider getValidClasses\n     */\n    public function testRealClassName(string $class): void\n    {\n        $classInfo = $this->getClassInfoTraitImplementation();\n\n        $this->assertSame(Book::class, $classInfo->getRealClassName($class));\n    }\n\n    /**\n     * @dataProvider getInvalidClasses\n     */\n    public function testThrowsExceptionIfUnproxiedClassDoNotExist(string $class): void\n    {\n        $this->expectException(\\InvalidArgumentException::class);\n\n        $classInfo = $this->getClassInfoTraitImplementation();\n\n        $classInfo->getRealClassName($class);\n    }\n\n    public function getInvalidClasses(): Iterable\n    {\n        yield ['class' => 'Proxies\\__CG__\\App\\Entity\\Book1'];\n        yield ['class' => 'MongoDBODMProxies\\__PM__\\App\\Entity\\Book1\\Generated'];\n    }\n\n    public function getValidClasses(): Iterable\n    {\n        yield ['class' => 'Proxies\\__CG__\\App\\Entity\\Book'];\n        yield ['class' => 'MongoDBODMProxies\\__PM__\\App\\Entity\\Book\\Generated'];\n    }\n\n    public function testUnmarkedRealClassName(): void\n    {\n        $classInfo = $this->getClassInfoTraitImplementation();\n\n        $this->assertSame(Book::class, $classInfo->getRealClassName(Book::class));\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Reflection/ClassReflectionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Reflection;\n\nuse App\\Entity\\CrudRoutes\\BookWithCriteria;\nuse App\\Entity\\Route\\ShowBook;\nuse App\\Entity\\Route\\ShowBookWithPriority;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyClassOne;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyClassTwo;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\TraitPass;\nuse Sylius\\Resource\\Annotation\\SyliusCrudRoutes;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\nuse Sylius\\Resource\\Reflection\\ClassReflection;\nuse Sylius\\Resource\\Reflection\\ClassReflection as NewClassReflection;\n\nfinal class ClassReflectionTest extends TestCase\n{\n    /** @test */\n    public function it_is_an_alias_of_the_class_reflection(): void\n    {\n        $this->assertInstanceOf(NewClassReflection::class, new \\Sylius\\Component\\Resource\\Reflection\\ClassReflection());\n    }\n\n    /** @test */\n    public function it_returns_resource_classes_from_paths(): void\n    {\n        $resources = ClassReflection::getResourcesByPaths([__DIR__ . '/../Dummy']);\n\n        $this->assertContains(DummyClassOne::class, $resources);\n        $this->assertContains(DummyClassTwo::class, $resources);\n    }\n\n    /** @test */\n    public function it_returns_resource_classes_from_a_directory(): void\n    {\n        $resources = ClassReflection::getResourcesByPath(__DIR__ . '/../Dummy');\n\n        $this->assertContains(DummyClassOne::class, $resources);\n        $this->assertContains(DummyClassTwo::class, $resources);\n    }\n\n    /** @test */\n    public function it_excludes_traits(): void\n    {\n        $resources = ClassReflection::getResourcesByPath(__DIR__ . '/../Dummy');\n\n        $this->assertNotContains(TraitPass::class, $resources);\n    }\n\n    /** @test */\n    public function it_returns_class_attributes(): void\n    {\n        $this->assertCount(1, ClassReflection::getClassAttributes(BookWithCriteria::class, SyliusCrudRoutes::class));\n        $this->assertCount(1, ClassReflection::getClassAttributes(ShowBook::class, SyliusRoute::class));\n        $this->assertCount(2, ClassReflection::getClassAttributes(ShowBookWithPriority::class, SyliusRoute::class));\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Repository/Exception/ExistingResourceExceptionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Repository\\Exception;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Repository\\Exception\\ExistingResourceException;\nuse Sylius\\Resource\\Doctrine\\Persistence\\Exception\\ResourceExistsException;\n\nfinal class ExistingResourceExceptionTest extends TestCase\n{\n    private ExistingResourceException $exception;\n\n    protected function setUp(): void\n    {\n        $this->exception = new ExistingResourceException();\n    }\n\n    public function testItExtendsException(): void\n    {\n        $this->assertInstanceOf(\\Exception::class, $this->exception);\n    }\n\n    public function testItShouldBeAnAliasOfResourceExistsException(): void\n    {\n        $this->assertInstanceOf(ResourceExistsException::class, $this->exception);\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Repository/InMemoryRepositoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Repository;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Repository\\InMemoryRepository;\nuse Sylius\\Component\\Resource\\Tests\\Fixtures\\SampleBookResourceInterface;\nuse Sylius\\Resource\\Doctrine\\Persistence\\InMemoryRepository as NewInMemoryRepository;\n\nrequire_once dirname(__DIR__) . '/Fixtures/SampleBookResourceInterface.php';\n\nfinal class InMemoryRepositoryTest extends TestCase\n{\n    private InMemoryRepository $repository;\n\n    protected function setUp(): void\n    {\n        $this->repository = new InMemoryRepository(SampleBookResourceInterface::class);\n    }\n\n    public function testItShouldBeAnAliasOfInMemoryRepository(): void\n    {\n        $this->assertInstanceOf(NewInMemoryRepository::class, $this->repository);\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/ResourceActionsTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\ResourceActions;\nuse Sylius\\Resource\\ResourceActions as NewResourceActions;\n\nfinal class ResourceActionsTest extends TestCase\n{\n    public function testItIsInitializable(): void\n    {\n        $this->assertTrue(class_exists(ResourceActions::class));\n    }\n\n    public function testItIsAnAliasOfResourceActions(): void\n    {\n        $this->assertTrue(is_a(ResourceActions::class, NewResourceActions::class, true));\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/StateMachine/StateMachineTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\StateMachine;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\StateMachine\\StateMachine;\nuse Sylius\\Component\\Resource\\StateMachine\\StateMachineInterface as LegacyStateMachineInterface;\nuse Sylius\\Resource\\StateMachine\\StateMachine as NewStateMachine;\nuse Sylius\\Resource\\StateMachine\\StateMachineInterface;\nuse Sylius\\Resource\\Tests\\Dummy\\PullRequest;\nuse winzou\\Bundle\\StateMachineBundle\\winzouStateMachineBundle;\n\nfinal class StateMachineTest extends TestCase\n{\n    private StateMachine $stateMachine;\n\n    protected function setUp(): void\n    {\n        $this->markAsSkippedIfWinzouStateMachineIsNotAvailable();\n\n        $this->stateMachine = new StateMachine(new PullRequest(), [\n            'graph' => 'pull_request',\n            'property_path' => 'currentPlace',\n            'places' => [\n                'start',\n                'test',\n            ],\n            'transitions' => [\n                'submit' => [\n                    'from' => ['start'],\n                    'to' => 'test',\n                ],\n            ],\n        ]);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(StateMachine::class, $this->stateMachine);\n    }\n\n    public function testItImplementsStateMachineInterface(): void\n    {\n        $this->assertInstanceOf(StateMachineInterface::class, $this->stateMachine);\n    }\n\n    public function testItImplementsLegacyStateMachineInterface(): void\n    {\n        $this->assertInstanceOf(LegacyStateMachineInterface::class, $this->stateMachine);\n    }\n\n    public function testItShouldBeAnAliasOfStateMachine(): void\n    {\n        $this->assertInstanceOf(NewStateMachine::class, $this->stateMachine);\n    }\n\n    private function markAsSkippedIfWinzouStateMachineIsNotAvailable(): void\n    {\n        if (!class_exists(winzouStateMachineBundle::class)) {\n            $this->markTestSkipped('Winzou State machine is not available.');\n        }\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Symfony/EventListener/AddFormatListenerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Symfony\\EventListener;\n\nuse Negotiation\\Negotiator;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Operation\\HttpOperationInitiatorInterface;\nuse Sylius\\Resource\\Symfony\\EventListener\\AddFormatListener;\nuse Symfony\\Component\\HttpFoundation\\HeaderBag;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpKernel\\Event\\RequestEvent;\nuse Symfony\\Component\\HttpKernel\\Exception\\NotAcceptableHttpException;\n\nfinal class AddFormatListenerTest extends TestCase\n{\n    private HttpOperationInitiatorInterface|MockObject $operationInitiator;\n\n    private AddFormatListener $addFormatListener;\n\n    protected function setUp(): void\n    {\n        $this->operationInitiator = $this->createMock(HttpOperationInitiatorInterface::class);\n\n        $this->addFormatListener = new AddFormatListener(\n            $this->operationInitiator,\n            new Negotiator(),\n        );\n    }\n\n    /** @test */\n    public function it_sets_format_from_accept_header(): void\n    {\n        $event = $this->createMock(RequestEvent::class);\n        $request = $this->createMock(Request::class);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $event->method('getRequest')->willReturn($request);\n\n        $this->operationInitiator->method('initializeOperation')->with($request)->willReturn($operation);\n\n        $request->attributes = new ParameterBag();\n        $request->headers = new HeaderBag(['Accept' => 'application/json']);\n\n        $request->expects($this->once())\n            ->method('getFormat')\n            ->with('application/json')\n            ->willReturn('json');\n\n        $request->expects($this->once())\n            ->method('setRequestFormat')\n            ->with('json');\n\n        $this->addFormatListener->onKernelRequest($event);\n    }\n\n    /** @test */\n    public function it_sets_format_from_request(): void\n    {\n        $event = $this->createMock(RequestEvent::class);\n        $request = $this->createMock(Request::class);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $event->method('getRequest')->willReturn($request);\n\n        $this->operationInitiator->method('initializeOperation')->with($request)->willReturn($operation);\n\n        $request->attributes = new ParameterBag(['_format' => 'json']);\n        $request->headers = new HeaderBag();\n\n        $request->expects($this->once())\n            ->method('getRequestFormat')\n            ->with(null)\n            ->willReturn('json');\n\n        $request->expects($this->once())\n            ->method('getMimeType')\n            ->with('json')\n            ->willReturn('application/json');\n\n        $this->addFormatListener->onKernelRequest($event);\n    }\n\n    /** @test */\n    public function it_throws_an_exception_when_format_is_not_accepted(): void\n    {\n        $event = $this->createMock(RequestEvent::class);\n        $request = $this->createMock(Request::class);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $event->method('getRequest')->willReturn($request);\n\n        $this->operationInitiator->method('initializeOperation')->with($request)->willReturn($operation);\n\n        $request->attributes = new ParameterBag(['_format' => 'json-ld']);\n        $request->headers = new HeaderBag();\n\n        $request->expects($this->once())\n            ->method('getRequestFormat')\n            ->with(null)\n            ->willReturn('json-ld');\n\n        $request->expects($this->once())\n            ->method('getMimeType')\n            ->with('json-ld')\n            ->willReturn('application/json-ld');\n\n        $this->expectException(NotAcceptableHttpException::class);\n        $this->expectExceptionMessage('Requested format \"application/json-ld\" is not supported. Supported MIME types are \"text/html\", \"application/json\", \"application/xml\".');\n\n        $this->addFormatListener->onKernelRequest($event);\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Symfony/Validator/State/ValidateProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Symfony\\Validator\\State;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Sylius\\Resource\\Symfony\\Validator\\Exception\\ValidationException;\nuse Sylius\\Resource\\Symfony\\Validator\\State\\ValidateProvider;\nuse Symfony\\Component\\Form\\FormInterface;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Validator\\ConstraintViolationInterface;\nuse Symfony\\Component\\Validator\\ConstraintViolationList;\nuse Symfony\\Component\\Validator\\ConstraintViolationListInterface;\nuse Symfony\\Component\\Validator\\Validator\\ValidatorInterface;\nuse Webmozart\\Assert\\Assert;\n\nfinal class ValidateProviderTest extends TestCase\n{\n    private ProviderInterface|MockObject $decorated;\n\n    private ValidatorInterface|MockObject $validator;\n\n    private ValidateProvider $validateProvider;\n\n    protected function setUp(): void\n    {\n        $this->decorated = $this->createMock(ProviderInterface::class);\n        $this->validator = $this->createMock(ValidatorInterface::class);\n\n        $this->validateProvider = new ValidateProvider(\n            $this->decorated,\n            $this->validator,\n        );\n    }\n\n    /** @test */\n    public function it_validates_form_data(): void\n    {\n        $request = $this->createMock(Request::class);\n        $form = $this->createMock(FormInterface::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $data = $this->createMock(\\stdClass::class);\n\n        $operation = new Create();\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn(['foo' => 'fighters'])\n        ;\n\n        $request->method('isMethodSafe')->willReturn(false);\n        $request->method('getRequestFormat')->willReturn('html');\n\n        $request->attributes = $attributes;\n\n        $attributes->method('get')->with('form')->willReturn($form);\n\n        $form->expects($this->once())->method('isSubmitted')->willReturn(true);\n        $form->expects($this->once())->method('isValid')->willReturn(true);\n        $form->expects($this->once())->method('getData')->willReturn($data);\n\n        $attributes->expects($this->once())\n            ->method('set')\n            ->with('is_valid', true)\n        ;\n\n        $this->validateProvider->provide($operation, $context);\n    }\n\n    /** @test */\n    public function it_does_nothing_if_controller_result_is_a_response(): void\n    {\n        $request = $this->createMock(Request::class);\n        $form = $this->createMock(FormInterface::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $data = $this->createMock(\\stdClass::class);\n\n        $operation = new Create();\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn(new Response())\n        ;\n\n        $request->expects($this->once())->method('getRequestFormat')->willReturn('html');\n        $request->expects($this->never())->method('isMethodSafe');\n\n        $request->attributes = $attributes;\n\n        $attributes->method('get')->with('form')->willReturn($form);\n\n        $form->expects($this->never())->method('isSubmitted');\n        $form->expects($this->never())->method('isValid');\n        $form->expects($this->never())->method('getData');\n\n        $attributes->expects($this->never())->method('set')->with('is_valid', true);\n\n        $this->validateProvider->provide($operation, $context);\n    }\n\n    /** @test */\n    public function it_does_nothing_if_operation_is_not_a_create_or_update_operation(): void\n    {\n        $request = $this->createMock(Request::class);\n        $form = $this->createMock(FormInterface::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $data = $this->createMock(\\stdClass::class);\n\n        $operation = new Index();\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn(['foo' => 'fighters'])\n        ;\n\n        $request->method('isMethodSafe')->willReturn(false);\n        $request->method('getRequestFormat')->willReturn('html');\n\n        $request->attributes = $attributes;\n\n        $attributes->method('get')->willReturnCallback(function (string $key) use ($form) {\n            if ($key === 'form') {\n                return $form;\n            }\n            if ($key === '_route') {\n                return 'app_dummy_create';\n            }\n\n            return null;\n        });\n        $attributes->method('all')->with('_sylius')->willReturn(['resource' => 'app.dummy']);\n\n        $form->expects($this->never())->method('isSubmitted');\n        $form->expects($this->never())->method('isValid');\n        $form->expects($this->never())->method('getData');\n\n        $attributes->expects($this->never())->method('set')->with('is_valid', true);\n\n        $this->validateProvider->provide($operation, $context);\n    }\n\n    /** @test */\n    public function it_sets_is_valid_to_false_if_method_is_safe(): void\n    {\n        $request = $this->createMock(Request::class);\n        $form = $this->createMock(FormInterface::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $data = $this->createMock(\\stdClass::class);\n\n        $operation = new Create();\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn(['foo' => 'fighters'])\n        ;\n\n        $request->expects($this->once())->method('isMethodSafe')->willReturn(true);\n        $request->expects($this->once())->method('getRequestFormat')->willReturn('html');\n\n        $request->attributes = $attributes;\n\n        $attributes->method('get')->with('form')->willReturn($form);\n\n        $form->expects($this->never())->method('isSubmitted');\n        $form->expects($this->never())->method('isValid');\n        $form->expects($this->never())->method('getData');\n\n        $attributes->expects($this->once())\n            ->method('set')\n            ->with('is_valid', false)\n        ;\n\n        $this->validateProvider->provide($operation, $context);\n    }\n\n    /** @test */\n    public function it_does_nothing_if_there_is_no_form(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n\n        $operation = new Create();\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn(['foo' => 'fighters'])\n        ;\n\n        $request->method('isMethodSafe')->willReturn(false);\n        $request->method('getRequestFormat')->willReturn('html');\n\n        $request->attributes = $attributes;\n\n        $attributes->method('get')->with('form')->willReturn(null);\n\n        $attributes->expects($this->never())->method('set')->with('is_valid', $this->anything());\n\n        $this->validateProvider->provide($operation, $context);\n    }\n\n    /** @test */\n    public function it_validates_resource_on_non_html_format(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $data = $this->createMock(\\stdClass::class);\n        $constraintViolationList = $this->createMock(ConstraintViolationListInterface::class);\n\n        $request->expects($this->once())->method('getRequestFormat')->willReturn('json');\n\n        $operation = new Create();\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data)\n        ;\n\n        $request->attributes = $attributes;\n\n        $attributes->method('get')->with('form')->willReturn(null);\n\n        $this->validator->expects($this->once())\n            ->method('validate')\n            ->with($data, null, null)\n            ->willReturn($constraintViolationList)\n        ;\n\n        $constraintViolationList->expects($this->once())->method('count')->willReturn(0);\n\n        $this->validateProvider->provide($operation, $context);\n    }\n\n    /** @test */\n    public function it_validates_resource_with_validation_context_on_non_html_format(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $data = $this->createMock(\\stdClass::class);\n        $constraintViolationList = $this->createMock(ConstraintViolationListInterface::class);\n\n        $request->expects($this->once())->method('getRequestFormat')->willReturn('json');\n\n        $operation = new Create(validationContext: ['groups' => ['sylius']]);\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data)\n        ;\n\n        $request->attributes = $attributes;\n\n        $attributes->method('get')->with('form')->willReturn(null);\n\n        $this->validator->expects($this->once())\n            ->method('validate')\n            ->with($data, null, ['sylius'])\n            ->willReturn($constraintViolationList)\n        ;\n\n        $constraintViolationList->expects($this->once())->method('count')->willReturn(0);\n\n        $this->validateProvider->provide($operation, $context);\n    }\n\n    /** @test */\n    public function it_throws_an_exception_when_validating_resource_on_non_html_format(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $data = $this->createMock(\\stdClass::class);\n        $constraintViolation = $this->createMock(ConstraintViolationInterface::class);\n\n        $operation = new Create();\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data)\n        ;\n\n        $request->expects($this->once())->method('getRequestFormat')->willReturn('json');\n\n        $request->attributes = $attributes;\n\n        $attributes->expects($this->once())->method('get')->with('form')->willReturn(null);\n\n        $constraintViolation->method('getPropertyPath')->willReturn('property');\n        $constraintViolation->method('getMessage')->willReturn('Error message');\n        $constraintViolationList = new ConstraintViolationList([$constraintViolation]);\n\n        $this->validator->expects($this->once())\n            ->method('validate')\n            ->with($data, null, null)\n            ->willReturn($constraintViolationList)\n        ;\n\n        $this->expectException(ValidationException::class);\n\n        $this->validateProvider->provide($operation, $context);\n    }\n\n    /** @test */\n    public function it_does_nothing_if_operation_cannot_be_validated(): void\n    {\n        $request = $this->createMock(Request::class);\n        $form = $this->createMock(FormInterface::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $data = $this->createMock(\\stdClass::class);\n\n        $operation = new Create(validate: false);\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data)\n        ;\n\n        $request->expects($this->once())->method('getRequestFormat')->willReturn('html');\n        $request->expects($this->never())->method('isMethodSafe');\n\n        $request->attributes = $attributes;\n\n        $attributes->expects($this->once())->method('get')->with('form')->willReturn($form);\n\n        $form->expects($this->never())->method('isSubmitted');\n        $form->expects($this->never())->method('isValid');\n        $form->expects($this->never())->method('getData');\n\n        $attributes->expects($this->never())->method('set')->with('is_valid', true);\n\n        $result = $this->validateProvider->provide($operation, $context);\n\n        Assert::eq($result, $data);\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Translation/Provider/ImmutableTranslationLocaleProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Translation\\Provider;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Translation\\Provider\\ImmutableTranslationLocaleProvider;\nuse Sylius\\Component\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface as LegacyTranslationLocaleProviderInterface;\nuse Sylius\\Resource\\Translation\\Provider\\ImmutableTranslationLocaleProvider as NewImmutableTranslationLocaleProvider;\nuse Sylius\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface;\n\nfinal class ImmutableTranslationLocaleProviderTest extends TestCase\n{\n    private ImmutableTranslationLocaleProvider $provider;\n\n    protected function setUp(): void\n    {\n        $this->provider = new ImmutableTranslationLocaleProvider(['pl_PL', 'en_US'], 'pl_PL');\n    }\n\n    public function testItImplementsTranslationLocaleProviderInterface(): void\n    {\n        $this->assertInstanceOf(TranslationLocaleProviderInterface::class, $this->provider);\n    }\n\n    public function testItImplementsLegacyTranslationLocaleProviderInterface(): void\n    {\n        $this->assertInstanceOf(LegacyTranslationLocaleProviderInterface::class, $this->provider);\n    }\n\n    public function testItIsAnAliasOfImmutableTranslationLocaleProvider(): void\n    {\n        $this->assertInstanceOf(NewImmutableTranslationLocaleProvider::class, $this->provider);\n    }\n}\n"
  },
  {
    "path": "src/Component/legacy/tests/Translation/TranslatableEntityLocaleAssignerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\Tests\\Translation;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Translation\\TranslatableEntityLocaleAssigner;\nuse Sylius\\Component\\Resource\\Translation\\TranslatableEntityLocaleAssignerInterface as LegacyTranslatableEntityLocaleAssignerInterface;\nuse Sylius\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface;\nuse Sylius\\Resource\\Translation\\TranslatableEntityLocaleAssigner as NewTranslatableEntityLocaleAssigner;\nuse Sylius\\Resource\\Translation\\TranslatableEntityLocaleAssignerInterface;\n\nfinal class TranslatableEntityLocaleAssignerTest extends TestCase\n{\n    private TranslatableEntityLocaleAssigner $assigner;\n\n    protected function setUp(): void\n    {\n        $translationLocaleProvider = $this->createMock(TranslationLocaleProviderInterface::class);\n        $this->assigner = new TranslatableEntityLocaleAssigner($translationLocaleProvider);\n    }\n\n    public function testItImplementsTranslatableEntityLocaleAssignerInterface(): void\n    {\n        $this->assertInstanceOf(TranslatableEntityLocaleAssignerInterface::class, $this->assigner);\n    }\n\n    public function testItImplementsLegacyTranslatableEntityLocaleAssignerInterface(): void\n    {\n        $this->assertInstanceOf(LegacyTranslatableEntityLocaleAssignerInterface::class, $this->assigner);\n    }\n\n    public function testItIsAnAliasOfTranslatableEntityLocalAssigner(): void\n    {\n        $this->assertInstanceOf(NewTranslatableEntityLocaleAssigner::class, $this->assigner);\n    }\n}\n"
  },
  {
    "path": "src/Component/phpunit.xml.dist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<phpunit xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:noNamespaceSchemaLocation=\"https://schema.phpunit.de/9.4/phpunit.xsd\"\n         colors=\"true\"\n>\n    <testsuites>\n        <testsuite name=\"SyliusResource Test Suite\">\n            <directory>./legacy/tests/</directory>\n        </testsuite>\n    </testsuites>\n</phpunit>\n"
  },
  {
    "path": "src/Component/src/Annotation/SyliusCrudRoutes.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Annotation;\n\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class SyliusCrudRoutes\n{\n    public ?string $alias = null;\n\n    public ?string $path = null;\n\n    public ?string $identifier = null;\n\n    public ?array $criteria = null;\n\n    public ?bool $filterable = null;\n\n    public ?string $form = null;\n\n    public ?string $serializationVersion = null;\n\n    public ?string $section = null;\n\n    public ?string $redirect = null;\n\n    public ?string $templates = null;\n\n    public ?string $grid = null;\n\n    public ?bool $permission = null;\n\n    public ?array $except = null;\n\n    public ?array $only = null;\n\n    public ?array $vars = null;\n\n    public function __construct(\n        ?string $alias = null,\n        ?string $path = null,\n        ?string $identifier = null,\n        ?array $criteria = null,\n        ?bool $filterable = null,\n        ?string $form = null,\n        ?string $serializationVersion = null,\n        ?string $section = null,\n        ?string $redirect = null,\n        ?string $templates = null,\n        ?string $grid = null,\n        ?bool $permission = null,\n        ?array $except = null,\n        ?array $only = null,\n        ?array $vars = null,\n    ) {\n        $this->alias = $alias;\n        $this->path = $path;\n        $this->identifier = $identifier;\n        $this->criteria = $criteria;\n        $this->filterable = $filterable;\n        $this->form = $form;\n        $this->serializationVersion = $serializationVersion;\n        $this->section = $section;\n        $this->redirect = $redirect;\n        $this->templates = $templates;\n        $this->grid = $grid;\n        $this->permission = $permission;\n        $this->except = $except;\n        $this->only = $only;\n        $this->vars = $vars;\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Annotation\\SyliusCrudRoutes::class, false)) {\n    class_alias(SyliusCrudRoutes::class, \\Sylius\\Component\\Resource\\Annotation\\SyliusCrudRoutes::class);\n}\n"
  },
  {
    "path": "src/Component/src/Annotation/SyliusRoute.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Annotation;\n\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class SyliusRoute\n{\n    public function __construct(\n        public ?string $name = null,\n        public ?string $path = null,\n        public ?array $methods = null,\n        public ?string $controller = null,\n        public ?string $template = null,\n        public ?array $repository = null,\n        public ?array $criteria = null,\n        public ?array $serializationGroups = null,\n        public ?string $serializationVersion = null,\n        public ?array $requirements = null,\n        public ?array $options = null,\n        public ?string $host = null,\n        public ?array $schemes = null,\n        public ?int $priority = null,\n        public ?array $vars = null,\n        public string | array | null $form = null,\n        public ?string $section = null,\n        public ?bool $permission = null,\n        public ?string $grid = null,\n        public ?bool $csrfProtection = null,\n        public string | array | null $redirect = null,\n        public ?array $stateMachine = null,\n        public ?string $event = null,\n        public ?bool $returnContent = null,\n    ) {\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Annotation\\SyliusRoute::class, false)) {\n    class_alias(SyliusRoute::class, \\Sylius\\Component\\Resource\\Annotation\\SyliusRoute::class);\n}\n"
  },
  {
    "path": "src/Component/src/Context/Context.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Context;\n\n/**\n * @implements \\IteratorAggregate<object>\n */\nfinal class Context implements \\IteratorAggregate\n{\n    /** @var array<class-string, object> */\n    private array $optionMap;\n\n    public function __construct(object ...$options)\n    {\n        $map = [];\n        foreach ($options as $option) {\n            $map[get_class($option)] = $option;\n        }\n\n        $this->optionMap = $map;\n    }\n\n    public function with(object ...$options): self\n    {\n        /** @psalm-suppress DuplicateArrayKey */\n        return new self(...[\n            ...array_values($this->optionMap),\n            ...$options,\n        ]);\n    }\n\n    /**\n     * @param class-string $optionClasses\n     */\n    public function without(string ...$optionClasses): self\n    {\n        $optionMap = $this->optionMap;\n\n        foreach ($optionClasses as $optionClass) {\n            unset($optionMap[$optionClass]);\n        }\n\n        return new self(...array_values($optionMap));\n    }\n\n    /**\n     * @template T of object\n     *\n     * @param class-string<T> $optionClass\n     *\n     * @return T|null\n     */\n    public function get(string $optionClass): ?object\n    {\n        /** @var T $option */\n        $option = $this->optionMap[$optionClass] ?? null;\n\n        return $option;\n    }\n\n    /**\n     * @return \\Traversable<object>\n     */\n    public function getIterator(): \\Traversable\n    {\n        yield from array_values($this->optionMap);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Context/Initiator/RequestContextInitiator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Context\\Initiator;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class RequestContextInitiator implements RequestContextInitiatorInterface\n{\n    public function initializeContext(Request $request): Context\n    {\n        return new Context(new RequestOption($request));\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Context/Initiator/RequestContextInitiatorInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Context\\Initiator;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\ninterface RequestContextInitiatorInterface\n{\n    public function initializeContext(Request $request): Context;\n}\n"
  },
  {
    "path": "src/Component/src/Context/Option/MetadataOption.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Context\\Option;\n\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\n\nfinal class MetadataOption\n{\n    public function __construct(private MetadataInterface $metadata)\n    {\n    }\n\n    public function metadata(): MetadataInterface\n    {\n        return $this->metadata;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Context/Option/RequestOption.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Context\\Option;\n\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class RequestOption\n{\n    public function __construct(private Request $request)\n    {\n    }\n\n    public function request(): Request\n    {\n        return $this->request;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Context/Option/ResourceClassOption.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Context\\Option;\n\nfinal class ResourceClassOption\n{\n    /** @param class-string $resourceClass */\n    public function __construct(private string $resourceClass)\n    {\n    }\n\n    /** @return class-string */\n    public function resourceClass(): string\n    {\n        return $this->resourceClass;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Doctrine/Common/Metadata/Resource/Factory/DoctrineResourceMetadataCollectionFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Doctrine\\Common\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Doctrine\\Common\\State\\PersistProcessor;\nuse Sylius\\Resource\\Doctrine\\Common\\State\\RemoveProcessor;\nuse Sylius\\Resource\\Metadata\\DeleteOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nfinal class DoctrineResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface\n{\n    public function __construct(\n        private RegistryInterface $resourceRegistry,\n        private ResourceMetadataCollectionFactoryInterface $decorated,\n    ) {\n    }\n\n    public function create(string $resourceClass): ResourceMetadataCollection\n    {\n        $resourceCollectionMetadata = $this->decorated->create($resourceClass);\n\n        /** @var ResourceMetadata $resource */\n        foreach ($resourceCollectionMetadata->getIterator() as $i => $resource) {\n            $operations = $resource->getOperations() ?? new Operations();\n\n            /** @var Operation $operation */\n            foreach ($operations as $operation) {\n                /** @var string $key */\n                $key = $operation->getName();\n\n                $operations->add($key, $this->addDefaults($resource, $operation));\n            }\n\n            $resource = $resource->withOperations($operations);\n\n            $resourceCollectionMetadata[$i] = $resource;\n        }\n\n        return $resourceCollectionMetadata;\n    }\n\n    private function addDefaults(ResourceMetadata $resource, Operation $operation): Operation\n    {\n        $metadata = $this->resourceRegistry->get($resource->getAlias() ?? '');\n        $driver = $metadata->getDriver();\n\n        if ($driver && str_starts_with($driver, 'doctrine/')) {\n            $operation = $operation->withProcessor($this->getProcessor($operation));\n        }\n\n        return $operation;\n    }\n\n    private function getProcessor(Operation $operation): callable|string\n    {\n        if (null !== $processor = $operation->getProcessor()) {\n            return $processor;\n        }\n\n        if ($operation instanceof DeleteOperationInterface) {\n            return RemoveProcessor::class;\n        }\n\n        return PersistProcessor::class;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Doctrine/Common/State/PersistProcessor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Doctrine\\Common\\State;\n\nuse Doctrine\\ORM\\Mapping\\ClassMetadata;\nuse Doctrine\\Persistence\\ManagerRegistry;\nuse Doctrine\\Persistence\\ObjectManager as DoctrineObjectManager;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Reflection\\ClassInfoTrait;\nuse Sylius\\Resource\\State\\ProcessorInterface;\n\nfinal class PersistProcessor implements ProcessorInterface\n{\n    use ClassInfoTrait;\n\n    public function __construct(private ManagerRegistry $managerRegistry)\n    {\n    }\n\n    public function process(mixed $data, Operation $operation, Context $context): mixed\n    {\n        if (!is_object($data) || !$manager = $this->getManager($data)) {\n            return $data;\n        }\n\n        if (!$manager->contains($data) || $this->isDeferredExplicit($manager, $data)) {\n            $manager->persist($data);\n        }\n\n        $manager->flush();\n        $manager->refresh($data);\n\n        return $data;\n    }\n\n    /**\n     * Gets the Doctrine object manager associated with given data.\n     */\n    private function getManager(object $data): ?DoctrineObjectManager\n    {\n        return $this->managerRegistry->getManagerForClass($this->getObjectClass($data));\n    }\n\n    /**\n     * Checks if doctrine does not manage data automatically.\n     */\n    private function isDeferredExplicit(DoctrineObjectManager $manager, object $data): bool\n    {\n        $classMetadata = $manager->getClassMetadata($this->getObjectClass($data));\n        if ($classMetadata instanceof ClassMetadata && method_exists($classMetadata, 'isChangeTrackingDeferredExplicit')) {\n            return $classMetadata->isChangeTrackingDeferredExplicit();\n        }\n\n        return false;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Doctrine/Common/State/RemoveProcessor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Doctrine\\Common\\State;\n\nuse Doctrine\\DBAL\\Exception\\ForeignKeyConstraintViolationException;\nuse Doctrine\\Persistence\\ManagerRegistry;\nuse Doctrine\\Persistence\\ObjectManager as DoctrineObjectManager;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Exception\\DeleteResourceException;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Reflection\\ClassInfoTrait;\nuse Sylius\\Resource\\State\\ProcessorInterface;\n\nfinal class RemoveProcessor implements ProcessorInterface\n{\n    use ClassInfoTrait;\n\n    public function __construct(private ManagerRegistry $managerRegistry)\n    {\n    }\n\n    public function process(mixed $data, Operation $operation, Context $context): mixed\n    {\n        if (!\\is_object($data) || !$manager = $this->getManager($data)) {\n            return null;\n        }\n\n        try {\n            $manager->remove($data);\n            $manager->flush();\n        } catch (ForeignKeyConstraintViolationException) {\n            throw new DeleteResourceException();\n        }\n\n        return $data;\n    }\n\n    /**\n     * Gets the Doctrine object manager associated with given data.\n     */\n    private function getManager(object $data): ?DoctrineObjectManager\n    {\n        return $this->managerRegistry->getManagerForClass($this->getObjectClass($data));\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Doctrine/Persistence/Exception/ExceptionInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Doctrine\\Persistence\\Exception;\n\nuse Sylius\\Resource\\Exception\\ExceptionInterface as BaseExceptionInterface;\n\ninterface ExceptionInterface extends BaseExceptionInterface\n{\n}\n"
  },
  {
    "path": "src/Component/src/Doctrine/Persistence/Exception/ResourceExistsException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Doctrine\\Persistence\\Exception;\n\nclass ResourceExistsException extends \\RuntimeException implements ExceptionInterface\n{\n    public function __construct()\n    {\n        parent::__construct('Given resource already exists in the repository.');\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Repository\\Exception\\ExistingResourceException::class, false)) {\n    class_alias(ResourceExistsException::class, \\Sylius\\Component\\Resource\\Repository\\Exception\\ExistingResourceException::class);\n}\n"
  },
  {
    "path": "src/Component/src/Doctrine/Persistence/InMemoryRepository.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Doctrine\\Persistence;\n\nuse Pagerfanta\\Adapter\\ArrayAdapter;\nuse Pagerfanta\\Pagerfanta;\nuse Pagerfanta\\PagerfantaInterface;\nuse Sylius\\Component\\Resource\\Exception\\UnexpectedTypeException;\nuse Sylius\\Resource\\Doctrine\\Persistence\\Exception\\ResourceExistsException;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\PropertyAccess\\PropertyAccess;\nuse Symfony\\Component\\PropertyAccess\\PropertyAccessor;\nuse Webmozart\\Assert\\Assert;\n\nclass InMemoryRepository implements RepositoryInterface\n{\n    protected PropertyAccessor $accessor;\n\n    protected \\ArrayObject $arrayObject;\n\n    /** @psalm-var class-string */\n    protected $interface;\n\n    /**\n     * @psalm-param class-string $interface\n     *\n     * @throws \\InvalidArgumentException\n     * @throws UnexpectedTypeException\n     */\n    public function __construct(string $interface)\n    {\n        /** @var array $interfaceInterfaces */\n        $interfaceInterfaces = class_implements($interface);\n\n        if (!in_array(ResourceInterface::class, $interfaceInterfaces, true)) {\n            throw new UnexpectedTypeException($interface, ResourceInterface::class);\n        }\n\n        $this->interface = $interface;\n        $this->accessor = PropertyAccess::createPropertyAccessor();\n        $this->arrayObject = new \\ArrayObject();\n    }\n\n    /**\n     * @throws ResourceExistsException\n     * @throws UnexpectedTypeException\n     */\n    public function add(ResourceInterface $resource): void\n    {\n        if (!$resource instanceof $this->interface) {\n            throw new UnexpectedTypeException($resource, $this->interface);\n        }\n\n        if (in_array($resource, $this->findAll(), true)) {\n            throw new ResourceExistsException();\n        }\n\n        $this->arrayObject->append($resource);\n    }\n\n    public function remove(ResourceInterface $resource): void\n    {\n        $newResources = array_filter($this->findAll(), static function ($object) use ($resource) {\n            return $object !== $resource;\n        });\n\n        $this->arrayObject->exchangeArray($newResources);\n    }\n\n    public function find($id): ?object\n    {\n        return $this->findOneBy(['id' => $id]);\n    }\n\n    public function findAll(): array\n    {\n        $arrayCopy = $this->arrayObject->getArrayCopy();\n\n        Assert::allObject($arrayCopy);\n\n        return $arrayCopy;\n    }\n\n    public function findBy(array $criteria, ?array $orderBy = null, $limit = null, $offset = null): array\n    {\n        $results = $this->findAll();\n\n        if (!empty($criteria)) {\n            $results = $this->applyCriteria($results, $criteria);\n        }\n\n        if (!empty($orderBy)) {\n            $results = $this->applyOrder($results, $orderBy);\n        }\n\n        return array_slice($results, $offset ?? 0, $limit);\n    }\n\n    /**\n     * @throws \\InvalidArgumentException\n     */\n    public function findOneBy(array $criteria): ?ResourceInterface\n    {\n        if (empty($criteria)) {\n            throw new \\InvalidArgumentException('The criteria array needs to be set.');\n        }\n\n        $results = $this->applyCriteria($this->findAll(), $criteria);\n\n        /** @var ResourceInterface|false $result */\n        $result = reset($results);\n        if ($result !== false) {\n            return $result;\n        }\n\n        return null;\n    }\n\n    public function getClassName(): string\n    {\n        return $this->interface;\n    }\n\n    /**\n     * @return PagerfantaInterface\n     */\n    public function createPaginator(array $criteria = [], array $sorting = []): iterable\n    {\n        $resources = $this->findAll();\n\n        if (!empty($sorting)) {\n            $resources = $this->applyOrder($resources, $sorting);\n        }\n\n        if (!empty($criteria)) {\n            $resources = $this->applyCriteria($resources, $criteria);\n        }\n\n        return new Pagerfanta(new ArrayAdapter($resources));\n    }\n\n    /**\n     * @param object[] $resources\n     *\n     * @return object[]|array\n     */\n    private function applyCriteria(array $resources, array $criteria): array\n    {\n        /** @var array|object $object */\n        foreach ($this->arrayObject as $object) {\n            foreach ($criteria as $criterion => $value) {\n                if ($value !== $this->accessor->getValue($object, $criterion)) {\n                    $key = array_search($object, $resources);\n                    unset($resources[$key]);\n                }\n            }\n        }\n\n        return $resources;\n    }\n\n    /**\n     * @param object[] $resources\n     *\n     * @return object[]\n     */\n    private function applyOrder(array $resources, array $orderBy): array\n    {\n        $results = $resources;\n\n        $arguments = [];\n        foreach ($orderBy as $property => $order) {\n            $sortable = [];\n\n            foreach ($results as $key => $object) {\n                $sortable[$key] = $this->accessor->getValue($object, $property);\n            }\n\n            $arguments[] = $sortable;\n\n            if (RepositoryInterface::ORDER_ASCENDING === $order) {\n                $arguments[] = \\SORT_ASC;\n            } elseif (RepositoryInterface::ORDER_DESCENDING === $order) {\n                $arguments[] = \\SORT_DESC;\n            } else {\n                throw new \\InvalidArgumentException('Unknown order.');\n            }\n        }\n\n        $arguments[] = &$results;\n\n        /**\n         * Doing PHP magic, it works this way\n         *\n         * @psalm-suppress InvalidPassByReference\n         * @psalm-suppress PossiblyInvalidArgument\n         */\n        array_multisort(...$arguments);\n\n        return $results;\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Repository\\InMemoryRepository::class, false)) {\n    class_alias(InMemoryRepository::class, \\Sylius\\Component\\Resource\\Repository\\InMemoryRepository::class);\n}\n"
  },
  {
    "path": "src/Component/src/Doctrine/Persistence/RepositoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Doctrine\\Persistence;\n\nuse Doctrine\\Persistence\\ObjectRepository;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\n/**\n * @template T of ResourceInterface\n * @extends ObjectRepository<T>\n */\ninterface RepositoryInterface extends ObjectRepository\n{\n    public const ORDER_ASCENDING = 'ASC';\n\n    public const ORDER_DESCENDING = 'DESC';\n\n    /**\n     * @param array<string, mixed> $criteria\n     * @param array<string, string> $sorting\n     *\n     * @return iterable<T>\n     */\n    public function createPaginator(array $criteria = [], array $sorting = []): iterable;\n\n    public function add(ResourceInterface $resource): void;\n\n    public function remove(ResourceInterface $resource): void;\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Repository\\RepositoryInterface::class, false)) {\n    class_alias(RepositoryInterface::class, \\Sylius\\Component\\Resource\\Repository\\RepositoryInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Exception/DeleteHandlingException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Exception;\n\nclass DeleteHandlingException extends RuntimeException\n{\n    protected string $flash;\n\n    protected int $apiResponseCode;\n\n    public function __construct(\n        string $message = 'Ups, something went wrong during deleting a resource, please try again.',\n        string $flash = 'something_went_wrong_error',\n        int $apiResponseCode = 500,\n        int $code = 0,\n        ?\\Throwable $previous = null,\n    ) {\n        parent::__construct($message, $code, $previous);\n\n        $this->flash = $flash;\n        $this->apiResponseCode = $apiResponseCode;\n    }\n\n    public function getFlash(): string\n    {\n        return $this->flash;\n    }\n\n    public function getApiResponseCode(): int\n    {\n        return $this->apiResponseCode;\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Exception\\DeleteHandlingException::class, false)) {\n    class_alias(DeleteHandlingException::class, \\Sylius\\Component\\Resource\\Exception\\DeleteHandlingException::class);\n}\n"
  },
  {
    "path": "src/Component/src/Exception/DeleteResourceException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Exception;\n\nclass DeleteResourceException extends WriteResourceException\n{\n    public function __construct(\n        ?string $resourceName = null,\n        string $message = '',\n        int $code = 0,\n        ?\\Throwable $previous = null,\n    ) {\n        if (empty($message)) {\n            $message = sprintf('Cannot delete, the %s is in use.', $resourceName ?? 'resource');\n        }\n\n        parent::__construct($resourceName, $message, $code, $previous);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Exception/Exception.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Exception;\n\nclass Exception extends \\Exception implements ExceptionInterface\n{\n}\n"
  },
  {
    "path": "src/Component/src/Exception/ExceptionInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Exception;\n\ninterface ExceptionInterface extends \\Throwable\n{\n}\n"
  },
  {
    "path": "src/Component/src/Exception/InvalidArgumentException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Exception;\n\nclass InvalidArgumentException extends \\InvalidArgumentException implements ExceptionInterface\n{\n}\n"
  },
  {
    "path": "src/Component/src/Exception/LogicException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Exception;\n\nclass LogicException extends \\LogicException implements ExceptionInterface\n{\n}\n"
  },
  {
    "path": "src/Component/src/Exception/RaceConditionException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Exception;\n\nclass RaceConditionException extends UpdateHandlingException\n{\n    public function __construct(?\\Exception $previous = null)\n    {\n        parent::__construct(\n            'Operated entity was previously modified.',\n            'race_condition_error',\n            409,\n            null !== $previous ? (int) $previous->getCode() : 0,\n            $previous,\n        );\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Exception\\RaceConditionException::class, false)) {\n    class_alias(RaceConditionException::class, \\Sylius\\Component\\Resource\\Exception\\RaceConditionException::class);\n}\n"
  },
  {
    "path": "src/Component/src/Exception/RuntimeException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Exception;\n\nclass RuntimeException extends \\RuntimeException implements ExceptionInterface\n{\n}\n"
  },
  {
    "path": "src/Component/src/Exception/StorageUnavailableException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Exception;\n\nclass StorageUnavailableException extends RuntimeException\n{\n    public function __construct(string $message = '', ?\\Exception $previous = null)\n    {\n        parent::__construct($message, 0, $previous);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Exception/UnexpectedTypeException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Exception;\n\nclass UnexpectedTypeException extends InvalidArgumentException\n{\n    /**\n     * @param mixed $value\n     */\n    public function __construct($value, string $expectedType)\n    {\n        parent::__construct(sprintf(\n            'Expected argument of type \"%s\", \"%s\" given.',\n            $expectedType,\n            get_debug_type($value),\n        ));\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Exception\\UnexpectedTypeException::class, false)) {\n    class_alias(UnexpectedTypeException::class, \\Sylius\\Component\\Resource\\Exception\\UnexpectedTypeException::class);\n}\n"
  },
  {
    "path": "src/Component/src/Exception/UnsupportedMethodException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Exception;\n\nclass UnsupportedMethodException extends Exception\n{\n    public function __construct(string $methodName)\n    {\n        parent::__construct(sprintf(\n            'The method \"%s\" is not supported.',\n            $methodName,\n        ));\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Exception\\UnsupportedMethodException::class, false)) {\n    class_alias(UnsupportedMethodException::class, \\Sylius\\Component\\Resource\\Exception\\UnsupportedMethodException::class);\n}\n"
  },
  {
    "path": "src/Component/src/Exception/UpdateHandlingException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Exception;\n\nclass UpdateHandlingException extends Exception\n{\n    protected string $flash;\n\n    protected int $apiResponseCode;\n\n    public function __construct(\n        string $message = 'Ups, something went wrong during updating a resource, please try again.',\n        string $flash = 'something_went_wrong_error',\n        int $apiResponseCode = 400,\n        int $code = 0,\n        ?\\Exception $previous = null,\n    ) {\n        parent::__construct($message, $code, $previous);\n\n        $this->flash = $flash;\n        $this->apiResponseCode = $apiResponseCode;\n    }\n\n    public function getFlash(): string\n    {\n        return $this->flash;\n    }\n\n    public function getApiResponseCode(): int\n    {\n        return $this->apiResponseCode;\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Exception\\UpdateHandlingException::class, false)) {\n    class_alias(UpdateHandlingException::class, \\Sylius\\Component\\Resource\\Exception\\UpdateHandlingException::class);\n}\n"
  },
  {
    "path": "src/Component/src/Exception/VariantWithNoOptionsValuesException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Exception;\n\ntrigger_deprecation(\n    'sylius/resource-bundle',\n    '1.13',\n    'The \"%s\" class is deprecated and will be removed in 2.0.',\n    VariantWithNoOptionsValuesException::class,\n);\n\n/** @deprecated since SyliusResourceBundle 1.13 and will be removed in 2.0. */\nfinal class VariantWithNoOptionsValuesException extends Exception\n{\n    public function __construct()\n    {\n        parent::__construct('sylius.product_variant.cannot_generate_variants');\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Exception\\VariantWithNoOptionsValuesException::class, false)) {\n    class_alias(VariantWithNoOptionsValuesException::class, \\Sylius\\Component\\Resource\\Exception\\VariantWithNoOptionsValuesException::class);\n}\n"
  },
  {
    "path": "src/Component/src/Exception/WriteResourceException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Exception;\n\nclass WriteResourceException extends RuntimeException\n{\n    public function __construct(\n        private readonly ?string $resourceName = null,\n        string $message = '',\n        int $code = 0,\n        ?\\Throwable $previous = null,\n    ) {\n        parent::__construct($message, $code, $previous);\n    }\n\n    public function getResourceName(): ?string\n    {\n        return $this->resourceName;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Factory/Factory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Factory;\n\n/**\n * Creates resources based on theirs FQCN.\n */\nfinal class Factory implements FactoryInterface\n{\n    /** @var class-string */\n    private $className;\n\n    /**\n     * @param class-string $className\n     */\n    public function __construct(string $className)\n    {\n        $this->className = $className;\n    }\n\n    public function createNew()\n    {\n        return new $this->className();\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Factory\\Factory::class, false)) {\n    class_alias(Factory::class, \\Sylius\\Component\\Resource\\Factory\\Factory::class);\n}\n"
  },
  {
    "path": "src/Component/src/Factory/FactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Factory;\n\n/**\n * @template T of object\n */\ninterface FactoryInterface\n{\n    /**\n     * @return T\n     */\n    public function createNew();\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Factory\\FactoryInterface::class, false)) {\n    class_alias(FactoryInterface::class, \\Sylius\\Component\\Resource\\Factory\\FactoryInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Factory/TranslatableFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Factory;\n\nuse Sylius\\Resource\\Exception\\UnexpectedTypeException;\nuse Sylius\\Resource\\Model\\TranslatableInterface;\nuse Sylius\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface;\n\nfinal class TranslatableFactory implements TranslatableFactoryInterface\n{\n    private FactoryInterface $factory;\n\n    private TranslationLocaleProviderInterface $localeProvider;\n\n    public function __construct(FactoryInterface $factory, TranslationLocaleProviderInterface $localeProvider)\n    {\n        $this->factory = $factory;\n        $this->localeProvider = $localeProvider;\n    }\n\n    /**\n     * @throws UnexpectedTypeException\n     */\n    public function createNew()\n    {\n        $resource = $this->factory->createNew();\n\n        if (!$resource instanceof TranslatableInterface) {\n            throw new UnexpectedTypeException($resource, TranslatableInterface::class);\n        }\n\n        $resource->setCurrentLocale($this->localeProvider->getDefaultLocaleCode());\n        $resource->setFallbackLocale($this->localeProvider->getDefaultLocaleCode());\n\n        return $resource;\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Factory\\TranslatableFactory::class, false)) {\n    class_alias(TranslatableFactory::class, \\Sylius\\Component\\Resource\\Factory\\TranslatableFactory::class);\n}\n"
  },
  {
    "path": "src/Component/src/Factory/TranslatableFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Factory;\n\n/**\n * @template T of object\n */\ninterface TranslatableFactoryInterface extends FactoryInterface\n{\n    /**\n     * @return T\n     */\n    public function createNew();\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Factory\\TranslatableFactoryInterface::class, false)) {\n    class_alias(TranslatableFactoryInterface::class, \\Sylius\\Component\\Resource\\Factory\\TranslatableFactoryInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Generator/RandomnessGenerator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Generator;\n\nuse Webmozart\\Assert\\Assert;\n\nfinal class RandomnessGenerator implements RandomnessGeneratorInterface\n{\n    private string $uriSafeAlphabet;\n\n    private string $digits;\n\n    public function __construct()\n    {\n        $this->digits = implode(range(0, 9));\n\n        $this->uriSafeAlphabet =\n            implode(range(0, 9))\n            . implode(range('a', 'z'))\n            . implode(range('A', 'Z'))\n            . implode(['-', '_', '~'])\n        ;\n    }\n\n    public function generateUriSafeString(int $length): string\n    {\n        return $this->generateStringOfLength($length, $this->uriSafeAlphabet);\n    }\n\n    public function generateNumeric(int $length): string\n    {\n        return $this->generateStringOfLength($length, $this->digits);\n    }\n\n    public function generateInt(int $min, int $max): int\n    {\n        return random_int($min, $max);\n    }\n\n    private function generateStringOfLength(int $length, string $alphabet): string\n    {\n        $alphabetMaxIndex = strlen($alphabet) - 1;\n\n        Assert::greaterThanEq($alphabetMaxIndex, 1);\n\n        $randomString = '';\n\n        for ($i = 0; $i < $length; ++$i) {\n            $index = random_int(0, $alphabetMaxIndex);\n            $randomString .= $alphabet[$index];\n        }\n\n        return $randomString;\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Generator\\RandomnessGenerator::class, false)) {\n    class_alias(RandomnessGenerator::class, \\Sylius\\Component\\Resource\\Generator\\RandomnessGenerator::class);\n}\n"
  },
  {
    "path": "src/Component/src/Generator/RandomnessGeneratorInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Generator;\n\ninterface RandomnessGeneratorInterface\n{\n    public function generateUriSafeString(int $length): string;\n\n    public function generateNumeric(int $length): string;\n\n    public function generateInt(int $min, int $max): int;\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Generator\\RandomnessGeneratorInterface::class, false)) {\n    class_alias(RandomnessGeneratorInterface::class, \\Sylius\\Component\\Resource\\Generator\\RandomnessGeneratorInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Grid/State/RequestGridProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Grid\\State;\n\nuse Pagerfanta\\Pagerfanta;\nuse Sylius\\Component\\Grid\\Parameters;\nuse Sylius\\Component\\Grid\\Provider\\GridProviderInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Grid\\View\\Factory\\GridViewFactoryInterface;\nuse Sylius\\Resource\\Metadata\\GridAwareOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ProviderInterface;\n\nfinal class RequestGridProvider implements ProviderInterface\n{\n    private const DEFAULT_MAX_PER_PAGE = 10;\n\n    public function __construct(\n        private ?GridViewFactoryInterface $gridViewFactory = null,\n        private ?GridProviderInterface $gridProvider = null,\n    ) {\n    }\n\n    public function provide(Operation $operation, Context $context): object|array|null\n    {\n        if (null === $this->gridViewFactory || null === $this->gridProvider) {\n            throw new \\LogicException('You can not use a grid if Sylius Grid Bundle is not available. Try running \"composer require sylius/grid-bundle\".');\n        }\n\n        if (!$operation instanceof GridAwareOperationInterface) {\n            throw new \\LogicException(sprintf('You can not use a grid if your operation does not implement \"%s\".', GridAwareOperationInterface::class));\n        }\n\n        $grid = $operation->getGrid();\n\n        if (null === $grid) {\n            throw new \\RuntimeException(sprintf('Operation has no grid, so you cannot use this provider for operation \"%s\"', $operation->getName() ?? ''));\n        }\n\n        $request = $context->get(RequestOption::class)?->request();\n\n        if (null === $request) {\n            return null;\n        }\n\n        $gridDefinition = $this->gridProvider->get($grid);\n        $gridConfiguration = $gridDefinition->getDriverConfiguration();\n\n        $parameters = $request->query->all();\n        $gridView = $this->gridViewFactory->create($gridDefinition, $context, new Parameters($parameters), $gridConfiguration);\n\n        $data = $gridView->getData();\n\n        if ($data instanceof Pagerfanta) {\n            $currentPage = $request->query->getInt('page', 1);\n            $data->setCurrentPage($currentPage);\n\n            $maxPerPage = $this->resolveMaxPerPage(\n                $request->query->has('limit') ? $request->query->getInt('limit') : null,\n                $gridDefinition->getLimits(),\n            );\n            $data->setMaxPerPage($maxPerPage);\n        }\n\n        return $gridView;\n    }\n\n    private function resolveMaxPerPage(?int $requestLimit, array $gridLimits = []): int\n    {\n        if (null === $requestLimit) {\n            $firstGridLimit = reset($gridLimits);\n\n            return false === $firstGridLimit ? self::DEFAULT_MAX_PER_PAGE : $firstGridLimit;\n        }\n\n        if (!empty($gridLimits)) {\n            $maxGridLimit = max($gridLimits);\n\n            // Cannot retrieve more items than configured in the grid\n            return min($requestLimit, $maxGridLimit);\n        }\n\n        return $requestLimit;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Grid/View/Factory/GridViewFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Grid\\View\\Factory;\n\nuse Sylius\\Component\\Grid\\Data\\DataProviderInterface;\nuse Sylius\\Component\\Grid\\Definition\\Grid;\nuse Sylius\\Component\\Grid\\Parameters;\nuse Sylius\\Component\\Grid\\View\\GridView;\nuse Sylius\\Resource\\Context\\Context;\n\nfinal class GridViewFactory implements GridViewFactoryInterface\n{\n    public function __construct(\n        private DataProviderInterface $dataProvider,\n    ) {\n    }\n\n    public function create(Grid $grid, Context $context, Parameters $parameters, array $driverConfiguration): GridView\n    {\n        return new GridView($this->dataProvider->getData($grid, $parameters), $grid, $parameters);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Grid/View/Factory/GridViewFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Grid\\View\\Factory;\n\nuse Sylius\\Component\\Grid\\Definition\\Grid;\nuse Sylius\\Component\\Grid\\Parameters;\nuse Sylius\\Component\\Grid\\View\\GridView;\nuse Sylius\\Resource\\Context\\Context;\n\ninterface GridViewFactoryInterface\n{\n    public function create(Grid $grid, Context $context, Parameters $parameters, array $driverConfiguration): GridView;\n}\n"
  },
  {
    "path": "src/Component/src/Humanizer/StringHumanizer.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Humanizer;\n\nfinal class StringHumanizer\n{\n    public static function humanize(string $subject): string\n    {\n        return strtolower(trim((string) preg_replace(['/([A-Z])/', '/[_\\s]+/'], ['_$1', ' '], $subject)));\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Api/ApiOperationInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Api;\n\n/**\n * @experimental\n */\ninterface ApiOperationInterface\n{\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Api/Delete.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Api;\n\nuse Sylius\\Resource\\Metadata\\DeleteOperationInterface;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\n\n/**\n * @experimental\n */\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class Delete extends HttpOperation implements DeleteOperationInterface, ApiOperationInterface\n{\n    public function __construct(\n        ?string $path = null,\n        ?string $routeName = null,\n        ?string $routePrefix = null,\n        ?array $routeRequirements = null,\n        ?string $routeCondition = null,\n        ?int $routePriority = null,\n        ?string $template = null,\n        ?string $shortName = null,\n        ?string $name = null,\n        string|callable|null $provider = null,\n        string|callable|null $processor = null,\n        string|callable|null $responder = null,\n        string|callable|null $repository = null,\n        ?string $repositoryMethod = null,\n        ?array $repositoryArguments = null,\n        ?bool $read = null,\n        ?bool $write = null,\n        ?bool $validate = null,\n        ?bool $deserialize = null,\n        ?bool $serialize = null,\n        ?string $formType = null,\n        ?array $formOptions = null,\n        ?array $normalizationContext = null,\n        ?array $denormalizationContext = null,\n        ?array $validationContext = null,\n        ?string $eventShortName = null,\n        ?string $notificationMessage = null,\n        string|\\Stringable|null $security = null,\n        ?string $securityMessage = null,\n        ?string $redirectToRoute = null,\n    ) {\n        parent::__construct(\n            methods: ['DELETE'],\n            path: $path,\n            routeName: $routeName,\n            routePrefix: $routePrefix,\n            routeRequirements: $routeRequirements,\n            routeCondition: $routeCondition,\n            routePriority: $routePriority,\n            template: $template,\n            shortName: $shortName ?? 'delete',\n            name: $name,\n            provider: $provider,\n            processor: $processor,\n            responder: $responder,\n            repository: $repository,\n            repositoryMethod: $repositoryMethod,\n            repositoryArguments: $repositoryArguments,\n            read: $read,\n            write: $write,\n            validate: $validate,\n            deserialize: $deserialize,\n            serialize: $serialize,\n            formType: $formType,\n            formOptions: $formOptions,\n            normalizationContext: $normalizationContext,\n            denormalizationContext: $denormalizationContext,\n            validationContext: $validationContext,\n            eventShortName: $eventShortName,\n            notificationMessage: $notificationMessage,\n            security: $security,\n            securityMessage: $securityMessage,\n            redirectToRoute: $redirectToRoute,\n        );\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Api/Get.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Api;\n\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\ShowOperationInterface;\n\n/**\n * @experimental\n */\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class Get extends HttpOperation implements ShowOperationInterface, ApiOperationInterface\n{\n    public function __construct(\n        ?string $path = null,\n        ?string $routeName = null,\n        ?string $routePrefix = null,\n        ?array $routeRequirements = null,\n        ?string $routeCondition = null,\n        ?int $routePriority = null,\n        ?string $template = null,\n        ?string $shortName = null,\n        ?string $name = null,\n        string|callable|null $provider = null,\n        string|callable|null $processor = null,\n        string|callable|null $responder = null,\n        string|callable|null $repository = null,\n        ?string $repositoryMethod = null,\n        ?array $repositoryArguments = null,\n        ?bool $read = null,\n        ?bool $write = null,\n        ?bool $validate = null,\n        ?bool $deserialize = null,\n        ?bool $serialize = null,\n        ?string $formType = null,\n        ?array $formOptions = null,\n        ?array $normalizationContext = null,\n        ?array $denormalizationContext = null,\n        ?array $validationContext = null,\n        ?string $eventShortName = null,\n        ?string $notificationMessage = null,\n        string|\\Stringable|null $security = null,\n        ?string $securityMessage = null,\n        ?string $redirectToRoute = null,\n    ) {\n        parent::__construct(\n            methods: ['GET'],\n            path: $path,\n            routeName: $routeName,\n            routePrefix: $routePrefix,\n            routeRequirements: $routeRequirements,\n            routeCondition: $routeCondition,\n            routePriority: $routePriority,\n            template: $template,\n            shortName: $shortName ?? 'get',\n            name: $name,\n            provider: $provider,\n            processor: $processor,\n            responder: $responder,\n            repository: $repository,\n            repositoryMethod: $repositoryMethod,\n            repositoryArguments: $repositoryArguments,\n            read: $read,\n            write: $write,\n            validate: $validate,\n            deserialize: $deserialize,\n            serialize: $serialize,\n            formType: $formType,\n            formOptions: $formOptions,\n            normalizationContext: $normalizationContext,\n            denormalizationContext: $denormalizationContext,\n            validationContext: $validationContext,\n            eventShortName: $eventShortName,\n            notificationMessage: $notificationMessage,\n            security: $security,\n            securityMessage: $securityMessage,\n            redirectToRoute: $redirectToRoute,\n        );\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Api/GetCollection.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Api;\n\nuse Sylius\\Resource\\Metadata\\CollectionOperationInterface;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\n\n/**\n * @experimental\n */\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class GetCollection extends HttpOperation implements CollectionOperationInterface, ApiOperationInterface\n{\n    public function __construct(\n        ?string $path = null,\n        ?string $routeName = null,\n        ?string $routePrefix = null,\n        ?array $routeRequirements = null,\n        ?string $routeCondition = null,\n        ?int $routePriority = null,\n        ?string $template = null,\n        ?string $shortName = null,\n        ?string $name = null,\n        string|callable|null $provider = null,\n        string|callable|null $processor = null,\n        string|callable|null $responder = null,\n        string|callable|null $repository = null,\n        ?string $repositoryMethod = null,\n        ?array $repositoryArguments = null,\n        ?bool $read = null,\n        ?bool $write = null,\n        ?bool $validate = null,\n        ?bool $deserialize = null,\n        ?bool $serialize = null,\n        ?string $formType = null,\n        ?array $formOptions = null,\n        ?array $normalizationContext = null,\n        ?array $denormalizationContext = null,\n        ?array $validationContext = null,\n        ?string $eventShortName = null,\n        ?string $notificationMessage = null,\n        string|\\Stringable|null $security = null,\n        ?string $securityMessage = null,\n        ?string $redirectToRoute = null,\n    ) {\n        parent::__construct(\n            methods: ['GET'],\n            path: $path,\n            routeName: $routeName,\n            routePrefix: $routePrefix,\n            routeRequirements: $routeRequirements,\n            routeCondition: $routeCondition,\n            routePriority: $routePriority,\n            template: $template,\n            shortName: $shortName ?? 'get_collection',\n            name: $name,\n            provider: $provider,\n            processor: $processor,\n            responder: $responder,\n            repository: $repository,\n            repositoryMethod: $repositoryMethod,\n            repositoryArguments: $repositoryArguments,\n            read: $read,\n            write: $write,\n            validate: $validate,\n            deserialize: $deserialize,\n            serialize: $serialize,\n            formType: $formType,\n            formOptions: $formOptions,\n            normalizationContext: $normalizationContext,\n            denormalizationContext: $denormalizationContext,\n            validationContext: $validationContext,\n            eventShortName: $eventShortName,\n            notificationMessage: $notificationMessage,\n            security: $security,\n            securityMessage: $securityMessage,\n            redirectToRoute: $redirectToRoute,\n        );\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Api/Patch.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Api;\n\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\UpdateOperationInterface;\n\n/**\n * @experimental\n */\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class Patch extends HttpOperation implements UpdateOperationInterface, ApiOperationInterface\n{\n    public function __construct(\n        ?string $path = null,\n        ?string $routeName = null,\n        ?string $routePrefix = null,\n        ?array $routeRequirements = null,\n        ?string $routeCondition = null,\n        ?int $routePriority = null,\n        ?string $template = null,\n        ?string $shortName = null,\n        ?string $name = null,\n        string|callable|null $provider = null,\n        string|callable|null $processor = null,\n        string|callable|null $responder = null,\n        string|callable|null $repository = null,\n        ?string $repositoryMethod = null,\n        ?array $repositoryArguments = null,\n        ?bool $read = null,\n        ?bool $write = null,\n        ?bool $validate = null,\n        ?bool $deserialize = null,\n        ?bool $serialize = null,\n        ?string $formType = null,\n        ?array $formOptions = null,\n        ?array $normalizationContext = null,\n        ?array $denormalizationContext = null,\n        ?array $validationContext = null,\n        ?string $eventShortName = null,\n        ?string $notificationMessage = null,\n        string|\\Stringable|null $security = null,\n        ?string $securityMessage = null,\n        ?string $redirectToRoute = null,\n    ) {\n        parent::__construct(\n            methods: ['PATCH'],\n            path: $path,\n            routeName: $routeName,\n            routePrefix: $routePrefix,\n            routeRequirements: $routeRequirements,\n            routeCondition: $routeCondition,\n            routePriority: $routePriority,\n            template: $template,\n            shortName: $shortName ?? 'patch',\n            name: $name,\n            provider: $provider,\n            processor: $processor,\n            responder: $responder,\n            repository: $repository,\n            repositoryMethod: $repositoryMethod,\n            repositoryArguments: $repositoryArguments,\n            read: $read,\n            write: $write,\n            validate: $validate,\n            deserialize: $deserialize,\n            serialize: $serialize,\n            formType: $formType,\n            formOptions: $formOptions,\n            normalizationContext: $normalizationContext,\n            denormalizationContext: $denormalizationContext,\n            validationContext: $validationContext,\n            eventShortName: $eventShortName,\n            notificationMessage: $notificationMessage,\n            security: $security,\n            securityMessage: $securityMessage,\n            redirectToRoute: $redirectToRoute,\n        );\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Api/Post.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Api;\n\nuse Sylius\\Resource\\Metadata\\CreateOperationInterface;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\n\n/**\n * @experimental\n */\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class Post extends HttpOperation implements CreateOperationInterface, ApiOperationInterface\n{\n    public function __construct(\n        ?string $path = null,\n        ?string $routeName = null,\n        ?string $routePrefix = null,\n        ?array $routeRequirements = null,\n        ?string $routeCondition = null,\n        ?int $routePriority = null,\n        ?string $template = null,\n        ?string $shortName = null,\n        ?string $name = null,\n        string|callable|null $provider = null,\n        string|callable|null $processor = null,\n        string|callable|null $responder = null,\n        string|callable|null $repository = null,\n        ?string $repositoryMethod = null,\n        ?array $repositoryArguments = null,\n        ?bool $read = null,\n        ?bool $write = null,\n        ?bool $validate = null,\n        ?bool $deserialize = null,\n        ?bool $serialize = null,\n        ?string $formType = null,\n        ?array $formOptions = null,\n        ?array $normalizationContext = null,\n        ?array $denormalizationContext = null,\n        ?array $validationContext = null,\n        ?string $eventShortName = null,\n        ?string $notificationMessage = null,\n        string|\\Stringable|null $security = null,\n        ?string $securityMessage = null,\n        ?string $redirectToRoute = null,\n    ) {\n        parent::__construct(\n            methods: ['POST'],\n            path: $path,\n            routeName: $routeName,\n            routePrefix: $routePrefix,\n            routeRequirements: $routeRequirements,\n            routeCondition: $routeCondition,\n            routePriority: $routePriority,\n            template: $template,\n            shortName: $shortName ?? 'post',\n            name: $name,\n            provider: $provider,\n            processor: $processor,\n            responder: $responder,\n            repository: $repository,\n            repositoryMethod: $repositoryMethod,\n            repositoryArguments: $repositoryArguments,\n            read: $read,\n            write: $write,\n            validate: $validate,\n            deserialize: $deserialize,\n            serialize: $serialize,\n            formType: $formType,\n            formOptions: $formOptions,\n            normalizationContext: $normalizationContext,\n            denormalizationContext: $denormalizationContext,\n            validationContext: $validationContext,\n            eventShortName: $eventShortName,\n            notificationMessage: $notificationMessage,\n            security: $security,\n            securityMessage: $securityMessage,\n            redirectToRoute: $redirectToRoute,\n        );\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Api/Put.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Api;\n\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\UpdateOperationInterface;\n\n/**\n * @experimental\n */\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class Put extends HttpOperation implements UpdateOperationInterface, ApiOperationInterface\n{\n    public function __construct(\n        ?string $path = null,\n        ?string $routeName = null,\n        ?string $routePrefix = null,\n        ?array $routeRequirements = null,\n        ?string $routeCondition = null,\n        ?int $routePriority = null,\n        ?string $template = null,\n        ?string $shortName = null,\n        ?string $name = null,\n        string|callable|null $provider = null,\n        string|callable|null $processor = null,\n        string|callable|null $responder = null,\n        string|callable|null $repository = null,\n        ?string $repositoryMethod = null,\n        ?array $repositoryArguments = null,\n        ?bool $read = null,\n        ?bool $write = null,\n        ?bool $validate = null,\n        ?bool $deserialize = null,\n        ?bool $serialize = null,\n        ?string $formType = null,\n        ?array $formOptions = null,\n        ?array $normalizationContext = null,\n        ?array $denormalizationContext = null,\n        ?array $validationContext = null,\n        ?string $eventShortName = null,\n        ?string $notificationMessage = null,\n        string|\\Stringable|null $security = null,\n        ?string $securityMessage = null,\n        ?string $redirectToRoute = null,\n    ) {\n        parent::__construct(\n            methods: ['PUT'],\n            path: $path,\n            routeName: $routeName,\n            routePrefix: $routePrefix,\n            routeRequirements: $routeRequirements,\n            routeCondition: $routeCondition,\n            routePriority: $routePriority,\n            template: $template,\n            shortName: $shortName ?? 'put',\n            name: $name,\n            provider: $provider,\n            processor: $processor,\n            responder: $responder,\n            repository: $repository,\n            repositoryMethod: $repositoryMethod,\n            repositoryArguments: $repositoryArguments,\n            read: $read,\n            write: $write,\n            validate: $validate,\n            deserialize: $deserialize,\n            serialize: $serialize,\n            formType: $formType,\n            formOptions: $formOptions,\n            normalizationContext: $normalizationContext,\n            denormalizationContext: $denormalizationContext,\n            validationContext: $validationContext,\n            eventShortName: $eventShortName,\n            notificationMessage: $notificationMessage,\n            security: $security,\n            securityMessage: $securityMessage,\n            redirectToRoute: $redirectToRoute,\n        );\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/ApplyStateMachineTransition.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * @experimental\n */\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class ApplyStateMachineTransition extends HttpOperation implements UpdateOperationInterface, StateMachineAwareOperationInterface\n{\n    public function __construct(\n        ?array $methods = null,\n        ?string $path = null,\n        ?string $routeName = null,\n        ?string $routePrefix = null,\n        ?string $routeCondition = null,\n        ?int $routePriority = null,\n        ?string $template = null,\n        ?string $shortName = null,\n        ?string $name = null,\n        string|callable|null $provider = null,\n        string|callable|null $processor = null,\n        string|callable|null $responder = null,\n        string|callable|null $repository = null,\n        ?string $repositoryMethod = null,\n        ?array $repositoryArguments = null,\n        ?bool $read = null,\n        ?bool $write = null,\n        ?bool $validate = null,\n        ?string $formType = null,\n        ?array $formOptions = null,\n        ?string $eventShortName = null,\n        ?string $notificationMessage = null,\n        string|\\Stringable|null $security = null,\n        ?string $securityMessage = null,\n        ?string $redirectToRoute = null,\n        ?array $redirectArguments = null,\n        private ?string $stateMachineComponent = null,\n        private ?string $stateMachineTransition = null,\n        private ?string $stateMachineGraph = null,\n    ) {\n        parent::__construct(\n            methods: $methods ?? ['PUT', 'PATCH', 'POST'],\n            path: $path,\n            routeName: $routeName,\n            routePrefix: $routePrefix,\n            routeCondition: $routeCondition,\n            routePriority: $routePriority,\n            template: $template,\n            shortName: $shortName ?? $stateMachineTransition ?? 'apply_state_machine_transition',\n            name: $name,\n            provider: $provider,\n            processor: $processor,\n            responder: $responder,\n            repository: $repository,\n            repositoryMethod: $repositoryMethod,\n            repositoryArguments: $repositoryArguments,\n            read: $read,\n            write: $write,\n            validate: $validate ?? false,\n            formType: $formType,\n            formOptions: $formOptions,\n            eventShortName: $eventShortName,\n            notificationMessage: $notificationMessage,\n            security: $security,\n            securityMessage: $securityMessage,\n            redirectToRoute: $redirectToRoute,\n            redirectArguments: $redirectArguments,\n        );\n    }\n\n    public function getStateMachineComponent(): ?string\n    {\n        return $this->stateMachineComponent;\n    }\n\n    public function withStateMachineComponent(?string $stateMachineComponent): self\n    {\n        $self = clone $this;\n        $self->stateMachineComponent = $stateMachineComponent;\n\n        return $self;\n    }\n\n    public function getStateMachineTransition(): ?string\n    {\n        return $this->stateMachineTransition;\n    }\n\n    public function withStateMachineTransition(string $stateMachineTransition): self\n    {\n        $self = clone $this;\n        $self->stateMachineTransition = $stateMachineTransition;\n\n        return $self;\n    }\n\n    public function getStateMachineGraph(): ?string\n    {\n        return $this->stateMachineGraph;\n    }\n\n    public function withStateMachineGraph(string $stateMachineGraph): self\n    {\n        $self = clone $this;\n        $self->stateMachineGraph = $stateMachineGraph;\n\n        return $self;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/AsOperationMutator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n#[\\Attribute(\\Attribute::TARGET_CLASS)]\nclass AsOperationMutator\n{\n    public function __construct(\n        public readonly string $operationName,\n    ) {\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/AsResource.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class AsResource\n{\n    /**\n     * @param array<string, string>|null $routeRequirements\n     */\n    public function __construct(\n        private ?string $alias = null,\n        private ?string $section = null,\n        private ?string $formType = null,\n        private ?string $templatesDir = null,\n        private ?string $routePrefix = null,\n        private ?array $routeRequirements = null,\n        private ?string $routeCondition = null,\n        private ?int $routePriority = null,\n        private ?string $name = null,\n        private ?string $pluralName = null,\n        private ?string $applicationName = null,\n        private ?string $identifier = null,\n        private ?array $normalizationContext = null,\n        private ?array $denormalizationContext = null,\n        private ?array $validationContext = null,\n        private ?string $class = null,\n        private string|false|null $driver = null,\n        private ?array $vars = null,\n        private ?array $operations = null,\n    ) {\n    }\n\n    public function toMetadata(): ResourceMetadata\n    {\n        return new ResourceMetadata(\n            alias: $this->alias,\n            section: $this->section,\n            formType: $this->formType,\n            templatesDir: $this->templatesDir,\n            routePrefix: $this->routePrefix,\n            routeRequirements: $this->routeRequirements,\n            routeCondition: $this->routeCondition,\n            routePriority: $this->routePriority,\n            name: $this->name,\n            pluralName: $this->pluralName,\n            applicationName: $this->applicationName,\n            identifier: $this->identifier,\n            normalizationContext: $this->normalizationContext,\n            denormalizationContext: $this->denormalizationContext,\n            validationContext: $this->validationContext,\n            class: $this->class,\n            driver: $this->driver,\n            vars: $this->vars,\n            operations: $this->operations,\n        );\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/AsResourceMutator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n#[\\Attribute(\\Attribute::TARGET_CLASS)]\nclass AsResourceMutator\n{\n    /**\n     * @param class-string $resourceClass\n     */\n    public function __construct(\n        public readonly string $resourceClass,\n    ) {\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/BulkDelete.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * @experimental\n */\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class BulkDelete extends HttpOperation implements DeleteOperationInterface, BulkOperationInterface\n{\n    public function __construct(\n        ?array $methods = null,\n        ?string $path = null,\n        ?string $routeName = null,\n        ?string $routePrefix = null,\n        ?array $routeRequirements = null,\n        ?string $routeCondition = null,\n        ?int $routePriority = null,\n        ?string $template = null,\n        ?string $shortName = null,\n        ?string $name = null,\n        string|callable|null $provider = null,\n        string|callable|null $processor = null,\n        string|callable|null $responder = null,\n        string|callable|null $repository = null,\n        ?array $repositoryArguments = null,\n        ?string $repositoryMethod = null,\n        ?bool $read = null,\n        ?bool $write = null,\n        ?string $formType = null,\n        ?array $formOptions = null,\n        ?string $eventShortName = null,\n        ?string $notificationMessage = null,\n        string|\\Stringable|null $security = null,\n        ?string $securityMessage = null,\n        ?string $redirectTo = null,\n        ?string $redirectToRoute = null,\n        ?array $redirectArguments = null,\n        ?array $vars = null,\n    ) {\n        parent::__construct(\n            methods: $methods ?? ['DELETE', 'POST'],\n            path: $path,\n            routeName: $routeName,\n            routePrefix: $routePrefix,\n            routeRequirements: $routeRequirements,\n            routeCondition: $routeCondition,\n            routePriority: $routePriority,\n            template: $template,\n            shortName: $shortName ?? 'bulk_delete',\n            name: $name,\n            provider: $provider,\n            processor: $processor,\n            responder: $responder,\n            repository: $repository,\n            repositoryMethod: $repositoryMethod,\n            repositoryArguments: $repositoryArguments,\n            read: $read,\n            write: $write,\n            formType: $formType,\n            formOptions: $formOptions,\n            eventShortName: $eventShortName,\n            notificationMessage: $notificationMessage,\n            security: $security,\n            securityMessage: $securityMessage,\n            redirectTo: $redirectTo,\n            redirectToRoute: $redirectToRoute,\n            redirectArguments: $redirectArguments,\n            vars: $vars,\n        );\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/BulkOperationInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * The Operation returns a collection.\n *\n * @experimental\n */\ninterface BulkOperationInterface\n{\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/BulkUpdate.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * @experimental\n */\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class BulkUpdate extends HttpOperation implements UpdateOperationInterface, StateMachineAwareOperationInterface, BulkOperationInterface\n{\n    public function __construct(\n        ?array $methods = null,\n        ?string $path = null,\n        ?string $routeName = null,\n        ?string $routePrefix = null,\n        ?array $routeRequirements = null,\n        ?string $routeCondition = null,\n        ?int $routePriority = null,\n        ?string $template = null,\n        ?string $shortName = null,\n        ?string $name = null,\n        string|callable|null $provider = null,\n        string|callable|null $processor = null,\n        string|callable|null $responder = null,\n        string|callable|null $repository = null,\n        ?string $repositoryMethod = null,\n        ?array $repositoryArguments = null,\n        ?bool $read = null,\n        ?bool $write = null,\n        ?bool $validate = null,\n        ?bool $deserialize = null,\n        ?bool $serialize = null,\n        ?string $formType = null,\n        ?array $formOptions = null,\n        ?array $validationContext = null,\n        ?string $eventShortName = null,\n        ?string $notificationMessage = null,\n        string|\\Stringable|null $security = null,\n        ?string $securityMessage = null,\n        ?string $redirectToRoute = null,\n        ?array $redirectArguments = null,\n        ?array $vars = null,\n        private ?string $stateMachineComponent = null,\n        private ?string $stateMachineTransition = null,\n        private ?string $stateMachineGraph = null,\n    ) {\n        parent::__construct(\n            methods: $methods ?? ['PUT', 'PATCH'],\n            path: $path,\n            routeName: $routeName,\n            routePrefix: $routePrefix,\n            routeRequirements: $routeRequirements,\n            routeCondition: $routeCondition,\n            routePriority: $routePriority,\n            template: $template,\n            shortName: $shortName ?? 'bulk_update',\n            name: $name,\n            provider: $provider,\n            processor: $processor,\n            responder: $responder,\n            repository: $repository,\n            repositoryMethod: $repositoryMethod,\n            repositoryArguments: $repositoryArguments,\n            read: $read,\n            write: $write,\n            validate: $validate,\n            deserialize: $deserialize,\n            serialize: $serialize,\n            formType: $formType,\n            formOptions: $formOptions,\n            validationContext: $validationContext,\n            eventShortName: $eventShortName,\n            notificationMessage: $notificationMessage,\n            security: $security,\n            securityMessage: $securityMessage,\n            redirectToRoute: $redirectToRoute,\n            redirectArguments: $redirectArguments,\n            vars: $vars,\n        );\n    }\n\n    public function getStateMachineComponent(): ?string\n    {\n        return $this->stateMachineComponent;\n    }\n\n    public function withStateMachineComponent(?string $stateMachineComponent): self\n    {\n        $self = clone $this;\n        $self->stateMachineComponent = $stateMachineComponent;\n\n        return $self;\n    }\n\n    public function getStateMachineTransition(): ?string\n    {\n        return $this->stateMachineTransition;\n    }\n\n    public function withStateMachineTransition(string $stateMachineTransition): self\n    {\n        $self = clone $this;\n        $self->stateMachineTransition = $stateMachineTransition;\n\n        return $self;\n    }\n\n    public function getStateMachineGraph(): ?string\n    {\n        return $this->stateMachineGraph;\n    }\n\n    public function withStateMachineGraph(string $stateMachineGraph): self\n    {\n        $self = clone $this;\n        $self->stateMachineGraph = $stateMachineGraph;\n\n        return $self;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/CollectionOperationInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * The Operation returns a collection.\n *\n * @experimental\n */\ninterface CollectionOperationInterface\n{\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Create.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * @experimental\n */\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class Create extends HttpOperation implements CreateOperationInterface, StateMachineAwareOperationInterface, FactoryAwareOperationInterface\n{\n    /** @var string|callable|false|null */\n    private $factory;\n\n    public function __construct(\n        ?array $methods = null,\n        ?string $path = null,\n        ?string $routeName = null,\n        ?string $routePrefix = null,\n        ?array $routeRequirements = null,\n        ?string $routeCondition = null,\n        ?int $routePriority = null,\n        ?string $template = null,\n        ?string $shortName = null,\n        ?string $name = null,\n        string|callable|null $provider = null,\n        string|callable|null $processor = null,\n        string|callable|null $responder = null,\n        string|callable|null $repository = null,\n        ?array $repositoryArguments = null,\n        ?string $repositoryMethod = null,\n        string|callable|false|null $factory = null,\n        private ?string $factoryMethod = null,\n        private ?array $factoryArguments = [],\n        ?bool $read = null,\n        ?bool $write = null,\n        ?bool $validate = null,\n        ?bool $deserialize = null,\n        ?bool $serialize = null,\n        ?string $formType = null,\n        ?array $formOptions = null,\n        ?array $validationContext = null,\n        ?string $eventShortName = null,\n        ?string $notificationMessage = null,\n        string|\\Stringable|null $security = null,\n        ?string $securityMessage = null,\n        string|callable|null $twigContextFactory = null,\n        ?string $redirectTo = null,\n        ?string $redirectToRoute = null,\n        ?array $redirectArguments = null,\n        ?array $vars = null,\n        private ?string $stateMachineComponent = null,\n        private ?string $stateMachineTransition = null,\n        private ?string $stateMachineGraph = null,\n    ) {\n        parent::__construct(\n            methods: $methods ?? ['GET', 'POST'],\n            path: $path,\n            routeName: $routeName,\n            routePrefix: $routePrefix,\n            routeRequirements: $routeRequirements,\n            routeCondition: $routeCondition,\n            routePriority: $routePriority,\n            template: $template,\n            shortName: $shortName ?? 'create',\n            name: $name,\n            provider: $provider,\n            processor: $processor,\n            responder: $responder,\n            repository: $repository,\n            repositoryMethod: $repositoryMethod,\n            repositoryArguments: $repositoryArguments,\n            read: $read,\n            write: $write,\n            validate: $validate,\n            deserialize: $deserialize,\n            serialize: $serialize,\n            formType: $formType,\n            formOptions: $formOptions,\n            validationContext: $validationContext,\n            eventShortName: $eventShortName,\n            notificationMessage: $notificationMessage,\n            security: $security,\n            securityMessage: $securityMessage,\n            twigContextFactory: $twigContextFactory,\n            redirectTo: $redirectTo,\n            redirectToRoute: $redirectToRoute,\n            redirectArguments: $redirectArguments,\n            vars: $vars,\n        );\n\n        $this->factory = $factory;\n    }\n\n    public function getStateMachineComponent(): ?string\n    {\n        return $this->stateMachineComponent;\n    }\n\n    public function withStateMachineComponent(?string $stateMachineComponent): self\n    {\n        $self = clone $this;\n        $self->stateMachineComponent = $stateMachineComponent;\n\n        return $self;\n    }\n\n    public function getStateMachineTransition(): ?string\n    {\n        return $this->stateMachineTransition;\n    }\n\n    public function withStateMachineTransition(string $stateMachineTransition): self\n    {\n        $self = clone $this;\n        $self->stateMachineTransition = $stateMachineTransition;\n\n        return $self;\n    }\n\n    public function getStateMachineGraph(): ?string\n    {\n        return $this->stateMachineGraph;\n    }\n\n    public function withStateMachineGraph(string $stateMachineGraph): self\n    {\n        $self = clone $this;\n        $self->stateMachineGraph = $stateMachineGraph;\n\n        return $self;\n    }\n\n    public function getFactory(): callable|string|false|null\n    {\n        return $this->factory;\n    }\n\n    public function withFactory(string|callable|false|null $factory): self\n    {\n        $self = clone $this;\n        $self->factory = $factory;\n\n        return $self;\n    }\n\n    public function getFactoryMethod(): ?string\n    {\n        return $this->factoryMethod;\n    }\n\n    public function withFactoryMethod(string $factoryMethod): self\n    {\n        $self = clone $this;\n        $self->factoryMethod = $factoryMethod;\n\n        return $self;\n    }\n\n    public function getFactoryArguments(): ?array\n    {\n        return $this->factoryArguments;\n    }\n\n    public function withFactoryArguments(array $factoryArguments): self\n    {\n        $self = clone $this;\n        $self->factoryArguments = $factoryArguments;\n\n        return $self;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/CreateOperationInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * The Operation creates content.\n *\n * @experimental\n */\ninterface CreateOperationInterface\n{\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Delete.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * @experimental\n */\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class Delete extends HttpOperation implements DeleteOperationInterface\n{\n    public function __construct(\n        ?array $methods = null,\n        ?string $path = null,\n        ?string $routeName = null,\n        ?string $routePrefix = null,\n        ?array $routeRequirements = null,\n        ?string $routeCondition = null,\n        ?int $routePriority = null,\n        ?string $template = null,\n        ?string $shortName = null,\n        ?string $name = null,\n        string|callable|null $provider = null,\n        string|callable|null $processor = null,\n        string|callable|null $responder = null,\n        string|callable|null $repository = null,\n        ?string $repositoryMethod = null,\n        ?array $repositoryArguments = null,\n        ?bool $read = null,\n        ?bool $write = null,\n        ?bool $validate = null,\n        ?bool $deserialize = null,\n        ?bool $serialize = null,\n        ?string $formType = null,\n        ?array $formOptions = null,\n        ?array $validationContext = null,\n        ?string $eventShortName = null,\n        ?string $notificationMessage = null,\n        string|\\Stringable|null $security = null,\n        ?string $securityMessage = null,\n        string|callable|null $twigContextFactory = null,\n        ?string $redirectTo = null,\n        ?string $redirectToRoute = null,\n        ?array $redirectArguments = null,\n        ?array $vars = null,\n    ) {\n        parent::__construct(\n            methods: $methods ?? ['DELETE', 'POST'],\n            path: $path,\n            routeName: $routeName,\n            routePrefix: $routePrefix,\n            routeRequirements: $routeRequirements,\n            routeCondition: $routeCondition,\n            routePriority: $routePriority,\n            template: $template,\n            shortName: $shortName ?? 'delete',\n            name: $name,\n            provider: $provider,\n            processor: $processor,\n            responder: $responder,\n            repository: $repository,\n            repositoryMethod: $repositoryMethod,\n            repositoryArguments: $repositoryArguments,\n            read: $read,\n            write: $write,\n            validate: $validate,\n            deserialize: $deserialize,\n            serialize: $serialize,\n            formType: $formType,\n            formOptions: $formOptions,\n            validationContext: $validationContext,\n            eventShortName: $eventShortName,\n            notificationMessage: $notificationMessage,\n            security: $security,\n            securityMessage: $securityMessage,\n            twigContextFactory: $twigContextFactory,\n            redirectTo: $redirectTo,\n            redirectToRoute: $redirectToRoute,\n            redirectArguments: $redirectArguments,\n            vars: $vars,\n        );\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/DeleteOperationInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * The Operation deletes content.\n *\n * @experimental\n */\ninterface DeleteOperationInterface\n{\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Extractor/AbstractResourceExtractor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Extractor;\n\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Resource\\Exception\\RuntimeException;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Symfony\\Component\\DependencyInjection\\ContainerInterface as SymfonyContainerInterface;\n\n/**\n * Base file extractor.\n *\n * @experimental\n */\nabstract class AbstractResourceExtractor implements ResourceExtractorInterface\n{\n    /** @var ResourceMetadata[]|null */\n    protected ?array $resources = null;\n\n    private array $collectedParameters = [];\n\n    /** @param string[] $paths */\n    public function __construct(\n        protected array $paths,\n        private readonly ?ContainerInterface $container = null,\n    ) {\n    }\n\n    /**\n     * @inheritdoc\n     */\n    public function getResources(): array\n    {\n        if (null !== $this->resources) {\n            return $this->resources;\n        }\n\n        $this->resources = [];\n        foreach ($this->paths as $path) {\n            $this->extractFromPath($path);\n        }\n\n        return $this->resources;\n    }\n\n    /**\n     * Extracts metadata from a given path.\n     */\n    abstract protected function extractFromPath(string $path): void;\n\n    /**\n     * Recursively replaces placeholders with the service container parameters.\n     *\n     * @see https://github.com/symfony/symfony/blob/6fec32c/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php\n     *\n     * @param mixed $value The source which might contain \"%placeholders%\"\n     *\n     * @throws \\RuntimeException When a container value is not a string or a numeric value\n     *\n     * @return mixed The source with the placeholders replaced by the container\n     *               parameters. Arrays are resolved recursively.\n     */\n    protected function resolve(mixed $value): mixed\n    {\n        if (null === $this->container) {\n            return $value;\n        }\n\n        if (\\is_array($value)) {\n            foreach ($value as $key => $val) {\n                $value[$key] = $this->resolve($val);\n            }\n\n            return $value;\n        }\n\n        if (!\\is_string($value)) {\n            return $value;\n        }\n\n        $escapedValue = preg_replace_callback('/%%|%([^%\\s]++)%/', function ($match) use ($value) {\n            $parameter = $match[1] ?? null;\n\n            // skip %%\n            if (!isset($parameter)) {\n                return '%%';\n            }\n\n            if (preg_match('/^env\\(\\w+\\)$/', $parameter)) {\n                throw new RuntimeException(\\sprintf('Using \"%%%s%%\" is not allowed in routing configuration.', $parameter));\n            }\n\n            if (\\array_key_exists($parameter, $this->collectedParameters)) {\n                return $this->collectedParameters[$parameter];\n            }\n\n            if ($this->container instanceof SymfonyContainerInterface) {\n                $resolved = $this->container->getParameter($parameter);\n            } else {\n                $resolved = $this->container?->get($parameter);\n            }\n\n            if (\\is_string($resolved) || is_numeric($resolved)) {\n                $this->collectedParameters[$parameter] = $resolved;\n\n                return (string) $resolved;\n            }\n\n            throw new RuntimeException(\\sprintf('The container parameter \"%s\", used in the resource configuration value \"%s\", must be a string or numeric, but it is of type %s.', $parameter, $value, \\gettype($resolved)));\n        }, $value);\n\n        return str_replace('%%', '%', $escapedValue ?? '');\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Extractor/PhpFileResourceExtractor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Extractor;\n\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\n/**\n * @experimental\n */\nfinal class PhpFileResourceExtractor extends AbstractResourceExtractor\n{\n    protected function extractFromPath(string $path): void\n    {\n        $resource = $this->getPHPFileClosure($path)();\n\n        if (!$resource instanceof ResourceMetadata) {\n            return;\n        }\n\n        $resourceReflection = new \\ReflectionClass($resource);\n\n        foreach ($resourceReflection->getProperties() as $property) {\n            $property->setAccessible(true);\n            $resolvedValue = $this->resolve($property->getValue($resource));\n            $property->setValue($resource, $resolvedValue);\n        }\n\n        $this->resources[] = $resource;\n    }\n\n    /**\n     * Scope isolated include.\n     *\n     * Prevents access to $this/self from included files.\n     */\n    private function getPHPFileClosure(string $filePath): \\Closure\n    {\n        return \\Closure::bind(function () use ($filePath): mixed {\n            return require $filePath;\n        }, null, null);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Extractor/ResourceExtractorInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Extractor;\n\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\n/**\n * Extracts an array of metadata from a file or a list of files.\n *\n * @experimental\n */\ninterface ResourceExtractorInterface\n{\n    /**\n     * Parses all metadata files and convert them in an array.\n     *\n     * @return ResourceMetadata[]\n     */\n    public function getResources(): array;\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/FactoryAwareOperationInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\ninterface FactoryAwareOperationInterface\n{\n    public function getFactory(): callable|string|false|null;\n\n    public function withFactory(string|callable|false|null $factory): self;\n\n    public function getFactoryMethod(): ?string;\n\n    public function withFactoryMethod(string $factoryMethod): self;\n\n    public function getFactoryArguments(): ?array;\n\n    public function withFactoryArguments(array $factoryArguments): self;\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/GridAwareOperationInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * The Operation has a grid.\n *\n * @experimental\n */\ninterface GridAwareOperationInterface\n{\n    public function getGrid(): ?string;\n\n    public function withGrid(string $grid): self;\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/HttpOperation.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * @experimental\n */\nclass HttpOperation extends Operation\n{\n    /** @var string|callable|null */\n    protected $twigContextFactory;\n\n    /**\n     * @param array<string, string>|null $routeRequirements\n     */\n    public function __construct(\n        protected ?array $methods = null,\n        protected ?string $path = null,\n        protected ?string $routeName = null,\n        protected ?string $routePrefix = null,\n        protected ?array $routeRequirements = null,\n        protected ?string $routeCondition = null,\n        protected ?int $routePriority = null,\n        ?string $template = null,\n        ?string $shortName = null,\n        ?string $name = null,\n        string|callable|null $provider = null,\n        string|callable|null $processor = null,\n        string|callable|null $responder = null,\n        string|callable|null $repository = null,\n        ?string $repositoryMethod = null,\n        ?array $repositoryArguments = null,\n        ?bool $read = null,\n        ?bool $write = null,\n        ?bool $validate = null,\n        ?bool $deserialize = null,\n        ?bool $serialize = null,\n        ?string $formType = null,\n        ?array $formOptions = null,\n        ?array $normalizationContext = null,\n        ?array $denormalizationContext = null,\n        ?array $validationContext = null,\n        ?string $eventShortName = null,\n        ?string $notificationMessage = null,\n        string|\\Stringable|null $security = null,\n        ?string $securityMessage = null,\n        string|callable|null $twigContextFactory = null,\n        protected ?string $redirectTo = null,\n        protected ?string $redirectToRoute = null,\n        protected ?array $redirectArguments = null,\n        protected ?array $vars = null,\n    ) {\n        parent::__construct(\n            template: $template,\n            shortName: $shortName,\n            name: $name,\n            provider: $provider,\n            processor: $processor,\n            responder: $responder,\n            repository: $repository,\n            repositoryMethod: $repositoryMethod,\n            repositoryArguments: $repositoryArguments,\n            read: $read,\n            write: $write,\n            validate: $validate,\n            deserialize: $deserialize,\n            serialize: $serialize,\n            formType: $formType,\n            formOptions: $formOptions,\n            normalizationContext: $normalizationContext,\n            denormalizationContext: $denormalizationContext,\n            validationContext: $validationContext,\n            eventShortName: $eventShortName,\n            notificationMessage: $notificationMessage,\n            security: $security,\n            securityMessage: $securityMessage,\n        );\n\n        $this->twigContextFactory = $twigContextFactory;\n    }\n\n    public function getMethods(): ?array\n    {\n        return $this->methods;\n    }\n\n    public function withMethods(array $methods): self\n    {\n        $self = clone $this;\n        $self->methods = $methods;\n\n        return $self;\n    }\n\n    public function getPath(): ?string\n    {\n        return $this->path;\n    }\n\n    public function withPath(string $path): self\n    {\n        $self = clone $this;\n        $self->path = $path;\n\n        return $self;\n    }\n\n    public function getRouteName(): ?string\n    {\n        return $this->routeName;\n    }\n\n    public function withRouteName(string $routeName): self\n    {\n        $self = clone $this;\n        $self->routeName = $routeName;\n\n        return $self;\n    }\n\n    public function getRoutePrefix(): ?string\n    {\n        return $this->routePrefix;\n    }\n\n    public function withRoutePrefix(?string $routePrefix): self\n    {\n        $self = clone $this;\n        $self->routePrefix = $routePrefix;\n\n        return $self;\n    }\n\n    /**\n     * @return array<string, string>|null\n     */\n    public function getRouteRequirements(): ?array\n    {\n        return $this->routeRequirements;\n    }\n\n    /**\n     * @param array<string, string>|null $routeRequirements\n     */\n    public function withRouteRequirements(?array $routeRequirements): self\n    {\n        $self = clone $this;\n        $self->routeRequirements = $routeRequirements;\n\n        return $self;\n    }\n\n    public function getRouteCondition(): ?string\n    {\n        return $this->routeCondition;\n    }\n\n    public function withRouteCondition(?string $routeCondition): self\n    {\n        $self = clone $this;\n        $self->routeCondition = $routeCondition;\n\n        return $self;\n    }\n\n    public function getRoutePriority(): ?int\n    {\n        return $this->routePriority;\n    }\n\n    public function withRoutePriority(?int $routePriority): self\n    {\n        $self = clone $this;\n        $self->routePriority = $routePriority;\n\n        return $self;\n    }\n\n    public function getTwigContextFactory(): callable|string|null\n    {\n        return $this->twigContextFactory;\n    }\n\n    public function withTwigContextFactory(callable|string|null $twigContextFactory): self\n    {\n        $self = clone $this;\n        $self->twigContextFactory = $twigContextFactory;\n\n        return $self;\n    }\n\n    public function getRedirectTo(): ?string\n    {\n        return $this->redirectTo;\n    }\n\n    public function withRedirectTo(?string $redirectTo): self\n    {\n        $self = clone $this;\n        $self->redirectTo = $redirectTo;\n\n        return $self;\n    }\n\n    public function getRedirectToRoute(): ?string\n    {\n        return $this->redirectToRoute;\n    }\n\n    public function withRedirectToRoute(string $redirectToRoute): self\n    {\n        $self = clone $this;\n        $self->redirectToRoute = $redirectToRoute;\n\n        return $self;\n    }\n\n    public function getRedirectArguments(): ?array\n    {\n        return $this->redirectArguments;\n    }\n\n    public function withRedirectArguments(array $redirectArguments): self\n    {\n        $self = clone $this;\n        $self->redirectArguments = $redirectArguments;\n\n        return $self;\n    }\n\n    public function getVars(): ?array\n    {\n        return $this->vars;\n    }\n\n    public function withVars(array $vars): self\n    {\n        $self = clone $this;\n        $self->vars = $vars;\n\n        return $self;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Index.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * @experimental\n */\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class Index extends HttpOperation implements CollectionOperationInterface, GridAwareOperationInterface\n{\n    public function __construct(\n        ?array $methods = null,\n        ?string $path = null,\n        ?string $routeName = null,\n        ?string $routePrefix = null,\n        ?array $routeRequirements = null,\n        ?string $routeCondition = null,\n        ?int $routePriority = null,\n        ?string $template = null,\n        ?string $shortName = null,\n        ?string $name = null,\n        string|callable|null $provider = null,\n        string|callable|null $processor = null,\n        string|callable|null $responder = null,\n        string|callable|null $repository = null,\n        ?string $repositoryMethod = null,\n        ?array $repositoryArguments = null,\n        ?bool $read = null,\n        ?bool $write = null,\n        ?bool $validate = null,\n        ?bool $deserialize = null,\n        ?bool $serialize = null,\n        ?string $formType = null,\n        ?array $formOptions = null,\n        ?string $eventShortName = null,\n        ?string $notificationMessage = null,\n        string|\\Stringable|null $security = null,\n        ?string $securityMessage = null,\n        ?array $validationContext = null,\n        string|callable|null $twigContextFactory = null,\n        ?string $redirectToRoute = null,\n        ?array $vars = null,\n        private ?string $grid = null,\n    ) {\n        parent::__construct(\n            methods: $methods ?? ['GET'],\n            path: $path,\n            routeName: $routeName,\n            routePrefix: $routePrefix,\n            routeRequirements: $routeRequirements,\n            routeCondition: $routeCondition,\n            routePriority: $routePriority,\n            template: $template,\n            shortName: $shortName ?? 'index',\n            name: $name,\n            provider: $provider,\n            processor: $processor,\n            responder: $responder,\n            repository: $repository,\n            repositoryMethod: $repositoryMethod,\n            repositoryArguments: $repositoryArguments,\n            read: $read,\n            write: $write,\n            validate: $validate,\n            deserialize: $deserialize,\n            serialize: $serialize,\n            formType: $formType,\n            formOptions: $formOptions,\n            validationContext: $validationContext,\n            eventShortName: $eventShortName,\n            notificationMessage: $notificationMessage,\n            security: $security,\n            securityMessage: $securityMessage,\n            twigContextFactory: $twigContextFactory,\n            redirectToRoute: $redirectToRoute,\n            vars: $vars,\n        );\n    }\n\n    public function getGrid(): ?string\n    {\n        return $this->grid;\n    }\n\n    public function withGrid(string $grid): self\n    {\n        $self = clone $this;\n        $self->grid = $grid;\n\n        return $self;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Inflector/Inflector.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Inflector;\n\nuse Symfony\\Component\\String\\Inflector\\EnglishInflector;\nuse Symfony\\Component\\String\\UnicodeString;\n\nfinal class Inflector implements InflectorInterface\n{\n    public function tableize(string $string): string\n    {\n        return (new UnicodeString($string))->snake()->toString();\n    }\n\n    public function pluralize(string $string): string\n    {\n        $pluralize = (new EnglishInflector())->pluralize($string);\n\n        return $pluralize ? array_pop($pluralize) : '';\n    }\n\n    public function dashize(string $string): string\n    {\n        return strtr($this->tableize($string), ['_' => '-']);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Inflector/InflectorInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Inflector;\n\ninterface InflectorInterface\n{\n    public function tableize(string $string): string;\n\n    public function pluralize(string $string): string;\n\n    public function dashize(string $string): string;\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Metadata.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\nuse Doctrine\\Inflector\\Inflector as InflectorObject;\nuse Doctrine\\Inflector\\InflectorFactory;\n\nfinal class Metadata implements MetadataInterface\n{\n    private string $name;\n\n    private string $applicationName;\n\n    /** @var string */\n    private $driver;\n\n    private ?string $stateMachineComponent = null;\n\n    /** @var string */\n    private $templatesNamespace;\n\n    /** @var array */\n    private $parameters;\n\n    private static ?InflectorObject $inflectorInstance = null;\n\n    private function __construct(string $name, string $applicationName, array $parameters)\n    {\n        $this->name = $name;\n        $this->applicationName = $applicationName;\n\n        $this->driver = $parameters['driver'];\n        $this->templatesNamespace = array_key_exists('templates', $parameters) ? $parameters['templates'] : null;\n        $this->stateMachineComponent = $parameters['state_machine_component'] ?? null;\n\n        $this->parameters = $parameters;\n    }\n\n    public static function fromAliasAndConfiguration(string $alias, array $parameters): self\n    {\n        [$applicationName, $name] = self::parseAlias($alias);\n\n        return new self($name, $applicationName, $parameters);\n    }\n\n    public static function setInflector(InflectorObject $inflector): void\n    {\n        self::$inflectorInstance = $inflector;\n    }\n\n    private static function getInflector(): InflectorObject\n    {\n        if (self::$inflectorInstance === null) {\n            $inflectorFactory = InflectorFactory::create();\n\n            self::$inflectorInstance = $inflectorFactory->build();\n        }\n\n        return self::$inflectorInstance;\n    }\n\n    public function getAlias(): string\n    {\n        return $this->applicationName . '.' . $this->name;\n    }\n\n    public function getApplicationName(): string\n    {\n        return $this->applicationName;\n    }\n\n    public function getName(): string\n    {\n        return $this->name;\n    }\n\n    public function getHumanizedName(): string\n    {\n        return strtolower(trim((string) preg_replace(['/([A-Z])/', '/[_\\s]+/'], ['_$1', ' '], $this->name)));\n    }\n\n    public function getPluralName(): string\n    {\n        return self::getInflector()->pluralize($this->name);\n    }\n\n    public function getDriver(): string|false\n    {\n        return $this->driver;\n    }\n\n    public function getStateMachineComponent(): ?string\n    {\n        return $this->stateMachineComponent;\n    }\n\n    public function getTemplatesNamespace(): ?string\n    {\n        return $this->templatesNamespace;\n    }\n\n    public function getParameter(string $name)\n    {\n        if (!$this->hasParameter($name)) {\n            throw new \\InvalidArgumentException(sprintf('Parameter \"%s\" is not configured for resource \"%s\".', $name, $this->getAlias()));\n        }\n\n        return $this->parameters[$name];\n    }\n\n    public function hasParameter(string $name): bool\n    {\n        return array_key_exists($name, $this->parameters);\n    }\n\n    public function getParameters(): array\n    {\n        return $this->parameters;\n    }\n\n    public function getClass(string $name): string\n    {\n        if (!$this->hasClass($name)) {\n            throw new \\InvalidArgumentException(sprintf('Class \"%s\" is not configured for resource \"%s\".', $name, $this->getAlias()));\n        }\n\n        return $this->parameters['classes'][$name];\n    }\n\n    public function hasClass(string $name): bool\n    {\n        return isset($this->parameters['classes'][$name]);\n    }\n\n    public function getServiceId(string $serviceName): string\n    {\n        return sprintf('%s.%s.%s', $this->applicationName, $serviceName, $this->name);\n    }\n\n    public function getPermissionCode(string $permissionName): string\n    {\n        return sprintf('%s.%s.%s', $this->applicationName, $this->name, $permissionName);\n    }\n\n    private static function parseAlias(string $alias): array\n    {\n        if (false === strpos($alias, '.')) {\n            throw new \\InvalidArgumentException(sprintf('Invalid alias \"%s\" supplied, it should conform to the following format \"<applicationName>.<name>\".', $alias));\n        }\n\n        return explode('.', $alias, 2);\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Metadata\\Metadata::class, false)) {\n    class_alias(Metadata::class, \\Sylius\\Component\\Resource\\Metadata\\Metadata::class);\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/MetadataInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * @method string|null getStateMachineComponent()\n */\ninterface MetadataInterface\n{\n    public function getAlias(): string;\n\n    public function getApplicationName(): string;\n\n    public function getName(): string;\n\n    public function getHumanizedName(): string;\n\n    public function getPluralName(): string;\n\n    public function getDriver(): string|false;\n\n    public function getTemplatesNamespace(): ?string;\n\n    /**\n     * @return string|array\n     *\n     * @throws \\InvalidArgumentException\n     */\n    public function getParameter(string $name);\n\n    /**\n     * @return class-string $name\n     *\n     * @throws \\InvalidArgumentException\n     */\n    public function getClass(string $name): string;\n\n    /**\n     * Return all the metadata parameters.\n     */\n    public function getParameters(): array;\n\n    public function hasParameter(string $name): bool;\n\n    public function hasClass(string $name): bool;\n\n    public function getServiceId(string $serviceName): string;\n\n    public function getPermissionCode(string $permissionName): string;\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Metadata\\MetadataInterface::class, false)) {\n    class_alias(MetadataInterface::class, \\Sylius\\Component\\Resource\\Metadata\\MetadataInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Mutator/OperationMutatorCollection.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Mutator;\n\nuse Sylius\\Resource\\Metadata\\OperationMutatorInterface;\n\n/**\n * @internal\n */\nfinal class OperationMutatorCollection implements OperationMutatorCollectionInterface\n{\n    /** @var array<string, list<OperationMutatorInterface>> */\n    private array $mutators = [];\n\n    /**\n     * Adds a mutator to the container for a given operation name.\n     */\n    public function add(string $operationName, OperationMutatorInterface $mutator): void\n    {\n        $this->mutators[$operationName][] = $mutator;\n    }\n\n    public function get(string $id): array\n    {\n        return $this->mutators[$id] ?? [];\n    }\n\n    public function has(string $id): bool\n    {\n        return isset($this->mutators[$id]);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Mutator/OperationMutatorCollectionInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Mutator;\n\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Resource\\Metadata\\OperationMutatorInterface;\n\n/**\n * Collection of Operation mutators to mutate Operation metadata.\n *\n * @experimental\n */\ninterface OperationMutatorCollectionInterface extends ContainerInterface\n{\n    /**\n     * @return list<OperationMutatorInterface>\n     */\n    public function get(string $id): array;\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Mutator/ResourceMutatorCollection.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Mutator;\n\nuse Sylius\\Resource\\Metadata\\ResourceMutatorInterface;\n\n/**\n * @internal\n */\nfinal class ResourceMutatorCollection implements ResourceMutatorCollectionInterface\n{\n    /** @var array<string, list<ResourceMutatorInterface>> */\n    private array $mutators = [];\n\n    public function add(string $resourceClass, ResourceMutatorInterface $mutator): void\n    {\n        $this->mutators[$resourceClass][] = $mutator;\n    }\n\n    public function get(string $id): array\n    {\n        return $this->mutators[$id] ?? [];\n    }\n\n    public function has(string $id): bool\n    {\n        return isset($this->mutators[$id]);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Mutator/ResourceMutatorCollectionInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Mutator;\n\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Resource\\Metadata\\ResourceMutatorInterface;\n\n/**\n * Collection of Resource mutators to mutate ResourceMetadata.\n *\n * @experimental\n */\ninterface ResourceMutatorCollectionInterface extends ContainerInterface\n{\n    /**\n     * @return list<ResourceMutatorInterface>\n     */\n    public function get(string $id): array;\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Operation/DashPathSegmentNameGenerator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Operation;\n\nuse Sylius\\Resource\\Metadata\\Inflector\\InflectorInterface;\n\n/**\n * Generate a path name with a dash separator according to a string and whether it's a collection or not.\n */\nfinal class DashPathSegmentNameGenerator implements PathSegmentNameGeneratorInterface\n{\n    public function __construct(\n        private readonly InflectorInterface $inflector,\n    ) {\n    }\n\n    /**\n     * @inheritdoc\n     */\n    public function getSegmentName(string $name, bool $pluralize = true): string\n    {\n        return $pluralize ? $this->inflector->dashize($this->inflector->pluralize($name)) : $this->inflector->dashize($name);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Operation/HttpOperationInitiator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Operation;\n\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\VarsResolverInterface;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class HttpOperationInitiator implements HttpOperationInitiatorInterface\n{\n    public function __construct(\n        private RegistryInterface $resourceRegistry,\n        private ResourceMetadataCollectionFactoryInterface $resourceMetadataCollectionFactory,\n        private ?VarsResolverInterface $varsResolver = null,\n    ) {\n        if (null === $varsResolver) {\n            trigger_deprecation(\n                'sylius/resource-bundle',\n                '1.14',\n                'Not passing an instance of \"%s\" as the third constructor argument for \"%s\" is deprecated and will not be supported in 2.0.',\n                VarsResolverInterface::class,\n                self::class,\n            );\n        }\n    }\n\n    public function initializeOperation(Request $request): ?HttpOperation\n    {\n        /** @var string|null $operationName */\n        $operationName = $request->attributes->get('_route');\n        $syliusOptions = $attributes = $request->attributes->all('_sylius');\n\n        /** @var string|class-string|null $resource */\n        $resource = $attributes['resource'] ?? null;\n\n        if (\n            [] === $syliusOptions ||\n            null === $resource ||\n            null === $operationName\n        ) {\n            return null;\n        }\n\n        if (str_contains($resource, '.')) {\n            $metadata = $this->resourceRegistry->get($resource);\n        } else {\n            $metadata = $this->resourceRegistry->getByClass($resource);\n        }\n\n        $syliusOptions['resource_class'] = $metadata->getClass('model');\n        $request->attributes->set('_sylius', $syliusOptions);\n\n        /** @var HttpOperation $operation */\n        $operation = $this->resourceMetadataCollectionFactory->create($metadata->getClass('model'))\n            ->getOperation($metadata->getAlias(), $operationName)\n        ;\n\n        return $this->getOperationWithVars($operation);\n    }\n\n    private function getOperationWithVars(HttpOperation $operation): HttpOperation\n    {\n        $operationVars = $operation->getVars();\n        $resolvedOperationVars = $operationVars !== null ? $this->resolveVars($operationVars) : null;\n\n        $resourceVars = $operation->getResource()?->getVars();\n        $resolvedResourceVars = $resourceVars !== null ? $this->resolveVars($resourceVars) : null;\n\n        if (null === $resolvedOperationVars && null === $resolvedResourceVars) {\n            return $operation;\n        }\n\n        $mergedVars = array_merge($resolvedResourceVars ?? [], $resolvedOperationVars ?? []);\n\n        return $operation->withVars($mergedVars);\n    }\n\n    private function resolveVars(array $vars): array\n    {\n        if (null === $this->varsResolver) {\n            return $vars;\n        }\n\n        return $this->varsResolver->resolve($vars);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Operation/HttpOperationInitiatorInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Operation;\n\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\ninterface HttpOperationInitiatorInterface\n{\n    public function initializeOperation(Request $request): ?HttpOperation;\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Operation/PathSegmentNameGeneratorInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Operation;\n\n/**\n * Generates a path name according to a string and whether it's a collection or not.\n */\ninterface PathSegmentNameGeneratorInterface\n{\n    /**\n     * Transforms a given string to a valid path name which can be pluralized (eg. for collections).\n     *\n     * @param string $name Usually a ResourceMetadata shortname\n     *\n     * @return string A string that is a part of the route name\n     */\n    public function getSegmentName(string $name, bool $pluralize = true): string;\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Operation/UnderscorePathSegmentNameGenerator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Operation;\n\nuse Sylius\\Resource\\Metadata\\Inflector\\InflectorInterface;\n\n/**\n * Generate a path name with an underscore separator according to a string and whether it's a collection or not.\n */\nfinal class UnderscorePathSegmentNameGenerator implements PathSegmentNameGeneratorInterface\n{\n    public function __construct(\n        private readonly InflectorInterface $inflector,\n    ) {\n    }\n\n    /**\n     * @inheritdoc\n     */\n    public function getSegmentName(string $name, bool $pluralize = true): string\n    {\n        $name = $this->inflector->tableize($name);\n\n        return $pluralize ? $this->inflector->pluralize($name) : $name;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Operation.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * @experimental\n */\nabstract class Operation\n{\n    private ?ResourceMetadata $resource = null;\n\n    /** @var string|callable|null */\n    protected $provider;\n\n    /** @var string|callable|null */\n    protected $processor;\n\n    /** @var string|callable|null */\n    protected $responder;\n\n    /** @var string|callable|null */\n    protected $repository;\n\n    public function __construct(\n        protected ?string $template = null,\n        protected ?string $shortName = null,\n        protected ?string $name = null,\n        string|callable|null $provider = null,\n        string|callable|null $processor = null,\n        string|callable|null $responder = null,\n        string|callable|null $repository = null,\n        protected ?string $repositoryMethod = null,\n        protected ?array $repositoryArguments = null,\n        protected ?bool $read = null,\n        protected ?bool $write = null,\n        protected ?bool $validate = null,\n        protected ?bool $deserialize = null,\n        protected ?bool $serialize = null,\n        protected ?string $formType = null,\n        protected ?array $formOptions = null,\n        protected ?array $normalizationContext = null,\n        protected ?array $denormalizationContext = null,\n        protected ?array $validationContext = null,\n        protected ?string $eventShortName = null,\n        protected ?string $notificationMessage = null,\n        protected string|\\Stringable|null $security = null,\n        protected ?string $securityMessage = null,\n    ) {\n        $this->provider = $provider;\n        $this->processor = $processor;\n        $this->responder = $responder;\n        $this->repository = $repository;\n    }\n\n    public function getResource(): ?ResourceMetadata\n    {\n        return $this->resource;\n    }\n\n    public function withResource(ResourceMetadata $resource): self\n    {\n        $self = clone $this;\n        $self->resource = $resource;\n\n        return $self;\n    }\n\n    public function getTemplate(): ?string\n    {\n        return $this->template;\n    }\n\n    public function withTemplate(string $template): self\n    {\n        $self = clone $this;\n        $self->template = $template;\n\n        return $self;\n    }\n\n    public function getName(): ?string\n    {\n        return $this->name;\n    }\n\n    public function withName(string $name): self\n    {\n        $self = clone $this;\n        $self->name = $name;\n\n        return $self;\n    }\n\n    public function getShortName(): ?string\n    {\n        return $this->shortName;\n    }\n\n    public function withShortName(string $shortName): self\n    {\n        $self = clone $this;\n        $self->shortName = $shortName;\n\n        return $self;\n    }\n\n    public function getProvider(): callable|string|null\n    {\n        return $this->provider;\n    }\n\n    public function withProvider(string|callable|null $provider): self\n    {\n        $self = clone $this;\n        $self->provider = $provider;\n\n        return $self;\n    }\n\n    public function getProcessor(): callable|string|null\n    {\n        return $this->processor;\n    }\n\n    public function withProcessor(string|callable|null $processor): self\n    {\n        $self = clone $this;\n        $self->processor = $processor;\n\n        return $self;\n    }\n\n    public function getResponder(): callable|string|null\n    {\n        return $this->responder;\n    }\n\n    public function withResponder(string|callable|null $responder): self\n    {\n        $self = clone $this;\n        $self->responder = $responder;\n\n        return $self;\n    }\n\n    public function getRepository(): callable|string|null\n    {\n        return $this->repository;\n    }\n\n    public function withRepository(string|callable|null $repository): self\n    {\n        $self = clone $this;\n        $self->repository = $repository;\n\n        return $self;\n    }\n\n    public function getRepositoryMethod(): ?string\n    {\n        return $this->repositoryMethod;\n    }\n\n    public function withRepositoryMethod(string $repositoryMethod): self\n    {\n        $self = clone $this;\n        $self->repositoryMethod = $repositoryMethod;\n\n        return $self;\n    }\n\n    public function getRepositoryArguments(): ?array\n    {\n        return $this->repositoryArguments;\n    }\n\n    public function withRepositoryArguments(array $repositoryArguments): self\n    {\n        $self = clone $this;\n        $self->repositoryArguments = $repositoryArguments;\n\n        return $self;\n    }\n\n    public function canRead(): ?bool\n    {\n        return $this->read;\n    }\n\n    public function withRead(bool $read): self\n    {\n        $self = clone $this;\n        $self->read = $read;\n\n        return $self;\n    }\n\n    public function canWrite(): ?bool\n    {\n        return $this->write;\n    }\n\n    public function withWrite(bool $write): self\n    {\n        $self = clone $this;\n        $self->write = $write;\n\n        return $self;\n    }\n\n    public function canValidate(): ?bool\n    {\n        return $this->validate;\n    }\n\n    public function withValidate(bool $validate): self\n    {\n        $self = clone $this;\n        $self->validate = $validate;\n\n        return $self;\n    }\n\n    public function canDeserialize(): ?bool\n    {\n        return $this->deserialize;\n    }\n\n    public function withDeserialize(bool $deserialize): self\n    {\n        $self = clone $this;\n        $self->deserialize = $deserialize;\n\n        return $self;\n    }\n\n    public function canSerialize(): ?bool\n    {\n        return $this->serialize;\n    }\n\n    public function withSerialize(bool $serialize): self\n    {\n        $self = clone $this;\n        $self->serialize = $serialize;\n\n        return $self;\n    }\n\n    public function getFormType(): ?string\n    {\n        return $this->formType;\n    }\n\n    public function withFormType(string $formType): self\n    {\n        $self = clone $this;\n        $self->formType = $formType;\n\n        return $self;\n    }\n\n    public function getFormOptions(): ?array\n    {\n        return $this->formOptions;\n    }\n\n    public function withFormOptions(array $formOptions): self\n    {\n        $self = clone $this;\n        $self->formOptions = $formOptions;\n\n        return $self;\n    }\n\n    public function getNormalizationContext(): ?array\n    {\n        return $this->normalizationContext;\n    }\n\n    public function withNormalizationContext(?array $normalizationContext): self\n    {\n        $self = clone $this;\n        $self->normalizationContext = $normalizationContext;\n\n        return $self;\n    }\n\n    public function getDenormalizationContext(): ?array\n    {\n        return $this->denormalizationContext;\n    }\n\n    public function withDenormalizationContext(?array $denormalizationContext): self\n    {\n        $self = clone $this;\n        $self->denormalizationContext = $denormalizationContext;\n\n        return $self;\n    }\n\n    public function getValidationContext(): ?array\n    {\n        return $this->validationContext;\n    }\n\n    public function withValidationContext(?array $validationContext): self\n    {\n        $self = clone $this;\n        $self->validationContext = $validationContext;\n\n        return $self;\n    }\n\n    public function getEventShortName(): ?string\n    {\n        return $this->eventShortName;\n    }\n\n    public function withEventShortName(string $eventShortName): self\n    {\n        $self = clone $this;\n        $self->eventShortName = $eventShortName;\n\n        return $self;\n    }\n\n    public function getNotificationMessage(): ?string\n    {\n        return $this->notificationMessage;\n    }\n\n    public function withNotificationMessage(string $notificationMessage): self\n    {\n        $self = clone $this;\n        $self->notificationMessage = $notificationMessage;\n\n        return $self;\n    }\n\n    public function getSecurity(): ?string\n    {\n        return $this->security instanceof \\Stringable ? (string) $this->security : $this->security;\n    }\n\n    public function withSecurity(string|\\Stringable|null $security): static\n    {\n        $self = clone $this;\n        $self->security = $security;\n\n        return $self;\n    }\n\n    public function getSecurityMessage(): ?string\n    {\n        return $this->securityMessage;\n    }\n\n    public function withSecurityMessage(?string $securityMessage): static\n    {\n        $self = clone $this;\n        $self->securityMessage = $securityMessage;\n\n        return $self;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/OperationAccessCheckerInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\nuse Sylius\\Resource\\Context\\Context;\n\ninterface OperationAccessCheckerInterface\n{\n    /**\n     * Checks if the current user can access the given operation.\n     *\n     * @param array{object?: object|array|null} $extraVariables\n     */\n    public function isGranted(Operation $operation, Context $context, array $extraVariables = []): bool;\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/OperationMutatorInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\ninterface OperationMutatorInterface\n{\n    public function __invoke(Operation $operation): Operation;\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Operations.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\nuse RuntimeException;\n\n/**\n * @experimental\n *\n * @template T of Operation\n */\nfinal class Operations implements \\IteratorAggregate, \\Countable\n{\n    private array $operations = [];\n\n    /**\n     * @param array<string|int, T> $operations\n     */\n    public function __construct(array $operations = [])\n    {\n        foreach ($operations as $operationName => $operation) {\n            $this->operations[] = [$operationName, $operation];\n        }\n    }\n\n    /**\n     * @return \\Iterator<string, T>\n     */\n    public function getIterator(): \\Traversable\n    {\n        return (function (): \\Generator {\n            foreach ($this->operations as [$operationName, $operation]) {\n                yield $operationName => $operation;\n            }\n        })();\n    }\n\n    public function get(string $key): Operation\n    {\n        foreach ($this->operations as [$operationName, $operation]) {\n            if ($operationName === $key) {\n                return $operation;\n            }\n        }\n\n        throw new \\RuntimeException(sprintf('No Operation with key \"%s\" was found', $key));\n    }\n\n    /**\n     * @param T $value\n     *\n     * @return self<T>\n     */\n    public function add(string $key, Operation $value): self\n    {\n        foreach ($this->operations as $i => [$operationName, $operation]) {\n            if ($operationName === $key) {\n                $this->operations[$i] = [$key, $value];\n\n                return $this;\n            }\n        }\n\n        $this->operations[] = [$key, $value];\n\n        return $this;\n    }\n\n    /**\n     * @return self<T>\n     */\n    public function remove(string $key): self\n    {\n        foreach ($this->operations as $i => [$operationName, $operation]) {\n            if ($operationName === $key) {\n                unset($this->operations[$i]);\n\n                return $this;\n            }\n        }\n\n        throw new RuntimeException(sprintf('Could not remove operation \"%s\".', $key));\n    }\n\n    public function has(string $key): bool\n    {\n        foreach ($this->operations as $i => [$operationName, $operation]) {\n            if ($operationName === $key) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    public function count(): int\n    {\n        return \\count($this->operations);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Registry.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\nfinal class Registry implements RegistryInterface\n{\n    /** @var array|MetadataInterface[] */\n    private array $metadata = [];\n\n    public function getAll(): iterable\n    {\n        return $this->metadata;\n    }\n\n    public function get(string $alias): MetadataInterface\n    {\n        if (!array_key_exists($alias, $this->metadata)) {\n            throw new \\InvalidArgumentException(sprintf('Resource \"%s\" does not exist.', $alias));\n        }\n\n        return $this->metadata[$alias];\n    }\n\n    public function getByClass(string $className): MetadataInterface\n    {\n        foreach ($this->metadata as $metadata) {\n            if ($className === $metadata->getClass('model')) {\n                return $metadata;\n            }\n        }\n\n        throw new \\InvalidArgumentException(sprintf('Resource with model class \"%s\" does not exist.', $className));\n    }\n\n    public function add(MetadataInterface $metadata): void\n    {\n        $this->metadata[$metadata->getAlias()] = $metadata;\n    }\n\n    public function addFromAliasAndConfiguration(string $alias, array $configuration): void\n    {\n        $this->add(Metadata::fromAliasAndConfiguration($alias, $configuration));\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Metadata\\Registry::class, false)) {\n    class_alias(Registry::class, \\Sylius\\Component\\Resource\\Metadata\\Registry::class);\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/RegistryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * Interface for the registry of all resources.\n */\ninterface RegistryInterface\n{\n    /**\n     * @return iterable|MetadataInterface[]\n     */\n    public function getAll(): iterable;\n\n    /**\n     * @throws \\InvalidArgumentException\n     */\n    public function get(string $alias): MetadataInterface;\n\n    /**\n     * @throws \\InvalidArgumentException\n     */\n    public function getByClass(string $className): MetadataInterface;\n\n    public function add(MetadataInterface $metadata): void;\n\n    public function addFromAliasAndConfiguration(string $alias, array $configuration): void;\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Metadata\\RegistryInterface::class, false)) {\n    class_alias(RegistryInterface::class, \\Sylius\\Component\\Resource\\Metadata\\RegistryInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/AttributesResourceClassListFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceClassList;\nuse Sylius\\Resource\\Reflection\\ClassReflection;\nuse Sylius\\Resource\\Reflection\\ReflectionClassRecursiveIterator;\n\n/**\n * Creates a resource class list from {@see AsResource} attributes.\n *\n * @experimental\n */\nfinal class AttributesResourceClassListFactory implements ResourceClassListFactoryInterface\n{\n    /** @param array{paths: string[]} $mapping */\n    public function __construct(\n        private readonly array $mapping,\n        private readonly ?ResourceClassListFactoryInterface $decorated = null,\n    ) {\n    }\n\n    /**\n     * @inheritdoc\n     */\n    public function create(): ResourceClassList\n    {\n        $classes = [];\n\n        if ($this->decorated) {\n            foreach ($this->decorated->create() as $resourceClass) {\n                $classes[$resourceClass] = true;\n            }\n        }\n\n        $paths = $this->mapping['paths'] ?? [];\n\n        foreach (ReflectionClassRecursiveIterator::getReflectionClassesFromDirectories($paths) as $reflectionClass) {\n            $resourceClass = $reflectionClass->getName();\n\n            if ([] === ClassReflection::getClassAttributes($resourceClass, AsResource::class)) {\n                continue;\n            }\n\n            $classes[$resourceClass] = true;\n        }\n\n        return new ResourceClassList(array_keys($classes));\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/AttributesResourceMetadataCollectionFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Reflection\\ClassReflection;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RouteName\\OperationRouteNameFactoryInterface;\n\nfinal class AttributesResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface\n{\n    use OperationDefaultsTrait;\n\n    public function __construct(\n        private readonly RegistryInterface $resourceRegistry,\n        private readonly OperationRouteNameFactoryInterface $operationRouteNameFactory,\n    ) {\n    }\n\n    public function create(string $resourceClass): ResourceMetadataCollection\n    {\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n\n        $attributes = ClassReflection::getClassAttributes($resourceClass);\n\n        foreach ($this->buildResourceOperations($attributes, $resourceClass) as $resource) {\n            $resourceMetadataCollection[] = $resource;\n        }\n\n        return $resourceMetadataCollection;\n    }\n\n    /**\n     * @param \\ReflectionAttribute[] $attributes\n     *\n     * @return ResourceMetadata[]\n     */\n    private function buildResourceOperations(array $attributes, string $resourceClass): array\n    {\n        /** @var array<int, ResourceMetadata> $resources */\n        $resources = [];\n        $index = -1;\n\n        foreach ($attributes as $attribute) {\n            if (is_a($attribute->getName(), AsResource::class, true)) {\n                /** @var AsResource $resourceAttribute */\n                $resourceAttribute = $attribute->newInstance();\n                $resource = $resourceAttribute->toMetadata();\n\n                $resourceAlias = $resource->getAlias();\n\n                if (null !== $resourceAlias) {\n                    $resourceConfiguration = $this->resourceRegistry->get($resource->getAlias() ?? '');\n                } else {\n                    $resourceConfiguration = $this->resourceRegistry->getByClass($resourceClass);\n                }\n\n                $resource = $this->getResourceWithDefaults($resourceClass, $resource, $resourceConfiguration);\n                $resources[++$index] = $resource;\n                $operations = [];\n\n                /** @var Operation $operation */\n                foreach ($resource->getOperations() ?? new Operations() as $operation) {\n                    [$key, $operation] = $this->getOperationWithDefaults($operation, $resources[$index], $this->operationRouteNameFactory, $this->resourceRegistry);\n                    $operations[$key] = $operation;\n                }\n\n                if ($operations) {\n                    $resources[$index] = $resources[$index]->withOperations(new Operations($operations));\n                }\n\n                continue;\n            }\n\n            if (null === ($resources[$index] ?? null)) {\n                try {\n                    $resourceConfiguration = $this->resourceRegistry->getByClass($resourceClass);\n\n                    $resource = new ResourceMetadata($resourceConfiguration->getAlias());\n                    $resource = $this->getResourceWithDefaults($resourceClass, $resource, $resourceConfiguration);\n\n                    $resources[++$index] = $resource;\n                } catch(\\InvalidArgumentException) {\n                }\n            }\n\n            if (!is_subclass_of($attribute->getName(), Operation::class)) {\n                continue;\n            }\n\n            /** @var Operation $operationAttribute */\n            $operationAttribute = $attribute->newInstance();\n\n            [$key, $operation] = $this->getOperationWithDefaults($operationAttribute, $resources[$index], $this->operationRouteNameFactory, $this->resourceRegistry);\n\n            $operations = $resources[$index]->getOperations() ?? new Operations();\n\n            $resources[$index] = $resources[$index]->withOperations($operations);\n            $resources[$index] = $resources[$index]->withOperations($operations->add($key, $operation));\n        }\n\n        return $resources;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/CachedResourceClassListFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Psr\\Cache\\CacheItemPoolInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceClassList;\nuse Sylius\\Resource\\Metadata\\Util\\CachedTrait;\n\n/**\n * Caches resource class list.\n */\nfinal class CachedResourceClassListFactory implements ResourceClassListFactoryInterface\n{\n    use CachedTrait;\n\n    public const CACHE_KEY = 'resource_class_list';\n\n    public function __construct(CacheItemPoolInterface $cacheItemPool, private readonly ResourceClassListFactoryInterface $decorated)\n    {\n        $this->cacheItemPool = $cacheItemPool;\n    }\n\n    /**\n     * @inheritdoc\n     */\n    public function create(): ResourceClassList\n    {\n        return $this->getCached(self::CACHE_KEY, fn (): ResourceClassList => $this->decorated->create());\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/CachedResourceMetadataCollectionFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Psr\\Cache\\CacheException;\nuse Psr\\Cache\\CacheItemPoolInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\n\n/**\n * This class in inspired by this API Platform one:\n *\n * @see https://github.com/api-platform/core/blob/main/src/Metadata/Resource/Factory/CachedResourceMetadataCollectionFactory.php\n */\nfinal class CachedResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface\n{\n    public const CACHE_KEY_PREFIX = 'sylius_resource_metadata_collection_';\n\n    private array $localCache = [];\n\n    public function __construct(\n        private CacheItemPoolInterface $cacheItemPool,\n        private ResourceMetadataCollectionFactoryInterface $decorated,\n    ) {\n    }\n\n    public function create(string $resourceClass): ResourceMetadataCollection\n    {\n        $cacheKey = self::CACHE_KEY_PREFIX . md5($resourceClass);\n        if (\\array_key_exists($cacheKey, $this->localCache)) {\n            return new ResourceMetadataCollection($this->localCache[$cacheKey]);\n        }\n\n        try {\n            $cacheItem = $this->cacheItemPool->getItem($cacheKey);\n        } catch (CacheException) {\n            $resourceMetadataCollection = $this->decorated->create($resourceClass);\n            $this->localCache[$cacheKey] = (array) $resourceMetadataCollection;\n\n            return $resourceMetadataCollection;\n        }\n\n        if ($cacheItem->isHit()) {\n            $this->localCache[$cacheKey] = $cacheItem->get();\n\n            return new ResourceMetadataCollection($this->localCache[$cacheKey]);\n        }\n\n        $resourceMetadataCollection = $this->decorated->create($resourceClass);\n        $this->localCache[$cacheKey] = (array) $resourceMetadataCollection;\n        $cacheItem->set($this->localCache[$cacheKey]);\n        $this->cacheItemPool->save($cacheItem);\n\n        return $resourceMetadataCollection;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/EventShortNameResourceMetadataCollectionFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Metadata\\ApplyStateMachineTransition;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\ResourceActions;\n\nfinal class EventShortNameResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface\n{\n    public function __construct(\n        private ResourceMetadataCollectionFactoryInterface $decorated,\n    ) {\n    }\n\n    public function create(string $resourceClass): ResourceMetadataCollection\n    {\n        $resourceCollectionMetadata = $this->decorated->create($resourceClass);\n\n        /** @var ResourceMetadata $resource */\n        foreach ($resourceCollectionMetadata->getIterator() as $i => $resource) {\n            $operations = $resource->getOperations() ?? new Operations();\n\n            /** @var Operation $operation */\n            foreach ($operations as $operation) {\n                /** @var string $key */\n                $key = $operation->getName();\n\n                $operations->add($key, $this->addDefaults($operation));\n            }\n\n            $resource = $resource->withOperations($operations);\n\n            $resourceCollectionMetadata[$i] = $resource;\n        }\n\n        return $resourceCollectionMetadata;\n    }\n\n    private function addDefaults(Operation $operation): Operation\n    {\n        if (null === $operation->getEventShortName()) {\n            $shortName = $operation instanceof ApplyStateMachineTransition ? ResourceActions::UPDATE : $operation->getShortName() ?? '';\n\n            $bulkPrefix = 'bulk_';\n\n            if (\\str_starts_with($shortName, $bulkPrefix)) {\n                $shortName = substr($shortName, strlen($bulkPrefix));\n            }\n\n            $operation = $operation->withEventShortName($shortName);\n        }\n\n        return $operation;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/FactoryResourceMetadataCollectionFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Metadata\\FactoryAwareOperationInterface;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nfinal class FactoryResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface\n{\n    public function __construct(\n        private RegistryInterface $resourceRegistry,\n        private ResourceMetadataCollectionFactoryInterface $decorated,\n    ) {\n    }\n\n    public function create(string $resourceClass): ResourceMetadataCollection\n    {\n        $resourceCollectionMetadata = $this->decorated->create($resourceClass);\n\n        /** @var ResourceMetadata $resource */\n        foreach ($resourceCollectionMetadata->getIterator() as $i => $resource) {\n            $resourceConfiguration = $this->resourceRegistry->get($resource->getAlias() ?? '');\n            $operations = $resource->getOperations() ?? new Operations();\n\n            /** @var Operation|(Operation&FactoryAwareOperationInterface) $operation */\n            foreach ($operations as $operation) {\n                if (!$operation instanceof FactoryAwareOperationInterface) {\n                    continue;\n                }\n\n                /** @var string $key */\n                $key = $operation->getName();\n\n                /** @var Operation&FactoryAwareOperationInterface $operation */\n                $operation = $this->addDefaults($resourceConfiguration, $resource, $operation);\n\n                $operations->add($key, $operation);\n            }\n\n            $resource = $resource->withOperations($operations);\n\n            $resourceCollectionMetadata[$i] = $resource;\n        }\n\n        return $resourceCollectionMetadata;\n    }\n\n    private function addDefaults(MetadataInterface $resourceConfiguration, ResourceMetadata $resource, FactoryAwareOperationInterface $operation): FactoryAwareOperationInterface\n    {\n        if (null === $operation->getFactory() && str_starts_with($resourceConfiguration->getDriver() ?: '', 'doctrine')) {\n            $operation = $operation->withFactory($resourceConfiguration->getServiceId('factory'));\n        }\n\n        if (null === $operation->getFactoryMethod()) {\n            $operation = $operation->withFactoryMethod('createNew');\n        }\n\n        return $operation;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/MutatorResourceMetadataCollectionFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Metadata\\Mutator\\OperationMutatorCollectionInterface;\nuse Sylius\\Resource\\Metadata\\Mutator\\ResourceMutatorCollectionInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nfinal class MutatorResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface\n{\n    public function __construct(\n        private readonly ResourceMutatorCollectionInterface $resourceMutators,\n        private readonly OperationMutatorCollectionInterface $operationMutators,\n        private readonly ?ResourceMetadataCollectionFactoryInterface $decorated = null,\n    ) {\n    }\n\n    public function create(string $resourceClass): ResourceMetadataCollection\n    {\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        if ($this->decorated) {\n            $resourceMetadataCollection = $this->decorated->create($resourceClass);\n        }\n\n        $newMetadataCollection = new ResourceMetadataCollection();\n\n        /** @var ResourceMetadata $resource */\n        foreach ($resourceMetadataCollection as $resource) {\n            $resource = $this->mutateResource($resource, $resourceClass);\n            $operations = $this->mutateOperations($resource->getOperations() ?? new Operations());\n            $resource = $resource->withOperations($operations);\n\n            $newMetadataCollection[] = $resource;\n        }\n\n        return $newMetadataCollection;\n    }\n\n    private function mutateResource(ResourceMetadata $resource, string $resourceClass): ResourceMetadata\n    {\n        foreach ($this->resourceMutators->get($resourceClass) as $mutator) {\n            $resource = $mutator($resource);\n        }\n\n        return $resource;\n    }\n\n    /**\n     * @template T of Operation\n     *\n     * @param Operations<T> $operations\n     *\n     * @return Operations<T>\n     */\n    private function mutateOperations(Operations $operations): Operations\n    {\n        $newOperations = new Operations();\n\n        foreach ($operations as $key => $operation) {\n            foreach ($this->operationMutators->get($key) as $mutator) {\n                $operation = $mutator($operation);\n            }\n\n            $newOperations->add($key, $operation);\n        }\n\n        return $newOperations;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/OperationDefaultsTrait.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Symfony\\Request\\State\\Responder;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RouteName\\OperationRouteNameFactoryInterface;\n\n/**\n * @internal\n */\ntrait OperationDefaultsTrait\n{\n    private function getResourceWithDefaults(\n        string $resourceClass,\n        ResourceMetadata $resource,\n        MetadataInterface $resourceConfiguration,\n    ): ResourceMetadata {\n        $resource = $resource->withClass($resourceClass);\n\n        if (null === $resource->getAlias()) {\n            $resource = $resource->withAlias($resourceConfiguration->getAlias());\n        }\n\n        if (null === $resource->getApplicationName()) {\n            $resource = $resource->withApplicationName($resourceConfiguration->getApplicationName());\n        }\n\n        if (null === $resource->getName()) {\n            $resource = $resource->withName($resourceConfiguration->getName());\n        }\n\n        return $resource;\n    }\n\n    private function getOperationWithDefaults(\n        Operation $operation,\n        ResourceMetadata $resource,\n        OperationRouteNameFactoryInterface $operationRouteNameFactory,\n        RegistryInterface $resourceRegistry,\n    ): array {\n        $resourceConfiguration = $resourceRegistry->get($resource->getAlias() ?? '');\n\n        $operation = $operation->withResource($resource);\n\n        if (null === $resource->getName()) {\n            $resourceName = $resourceConfiguration->getName();\n\n            $resource = $resource->withName($resourceName);\n            $operation = $operation->withResource($resource);\n        }\n\n        if (null === $resource->getPluralName()) {\n            $resourcePluralName = $resourceConfiguration->getPluralName();\n\n            $resource = $resource->withPluralName($resourcePluralName);\n            $operation = $operation->withResource($resource);\n        }\n\n        if (null === $operation->getNormalizationContext()) {\n            $operation = $operation->withNormalizationContext($resource->getNormalizationContext());\n        }\n\n        if (null === $operation->getDenormalizationContext()) {\n            $operation = $operation->withDenormalizationContext($resource->getDenormalizationContext());\n        }\n\n        if (null === $operation->getValidationContext()) {\n            $operation = $operation->withValidationContext($resource->getValidationContext());\n        }\n\n        $operation = $operation->withResource($resource);\n\n        if (null === $operation->getRepository()) {\n            $operation = $operation->withRepository($resourceConfiguration->getServiceId('repository'));\n        }\n\n        if (null === $operation->getFormType()) {\n            $formType = $resource->getFormType();\n            $formType ??= $resourceConfiguration->hasClass('form') ? $resourceConfiguration->getClass('form') : null;\n\n            if (null !== $formType) {\n                $operation = $operation->withFormType($formType);\n            }\n        }\n\n        if (null !== $operation->getFormType()) {\n            $formOptions = $this->buildFormOptions($operation, $resourceConfiguration);\n            $operation = $operation->withFormOptions($formOptions);\n        }\n\n        if ($operation instanceof HttpOperation) {\n            if (null === $operation->getRoutePrefix()) {\n                $operation = $operation->withRoutePrefix($resource->getRoutePrefix());\n            }\n\n            if (null === $operation->getRouteRequirements()) {\n                $operation = $operation->withRouteRequirements($resource->getRouteRequirements());\n            }\n\n            if (null === $operation->getRouteCondition()) {\n                $operation = $operation->withRouteCondition($resource->getRouteCondition());\n            }\n\n            if (null === $operation->getRoutePriority()) {\n                $operation = $operation->withRoutePriority($resource->getRoutePriority());\n            }\n\n            if (null === $operation->getTwigContextFactory()) {\n                $operation = $operation->withTwigContextFactory('sylius.twig.context.factory.default');\n            }\n\n            if (null === $routeName = $operation->getRouteName()) {\n                $routeName = $operationRouteNameFactory->createRouteName($operation);\n                $operation = $operation->withRouteName($routeName);\n            }\n\n            if (null === $operation->getResponder()) {\n                $operation = $operation->withResponder(Responder::class);\n            }\n\n            $operation = $operation->withName($routeName);\n        }\n\n        $operationName = $operation->getName();\n\n        return [$operationName, $operation];\n    }\n\n    private function buildFormOptions(Operation $operation, MetadataInterface $resourceConfiguration): array\n    {\n        $formOptions = array_merge(\n            ['data_class' => $resourceConfiguration->getClass('model')],\n            $operation->getFormOptions() ?? [],\n        );\n\n        $validationGroups = $operation->getValidationContext()['groups'] ?? null;\n\n        if (null !== $validationGroups) {\n            $formOptions = array_merge(['validation_groups' => $validationGroups], $formOptions);\n        }\n\n        return $formOptions;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/PhpFileResourceClassListFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Metadata\\Extractor\\ResourceExtractorInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceClassList;\n\n/**\n * Creates a resource class list from PHP configuration files.\n *\n * @experimental\n */\nfinal class PhpFileResourceClassListFactory implements ResourceClassListFactoryInterface\n{\n    public function __construct(\n        private readonly ResourceExtractorInterface $phpFileResourceMetadataExtractor,\n        private readonly ?ResourceClassListFactoryInterface $decorated = null,\n    ) {\n    }\n\n    public function create(): ResourceClassList\n    {\n        $classes = [];\n\n        if ($this->decorated) {\n            foreach ($this->decorated->create() as $resourceClass) {\n                $classes[$resourceClass] = true;\n            }\n        }\n\n        foreach ($this->phpFileResourceMetadataExtractor->getResources() as $resource) {\n            $resourceClass = $resource->getClass();\n\n            if (null === $resourceClass) {\n                continue;\n            }\n\n            $classes[$resourceClass] = true;\n        }\n\n        return new ResourceClassList(array_keys($classes));\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/PhpFileResourceMetadataCollectionFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Metadata\\Extractor\\ResourceExtractorInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RouteName\\OperationRouteNameFactoryInterface;\n\n/**\n * @experimental\n */\nfinal class PhpFileResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface\n{\n    use OperationDefaultsTrait;\n\n    public function __construct(\n        private readonly RegistryInterface $resourceRegistry,\n        private readonly OperationRouteNameFactoryInterface $operationRouteNameFactory,\n        private readonly ResourceExtractorInterface $phpfileResourceMetadataExtractor,\n        private readonly ?ResourceMetadataCollectionFactoryInterface $decorated = null,\n    ) {\n    }\n\n    public function create(string $resourceClass): ResourceMetadataCollection\n    {\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        if ($this->decorated) {\n            $resourceMetadataCollection = $this->decorated->create($resourceClass);\n        }\n\n        foreach ($this->phpfileResourceMetadataExtractor->getResources() as $resource) {\n            if ($resourceClass !== $resource->getClass()) {\n                continue;\n            }\n\n            $resourceAlias = $resource->getAlias();\n            if (null !== $resourceAlias) {\n                $resourceConfiguration = $this->resourceRegistry->get($resourceAlias);\n            } else {\n                $resourceConfiguration = $this->resourceRegistry->getByClass($resourceClass);\n            }\n\n            $resource = $this->getResourceWithDefaults($resourceClass, $resource, $resourceConfiguration);\n\n            $operations = [];\n            /** @var Operation $operation */\n            foreach ($resource->getOperations() ?? new Operations() as $operation) {\n                [$key, $operation] = $this->getOperationWithDefaults($operation, $resource, $this->operationRouteNameFactory, $this->resourceRegistry);\n                $operations[$key] = $operation;\n            }\n\n            if ($operations) {\n                $resource = $resource->withOperations(new Operations($operations));\n            }\n\n            $resourceMetadataCollection[] = $resource;\n        }\n\n        return $resourceMetadataCollection;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/PluralNameResourceMetadataCollectionFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Exception\\LogicException;\nuse Sylius\\Resource\\Metadata\\Inflector\\InflectorInterface;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\n/**\n * @experimental\n */\nfinal class PluralNameResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface\n{\n    public function __construct(\n        private readonly ResourceMetadataCollectionFactoryInterface $decorated,\n        private readonly InflectorInterface $inflector,\n        private readonly bool $routingBcLayerEnabled = true,\n        private readonly ?RegistryInterface $resourceRegistry = null,\n    ) {\n    }\n\n    public function create(string $resourceClass): ResourceMetadataCollection\n    {\n        $resourceCollectionMetadata = $this->decorated->create($resourceClass);\n\n        /** @var ResourceMetadata $resource */\n        foreach ($resourceCollectionMetadata->getIterator() as $i => $resource) {\n            $resourceCollectionMetadata[$i] = $this->addDefaults($resource);\n        }\n\n        return $resourceCollectionMetadata;\n    }\n\n    private function addDefaults(ResourceMetadata $resource): ResourceMetadata\n    {\n        if (null !== $resource->getPluralName()) {\n            return $resource;\n        }\n\n        if ($this->routingBcLayerEnabled) {\n            if (null === $this->resourceRegistry) {\n                throw new LogicException(sprintf(\n                    'Routing Bc-Layer is enabled, but the resource registry is not passed as constructor arguments of \"%s\" class.',\n                    self::class,\n                ));\n            }\n\n            $resourceConfiguration = $this->resourceRegistry->get($resource->getAlias() ?? '');\n\n            return $resource->withPluralName($resourceConfiguration->getPluralName());\n        }\n\n        /**\n         * Resource name has already been configured.\n         *\n         * @see OperationDefaultsTrait\n         *\n         * @var string $resourceName\n         */\n        $resourceName = $resource->getName();\n\n        return $resource->withPluralName($this->inflector->pluralize($resourceName));\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/ProviderResourceMetadataCollectionFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Grid\\State\\RequestGridProvider;\nuse Sylius\\Resource\\Metadata\\GridAwareOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Symfony\\Request\\State\\Provider;\n\nfinal class ProviderResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface\n{\n    public function __construct(\n        private ResourceMetadataCollectionFactoryInterface $decorated,\n    ) {\n    }\n\n    public function create(string $resourceClass): ResourceMetadataCollection\n    {\n        $resourceCollectionMetadata = $this->decorated->create($resourceClass);\n\n        /** @var ResourceMetadata $resource */\n        foreach ($resourceCollectionMetadata->getIterator() as $i => $resource) {\n            $operations = $resource->getOperations() ?? new Operations();\n\n            /** @var Operation $operation */\n            foreach ($operations as $operation) {\n                /** @var string $key */\n                $key = $operation->getName();\n\n                $operations->add($key, $this->addDefaults($operation));\n            }\n\n            $resource = $resource->withOperations($operations);\n\n            $resourceCollectionMetadata[$i] = $resource;\n        }\n\n        return $resourceCollectionMetadata;\n    }\n\n    private function addDefaults(Operation $operation): Operation\n    {\n        if (\n            null === $operation->getProvider() &&\n            $operation instanceof GridAwareOperationInterface &&\n            null !== $operation->getGrid()\n        ) {\n            $operation = $operation->withProvider(RequestGridProvider::class);\n        }\n\n        if (null === $operation->getProvider()) {\n            $operation = $operation->withProvider(Provider::class);\n        }\n\n        return $operation;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/RedirectResourceMetadataCollectionFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Metadata\\BulkOperationInterface;\nuse Sylius\\Resource\\Metadata\\CreateOperationInterface;\nuse Sylius\\Resource\\Metadata\\DeleteOperationInterface;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\UpdateOperationInterface;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RouteName\\OperationRouteNameFactory;\n\nfinal class RedirectResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface\n{\n    public function __construct(\n        private OperationRouteNameFactory $operationRouteNameFactory,\n        private ResourceMetadataCollectionFactoryInterface $decorated,\n    ) {\n    }\n\n    public function create(string $resourceClass): ResourceMetadataCollection\n    {\n        $resourceCollectionMetadata = $this->decorated->create($resourceClass);\n\n        /** @var ResourceMetadata $resource */\n        foreach ($resourceCollectionMetadata->getIterator() as $i => $resource) {\n            $operations = $resource->getOperations() ?? new Operations();\n\n            /** @var Operation $operation */\n            foreach ($operations as $operation) {\n                if (!$operation instanceof HttpOperation) {\n                    continue;\n                }\n\n                /** @var string $key */\n                $key = $operation->getName();\n\n                $operations->add($key, $this->addDefaults($resource, $operation));\n            }\n\n            $resource = $resource->withOperations($operations);\n\n            $resourceCollectionMetadata[$i] = $resource;\n        }\n\n        return $resourceCollectionMetadata;\n    }\n\n    private function addDefaults(ResourceMetadata $resource, HttpOperation $operation): Operation\n    {\n        if (null !== $operation->getRedirectToRoute()) {\n            return $operation;\n        }\n\n        if ($operation instanceof BulkOperationInterface) {\n            $newOperation = $this->setRedirectIfRouteExists($resource, $operation, 'index');\n\n            if (null !== $newOperation) {\n                return $newOperation;\n            }\n        }\n\n        if (\n            $operation instanceof CreateOperationInterface ||\n            $operation instanceof UpdateOperationInterface\n        ) {\n            $newOperation = $this->setRedirectIfRouteExists($resource, $operation, 'show');\n\n            if (null !== $newOperation) {\n                return $newOperation;\n            }\n\n            $newOperation = $this->setRedirectIfRouteExists($resource, $operation, 'index');\n\n            if (null !== $newOperation) {\n                return $newOperation;\n            }\n        }\n\n        if ($operation instanceof DeleteOperationInterface) {\n            $newOperation = $this->setRedirectIfRouteExists($resource, $operation, 'index');\n\n            if (null !== $newOperation) {\n                return $newOperation;\n            }\n        }\n\n        return $operation;\n    }\n\n    private function setRedirectIfRouteExists(ResourceMetadata $resource, HttpOperation $operation, string $shortName): ?Operation\n    {\n        $routeName = $this->operationRouteNameFactory->createRouteName($operation, $shortName);\n\n        if ($resource->hasOperation($routeName)) {\n            return $operation->withRedirectToRoute($routeName);\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/ResourceClassListFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceClassList;\n\n/**\n * Creates a resource class list value object.\n *\n * @experimental\n */\ninterface ResourceClassListFactoryInterface\n{\n    /**\n     * Creates the resource class list.\n     */\n    public function create(): ResourceClassList;\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/ResourceMetadataCollectionFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\n\ninterface ResourceMetadataCollectionFactoryInterface\n{\n    /**\n     * Creates a resource metadata.\n     *\n     * @param class-string $resourceClass\n     */\n    public function create(string $resourceClass): ResourceMetadataCollection;\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/StateMachineResourceMetadataCollectionFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\StateMachineAwareOperationInterface;\nuse Sylius\\Resource\\StateMachine\\State\\ApplyStateMachineTransitionProcessor;\n\nfinal class StateMachineResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface\n{\n    public function __construct(\n        private RegistryInterface $resourceRegistry,\n        private ResourceMetadataCollectionFactoryInterface $decorated,\n        private ?string $defaultStateMachineComponent,\n    ) {\n    }\n\n    public function create(string $resourceClass): ResourceMetadataCollection\n    {\n        $resourceCollectionMetadata = $this->decorated->create($resourceClass);\n\n        /** @var ResourceMetadata $resource */\n        foreach ($resourceCollectionMetadata->getIterator() as $i => $resource) {\n            $resourceConfiguration = $this->resourceRegistry->get($resource->getAlias() ?? '');\n            $operations = $resource->getOperations() ?? new Operations();\n\n            /** @var Operation $operation */\n            foreach ($operations as $operation) {\n                /** @var string $key */\n                $key = $operation->getName();\n\n                $operations->add($key, $this->addDefaults($resourceConfiguration, $operation));\n            }\n\n            $resource = $resource->withOperations($operations);\n\n            $resourceCollectionMetadata[$i] = $resource;\n        }\n\n        return $resourceCollectionMetadata;\n    }\n\n    private function addDefaults(MetadataInterface $resourceConfiguration, Operation $operation): Operation\n    {\n        if (!$operation instanceof StateMachineAwareOperationInterface) {\n            return $operation;\n        }\n\n        if (\n            null === $operation->getStateMachineComponent() &&\n            method_exists($resourceConfiguration, 'getStateMachineComponent')\n        ) {\n            $stateMachineComponent = $resourceConfiguration->getStateMachineComponent() ?? $this->defaultStateMachineComponent;\n\n            /** @var Operation $operation */\n            $operation = $operation->withStateMachineComponent($stateMachineComponent);\n        }\n\n        if (\n            method_exists($operation, 'getStateMachineTransition') &&\n            null !== $operation->getStateMachineTransition() &&\n            null === $operation->getProcessor()\n        ) {\n            $operation = $operation->withProcessor(ApplyStateMachineTransitionProcessor::class);\n        }\n\n        return $operation;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/TemplatesDirResourceMetadataCollectionFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nfinal class TemplatesDirResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface\n{\n    public function __construct(\n        private ResourceMetadataCollectionFactoryInterface $decorated,\n        private array $settings = [],\n    ) {\n    }\n\n    public function create(string $resourceClass): ResourceMetadataCollection\n    {\n        $resourceCollectionMetadata = $this->decorated->create($resourceClass);\n\n        /** @var ResourceMetadata $resource */\n        foreach ($resourceCollectionMetadata->getIterator() as $i => $resource) {\n            $operations = $resource->getOperations() ?? new Operations();\n\n            /** @var Operation $operation */\n            foreach ($operations as $operation) {\n                /** @var string $key */\n                $key = $operation->getName();\n\n                $operations->add($key, $this->addDefaults($resource, $operation));\n            }\n\n            $resource = $resource->withOperations($operations);\n\n            $resourceCollectionMetadata[$i] = $resource;\n        }\n\n        return $resourceCollectionMetadata;\n    }\n\n    private function addDefaults(ResourceMetadata $resource, Operation $operation): Operation\n    {\n        if (null === $operation->getTemplate()) {\n            $templateDir = $resource->getTemplatesDir() ?? $this->settings['default_templates_dir'] ?? '';\n            $template = sprintf('%s/%s.html.twig', $templateDir, $operation->getShortName() ?? '');\n            $operation = $operation->withTemplate($template);\n        }\n\n        return $operation;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/Factory/VarsResourceMetadataCollectionFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource\\Factory;\n\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nfinal class VarsResourceMetadataCollectionFactory implements ResourceMetadataCollectionFactoryInterface\n{\n    public function __construct(\n        private ResourceMetadataCollectionFactoryInterface $decorated,\n    ) {\n    }\n\n    public function create(string $resourceClass): ResourceMetadataCollection\n    {\n        $resourceCollectionMetadata = $this->decorated->create($resourceClass);\n\n        /** @var ResourceMetadata $resource */\n        foreach ($resourceCollectionMetadata->getIterator() as $i => $resource) {\n            $operations = $resource->getOperations() ?? new Operations();\n\n            /** @var Operation $operation */\n            foreach ($operations as $operation) {\n                if (!$operation instanceof HttpOperation) {\n                    continue;\n                }\n\n                /** @var string $key */\n                $key = $operation->getName();\n\n                $operations->add($key, $this->addDefaults($resource, $operation));\n            }\n\n            $resource = $resource->withOperations($operations);\n\n            $resourceCollectionMetadata[$i] = $resource;\n        }\n\n        return $resourceCollectionMetadata;\n    }\n\n    private function addDefaults(ResourceMetadata $resource, HttpOperation $operation): Operation\n    {\n        if (null === $resourceVars = $resource->getVars()) {\n            return $operation;\n        }\n\n        return $operation->withVars(\\array_merge($resourceVars, $operation->getVars() ?? []));\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/ResourceClassList.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource;\n\n/**\n * A list of resource class names.\n *\n * @experimental\n */\nfinal class ResourceClassList implements \\IteratorAggregate, \\Countable\n{\n    /**\n     * @param string[] $classes\n     */\n    public function __construct(private readonly array $classes = [])\n    {\n    }\n\n    /**\n     * @return \\Traversable<string>\n     */\n    public function getIterator(): \\Traversable\n    {\n        return new \\ArrayIterator($this->classes);\n    }\n\n    public function count(): int\n    {\n        return \\count($this->classes);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Resource/ResourceMetadataCollection.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Resource;\n\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nfinal class ResourceMetadataCollection extends \\ArrayObject\n{\n    public function getOperation(string $resourceAlias, string $name): Operation\n    {\n        /** @var ResourceMetadata $current */\n        foreach ($this->getIterator() as $current) {\n            if (\n                $current->getAlias() === $resourceAlias &&\n                $current->hasOperation($name)\n            ) {\n                return $current->getOperation($name);\n            }\n        }\n\n        throw new \\RuntimeException(sprintf(\n            'Operation \"%s\" for \"%s\" resource was not found.',\n            $name,\n            $resourceAlias,\n        ));\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/ResourceMetadata.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\nfinal class ResourceMetadata\n{\n    private ?Operations $operations;\n\n    /**\n     * @param array<string, string>|null $routeRequirements\n     */\n    public function __construct(\n        private ?string $alias = null,\n        private ?string $section = null,\n        private ?string $formType = null,\n        private ?string $templatesDir = null,\n        private ?string $routePrefix = null,\n        private ?array $routeRequirements = null,\n        private ?string $routeCondition = null,\n        private ?int $routePriority = null,\n        private ?string $name = null,\n        private ?string $pluralName = null,\n        private ?string $applicationName = null,\n        private ?string $identifier = null,\n        private ?array $normalizationContext = null,\n        private ?array $denormalizationContext = null,\n        private ?array $validationContext = null,\n        private ?string $class = null,\n        private string|false|null $driver = null,\n        private ?array $vars = null,\n        ?array $operations = null,\n    ) {\n        $this->operations = null === $operations ? null : new Operations($operations);\n    }\n\n    public function getClass(): ?string\n    {\n        return $this->class;\n    }\n\n    public function withClass(string $class): self\n    {\n        $self = clone $this;\n        $self->class = $class;\n\n        return $self;\n    }\n\n    public function getAlias(): ?string\n    {\n        return $this->alias;\n    }\n\n    public function withAlias(string $alias): self\n    {\n        $self = clone $this;\n        $self->alias = $alias;\n\n        return $self;\n    }\n\n    public function getSection(): ?string\n    {\n        return $this->section;\n    }\n\n    public function withSection(string $section): self\n    {\n        $self = clone $this;\n        $self->section = $section;\n\n        return $self;\n    }\n\n    public function getFormType(): ?string\n    {\n        return $this->formType;\n    }\n\n    public function withFormType(string $formType): self\n    {\n        $self = clone $this;\n        $self->formType = $formType;\n\n        return $self;\n    }\n\n    public function getName(): ?string\n    {\n        return $this->name;\n    }\n\n    public function withName(string $name): self\n    {\n        $self = clone $this;\n        $self->name = $name;\n\n        return $self;\n    }\n\n    public function getPluralName(): ?string\n    {\n        return $this->pluralName;\n    }\n\n    public function withPluralName(string $pluralName): self\n    {\n        $self = clone $this;\n        $self->pluralName = $pluralName;\n\n        return $self;\n    }\n\n    public function getApplicationName(): ?string\n    {\n        return $this->applicationName;\n    }\n\n    public function withApplicationName(string $applicationName): self\n    {\n        $self = clone $this;\n        $self->applicationName = $applicationName;\n\n        return $self;\n    }\n\n    public function getTemplatesDir(): ?string\n    {\n        return $this->templatesDir;\n    }\n\n    public function withTemplatesDir(string $templatesDir): self\n    {\n        $self = clone $this;\n        $self->templatesDir = $templatesDir;\n\n        return $self;\n    }\n\n    public function getRoutePrefix(): ?string\n    {\n        return $this->routePrefix;\n    }\n\n    public function withRoutePrefix(string $routePrefix): self\n    {\n        $self = clone $this;\n        $self->routePrefix = $routePrefix;\n\n        return $self;\n    }\n\n    /**\n     * @return array<string, string>|null\n     */\n    public function getRouteRequirements(): ?array\n    {\n        return $this->routeRequirements;\n    }\n\n    /**\n     * @param array<string, string>|null $routeRequirements\n     */\n    public function withRouteRequirements(?array $routeRequirements): self\n    {\n        $self = clone $this;\n        $self->routeRequirements = $routeRequirements;\n\n        return $self;\n    }\n\n    public function getRouteCondition(): ?string\n    {\n        return $this->routeCondition;\n    }\n\n    public function withRouteCondition(?string $routeCondition): self\n    {\n        $self = clone $this;\n        $self->routeCondition = $routeCondition;\n\n        return $self;\n    }\n\n    public function getRoutePriority(): ?int\n    {\n        return $this->routePriority;\n    }\n\n    public function withRoutePriority(?int $routePriority): self\n    {\n        $self = clone $this;\n        $self->routePriority = $routePriority;\n\n        return $self;\n    }\n\n    public function getIdentifier(): ?string\n    {\n        return $this->identifier;\n    }\n\n    public function withIdentifier(string $identifier): self\n    {\n        $self = clone $this;\n        $self->identifier = $identifier;\n\n        return $self;\n    }\n\n    public function hasOperation(string $name): bool\n    {\n        return $this->operations?->has($name) ?? false;\n    }\n\n    public function getOperation(string $name): Operation\n    {\n        if (null === $operations = $this->operations) {\n            throw new \\RuntimeException(sprintf('No Operations were found on resource %s\"', $this->alias ?? ''));\n        }\n\n        return $operations->get($name);\n    }\n\n    public function getOperations(): ?Operations\n    {\n        return $this->operations;\n    }\n\n    public function withOperations(Operations $operations): self\n    {\n        $self = clone $this;\n        $self->operations = $operations;\n\n        return $self;\n    }\n\n    public function getRouteName(string $shortName): string\n    {\n        $section = $this->getSection();\n        $sectionPrefix = $section ? $section . '_' : '';\n\n        return sprintf(\n            '%s_%s%s_%s',\n            $this->getApplicationName() ?? '',\n            $sectionPrefix,\n            $this->getName() ?? '',\n            $shortName,\n        );\n    }\n\n    public function getNormalizationContext(): ?array\n    {\n        return $this->normalizationContext;\n    }\n\n    public function withNormalizationContext(?array $normalizationContext): self\n    {\n        $self = clone $this;\n        $self->normalizationContext = $normalizationContext;\n\n        return $self;\n    }\n\n    public function getDenormalizationContext(): ?array\n    {\n        return $this->denormalizationContext;\n    }\n\n    public function withDenormalizationContext(?array $denormalizationContext): self\n    {\n        $self = clone $this;\n        $self->denormalizationContext = $denormalizationContext;\n\n        return $self;\n    }\n\n    public function getValidationContext(): ?array\n    {\n        return $this->validationContext;\n    }\n\n    public function withValidationContext(?array $validationContext): self\n    {\n        $self = clone $this;\n        $self->validationContext = $validationContext;\n\n        return $self;\n    }\n\n    public function getDriver(): false|string|null\n    {\n        return $this->driver;\n    }\n\n    public function withDriver(false|string $driver): self\n    {\n        $self = clone $this;\n        $self->driver = $driver;\n\n        return $self;\n    }\n\n    public function getVars(): ?array\n    {\n        return $this->vars;\n    }\n\n    public function withVars(array $vars): self\n    {\n        $self = clone $this;\n        $self->vars = $vars;\n\n        return $self;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/ResourceMutatorInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\ninterface ResourceMutatorInterface\n{\n    public function __invoke(ResourceMetadata $resource): ResourceMetadata;\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Show.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * @experimental\n */\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class Show extends HttpOperation implements ShowOperationInterface\n{\n    public function __construct(\n        ?array $methods = null,\n        ?string $path = null,\n        ?string $routeName = null,\n        ?string $routePrefix = null,\n        ?array $routeRequirements = null,\n        ?string $routeCondition = null,\n        ?int $routePriority = null,\n        ?string $template = null,\n        ?string $shortName = null,\n        ?string $name = null,\n        string|callable|null $provider = null,\n        string|callable|null $processor = null,\n        string|callable|null $responder = null,\n        string|callable|null $repository = null,\n        ?string $repositoryMethod = null,\n        ?array $repositoryArguments = null,\n        ?bool $read = null,\n        ?bool $write = null,\n        ?bool $validate = null,\n        ?bool $deserialize = null,\n        ?bool $serialize = null,\n        ?string $formType = null,\n        ?array $formOptions = null,\n        ?array $validationContext = null,\n        ?string $eventShortName = null,\n        ?string $notificationMessage = null,\n        string|\\Stringable|null $security = null,\n        ?string $securityMessage = null,\n        string|callable|null $twigContextFactory = null,\n        ?string $redirectToRoute = null,\n        ?array $vars = null,\n    ) {\n        parent::__construct(\n            methods: $methods ?? ['GET'],\n            path: $path,\n            routeName: $routeName,\n            routePrefix: $routePrefix,\n            routeRequirements: $routeRequirements,\n            routeCondition: $routeCondition,\n            routePriority: $routePriority,\n            template: $template,\n            shortName: $shortName ?? 'show',\n            name: $name,\n            provider: $provider,\n            processor: $processor,\n            responder: $responder,\n            repository: $repository,\n            repositoryMethod: $repositoryMethod,\n            repositoryArguments: $repositoryArguments,\n            read: $read,\n            write: $write,\n            validate: $validate,\n            deserialize: $deserialize,\n            serialize: $serialize,\n            formType: $formType,\n            formOptions: $formOptions,\n            validationContext: $validationContext,\n            eventShortName: $eventShortName,\n            notificationMessage: $notificationMessage,\n            security: $security,\n            securityMessage: $securityMessage,\n            twigContextFactory: $twigContextFactory,\n            redirectToRoute: $redirectToRoute,\n            vars: $vars,\n        );\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/ShowOperationInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * The Operation show content.\n *\n * @experimental\n */\ninterface ShowOperationInterface\n{\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/StateMachineAwareOperationInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * The Operation has a state machine.\n *\n * @experimental\n */\ninterface StateMachineAwareOperationInterface\n{\n    public function getStateMachineComponent(): ?string;\n\n    public function withStateMachineComponent(?string $stateMachineComponent): self;\n\n    public function getStateMachineTransition(): ?string;\n\n    public function withStateMachineTransition(string $stateMachineTransition): self;\n\n    public function getStateMachineGraph(): ?string;\n\n    public function withStateMachineGraph(string $stateMachineGraph): self;\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Update.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * @experimental\n */\n#[\\Attribute(\\Attribute::TARGET_CLASS | \\Attribute::IS_REPEATABLE)]\nfinal class Update extends HttpOperation implements UpdateOperationInterface, StateMachineAwareOperationInterface\n{\n    public function __construct(\n        ?array $methods = null,\n        ?string $path = null,\n        ?string $routeName = null,\n        ?string $routePrefix = null,\n        ?array $routeRequirements = null,\n        ?string $routeCondition = null,\n        ?int $routePriority = null,\n        ?string $template = null,\n        ?string $shortName = null,\n        ?string $name = null,\n        string|callable|null $provider = null,\n        string|callable|null $processor = null,\n        string|callable|null $responder = null,\n        string|callable|null $repository = null,\n        ?string $repositoryMethod = null,\n        ?array $repositoryArguments = null,\n        ?bool $read = null,\n        ?bool $write = null,\n        ?bool $validate = null,\n        ?bool $deserialize = null,\n        ?bool $serialize = null,\n        ?string $formType = null,\n        ?array $formOptions = null,\n        ?array $validationContext = null,\n        ?string $eventShortName = null,\n        ?string $notificationMessage = null,\n        string|\\Stringable|null $security = null,\n        ?string $securityMessage = null,\n        string|callable|null $twigContextFactory = null,\n        ?string $redirectTo = null,\n        ?string $redirectToRoute = null,\n        ?array $redirectArguments = null,\n        ?array $vars = null,\n        private ?string $stateMachineComponent = null,\n        private ?string $stateMachineTransition = null,\n        private ?string $stateMachineGraph = null,\n    ) {\n        parent::__construct(\n            methods: $methods ?? ['GET', 'PUT', 'POST'],\n            path: $path,\n            routeName: $routeName,\n            routePrefix: $routePrefix,\n            routeRequirements: $routeRequirements,\n            routeCondition: $routeCondition,\n            routePriority: $routePriority,\n            template: $template,\n            shortName: $shortName ?? 'update',\n            name: $name,\n            provider: $provider,\n            processor: $processor,\n            responder: $responder,\n            repository: $repository,\n            repositoryMethod: $repositoryMethod,\n            repositoryArguments: $repositoryArguments,\n            read: $read,\n            write: $write,\n            validate: $validate,\n            deserialize: $deserialize,\n            serialize: $serialize,\n            formType: $formType,\n            formOptions: $formOptions,\n            validationContext: $validationContext,\n            eventShortName: $eventShortName,\n            notificationMessage: $notificationMessage,\n            security: $security,\n            securityMessage: $securityMessage,\n            twigContextFactory: $twigContextFactory,\n            redirectTo: $redirectTo,\n            redirectToRoute: $redirectToRoute,\n            redirectArguments: $redirectArguments,\n            vars: $vars,\n        );\n    }\n\n    public function getStateMachineComponent(): ?string\n    {\n        return $this->stateMachineComponent;\n    }\n\n    public function withStateMachineComponent(?string $stateMachineComponent): self\n    {\n        $self = clone $this;\n        $self->stateMachineComponent = $stateMachineComponent;\n\n        return $self;\n    }\n\n    public function getStateMachineTransition(): ?string\n    {\n        return $this->stateMachineTransition;\n    }\n\n    public function withStateMachineTransition(string $stateMachineTransition): self\n    {\n        $self = clone $this;\n        $self->stateMachineTransition = $stateMachineTransition;\n\n        return $self;\n    }\n\n    public function getStateMachineGraph(): ?string\n    {\n        return $this->stateMachineGraph;\n    }\n\n    public function withStateMachineGraph(string $stateMachineGraph): self\n    {\n        $self = clone $this;\n        $self->stateMachineGraph = $stateMachineGraph;\n\n        return $self;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/UpdateOperationInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata;\n\n/**\n * The Operation updates content.\n *\n * @experimental\n */\ninterface UpdateOperationInterface\n{\n}\n"
  },
  {
    "path": "src/Component/src/Metadata/Util/CachedTrait.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Metadata\\Util;\n\nuse Psr\\Cache\\CacheException;\nuse Psr\\Cache\\CacheItemPoolInterface;\n\n/**\n * This trait in inspired by this API Platform one:\n *\n * @see https://github.com/api-platform/core/blob/main/src/Metadata/Util/CachedTrait.php\n *\n * @internal\n */\ntrait CachedTrait\n{\n    private CacheItemPoolInterface $cacheItemPool;\n\n    /** @var array<string, mixed> */\n    private array $localCache = [];\n\n    private function getCached(string $cacheKey, callable $getValue): mixed\n    {\n        if (\\array_key_exists($cacheKey, $this->localCache)) {\n            return $this->localCache[$cacheKey];\n        }\n\n        try {\n            $cacheItem = $this->cacheItemPool->getItem($cacheKey);\n        } catch (CacheException) {\n            return $this->localCache[$cacheKey] = $getValue();\n        }\n\n        if ($cacheItem->isHit()) {\n            return $this->localCache[$cacheKey] = $cacheItem->get();\n        }\n\n        $value = $getValue();\n\n        $cacheItem->set($value);\n        $this->cacheItemPool->save($cacheItem);\n\n        return $this->localCache[$cacheKey] = $value;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Model/AbstractTranslation.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Model;\n\nuse Webmozart\\Assert\\Assert;\n\nclass AbstractTranslation implements TranslationInterface\n{\n    protected ?string $locale = null;\n\n    protected ?TranslatableInterface $translatable = null;\n\n    public function getTranslatable(): TranslatableInterface\n    {\n        $translatable = $this->translatable;\n\n        // Return typehint should account for null value.\n        Assert::notNull($translatable);\n\n        return $translatable;\n    }\n\n    public function setTranslatable(?TranslatableInterface $translatable): void\n    {\n        if ($translatable === $this->translatable) {\n            return;\n        }\n\n        $previousTranslatable = $this->translatable;\n        $this->translatable = $translatable;\n\n        if (null !== $previousTranslatable) {\n            $previousTranslatable->removeTranslation($this);\n        }\n\n        if (null !== $translatable) {\n            $translatable->addTranslation($this);\n        }\n    }\n\n    public function getLocale(): ?string\n    {\n        return $this->locale;\n    }\n\n    public function setLocale(?string $locale): void\n    {\n        $this->locale = $locale;\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Model\\AbstractTranslation::class, false)) {\n    class_alias(AbstractTranslation::class, \\Sylius\\Component\\Resource\\Model\\AbstractTranslation::class);\n}\n"
  },
  {
    "path": "src/Component/src/Model/ArchivableInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Model;\n\ninterface ArchivableInterface\n{\n    public function getArchivedAt(): ?\\DateTimeInterface;\n\n    public function setArchivedAt(?\\DateTimeInterface $archivedAt): void;\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Model\\ArchivableInterface::class, false)) {\n    class_alias(ArchivableInterface::class, \\Sylius\\Component\\Resource\\Model\\ArchivableInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Model/ArchivableTrait.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Model;\n\n/**\n * @see ArchivableInterface\n */\ntrait ArchivableTrait\n{\n    /** @var \\DateTimeInterface|null */\n    protected $archivedAt;\n\n    public function getArchivedAt(): ?\\DateTimeInterface\n    {\n        return $this->archivedAt;\n    }\n\n    public function setArchivedAt(?\\DateTimeInterface $archivedAt): void\n    {\n        $this->archivedAt = $archivedAt;\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Model\\ArchivableTrait::class, false)) {\n    class_alias(ArchivableTrait::class, \\Sylius\\Component\\Resource\\Model\\ArchivableTrait::class);\n}\n"
  },
  {
    "path": "src/Component/src/Model/CodeAwareInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Model;\n\ninterface CodeAwareInterface\n{\n    public function getCode(): ?string;\n\n    public function setCode(?string $code): void;\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Model\\CodeAwareInterface::class, false)) {\n    class_alias(CodeAwareInterface::class, \\Sylius\\Component\\Resource\\Model\\CodeAwareInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Model/ResourceInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Model;\n\ninterface ResourceInterface\n{\n    /** @psalm-suppress MissingReturnType */\n    public function getId();\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Model\\ResourceInterface::class, false)) {\n    class_alias(ResourceInterface::class, \\Sylius\\Component\\Resource\\Model\\ResourceInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Model/ResourceLogEntry.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Model;\n\nuse Gedmo\\Loggable\\Entity\\MappedSuperclass\\AbstractLogEntry;\nuse Sylius\\Resource\\Exception\\RuntimeException;\n\nif (!class_exists(AbstractLogEntry::class)) {\n    throw new RuntimeException(sprintf('Cannot use the \"%s\" class when the \"gedmo/doctrine-extensions\" package is not installed.', ResourceLogEntry::class));\n}\n\nabstract class ResourceLogEntry extends AbstractLogEntry implements ResourceInterface\n{\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Model\\ResourceLogEntry::class, false)) {\n    class_alias(ResourceLogEntry::class, \\Sylius\\Component\\Resource\\Model\\ResourceLogEntry::class);\n}\n"
  },
  {
    "path": "src/Component/src/Model/SlugAwareInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Model;\n\ninterface SlugAwareInterface\n{\n    public function getSlug(): ?string;\n\n    public function setSlug(?string $slug): void;\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Model\\SlugAwareInterface::class, false)) {\n    class_alias(SlugAwareInterface::class, \\Sylius\\Component\\Resource\\Model\\SlugAwareInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Model/TimestampableInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Model;\n\ninterface TimestampableInterface\n{\n    public function getCreatedAt(): ?\\DateTimeInterface;\n\n    /** @psalm-suppress MissingReturnType */\n    public function setCreatedAt(?\\DateTimeInterface $createdAt);\n\n    public function getUpdatedAt(): ?\\DateTimeInterface;\n\n    /** @psalm-suppress MissingReturnType */\n    public function setUpdatedAt(?\\DateTimeInterface $updatedAt);\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Model\\TimestampableInterface::class, false)) {\n    class_alias(TimestampableInterface::class, \\Sylius\\Component\\Resource\\Model\\TimestampableInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Model/TimestampableTrait.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Model;\n\ntrait TimestampableTrait\n{\n    /** @var \\DateTimeInterface|null */\n    protected $createdAt;\n\n    /** @var \\DateTimeInterface|null */\n    protected $updatedAt;\n\n    public function getCreatedAt(): ?\\DateTimeInterface\n    {\n        return $this->createdAt;\n    }\n\n    public function setCreatedAt(?\\DateTimeInterface $createdAt): void\n    {\n        $this->createdAt = $createdAt;\n    }\n\n    public function getUpdatedAt(): ?\\DateTimeInterface\n    {\n        return $this->updatedAt;\n    }\n\n    public function setUpdatedAt(?\\DateTimeInterface $updatedAt): void\n    {\n        $this->updatedAt = $updatedAt;\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Model\\TimestampableTrait::class, false)) {\n    class_alias(TimestampableTrait::class, \\Sylius\\Component\\Resource\\Model\\TimestampableTrait::class);\n}\n"
  },
  {
    "path": "src/Component/src/Model/ToggleableInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Model;\n\ninterface ToggleableInterface\n{\n    /**\n     * Missing scalar typehint because it conflicts with AdvancedUserInterface.\n     *\n     * @return bool\n     */\n    public function isEnabled();\n\n    public function setEnabled(?bool $enabled): void;\n\n    public function enable(): void;\n\n    public function disable(): void;\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Model\\ToggleableInterface::class, false)) {\n    class_alias(ToggleableInterface::class, \\Sylius\\Component\\Resource\\Model\\ToggleableInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Model/ToggleableTrait.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Model;\n\ntrait ToggleableTrait\n{\n    /** @var bool */\n    protected $enabled = true;\n\n    public function isEnabled(): bool\n    {\n        return $this->enabled;\n    }\n\n    public function setEnabled(?bool $enabled): void\n    {\n        $this->enabled = (bool) $enabled;\n    }\n\n    public function enable(): void\n    {\n        $this->enabled = true;\n    }\n\n    public function disable(): void\n    {\n        $this->enabled = false;\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Model\\ToggleableTrait::class, false)) {\n    class_alias(ToggleableTrait::class, \\Sylius\\Component\\Resource\\Model\\ToggleableTrait::class);\n}\n"
  },
  {
    "path": "src/Component/src/Model/TranslatableInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Model;\n\nuse Doctrine\\Common\\Collections\\Collection;\n\ninterface TranslatableInterface\n{\n    /**\n     * @return Collection|TranslationInterface[]\n     * @psalm-return Collection<array-key, TranslationInterface>\n     */\n    public function getTranslations(): Collection;\n\n    public function getTranslation(?string $locale = null): TranslationInterface;\n\n    public function hasTranslation(TranslationInterface $translation): bool;\n\n    public function addTranslation(TranslationInterface $translation): void;\n\n    public function removeTranslation(TranslationInterface $translation): void;\n\n    public function setCurrentLocale(string $locale): void;\n\n    public function setFallbackLocale(string $locale): void;\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Model\\TranslatableInterface::class, false)) {\n    class_alias(TranslatableInterface::class, \\Sylius\\Component\\Resource\\Model\\TranslatableInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Model/TranslatableTrait.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Model;\n\nuse Doctrine\\Common\\Collections\\ArrayCollection;\nuse Doctrine\\Common\\Collections\\Collection;\nuse Doctrine\\ORM\\PersistentCollection;\n\n/**\n * @see TranslatableInterface\n */\ntrait TranslatableTrait\n{\n    /** @var ArrayCollection|PersistentCollection|TranslationInterface[] */\n    protected $translations;\n\n    /** @var array|TranslationInterface[] */\n    protected $translationsCache = [];\n\n    /** @var string|null */\n    protected $currentLocale;\n\n    /**\n     * Cache current translation. Useful in Doctrine 2.4+\n     *\n     * @var TranslationInterface|null\n     */\n    protected $currentTranslation;\n\n    /** @var string|null */\n    protected $fallbackLocale;\n\n    public function __construct()\n    {\n        $this->translations = new ArrayCollection();\n    }\n\n    public function getTranslation(?string $locale = null): TranslationInterface\n    {\n        $locale = $locale ?: $this->currentLocale;\n        if (null === $locale) {\n            throw new \\RuntimeException('No locale has been set and current locale is undefined.');\n        }\n\n        if (isset($this->translationsCache[$locale])) {\n            return $this->translationsCache[$locale];\n        }\n\n        $translation = $this->translations->get($locale);\n        if (null !== $translation) {\n            $this->translationsCache[$locale] = $translation;\n\n            return $translation;\n        }\n\n        if ($locale !== $this->fallbackLocale) {\n            if (isset($this->translationsCache[$this->fallbackLocale])) {\n                return $this->translationsCache[$this->fallbackLocale];\n            }\n\n            $fallbackTranslation = $this->translations->get($this->fallbackLocale);\n            if (null !== $fallbackTranslation) {\n                $this->translationsCache[$this->fallbackLocale] = $fallbackTranslation;\n\n                return $fallbackTranslation;\n            }\n        }\n\n        $translation = $this->createTranslation();\n        $translation->setLocale($locale);\n\n        $this->addTranslation($translation);\n\n        $this->translationsCache[$locale] = $translation;\n\n        return $translation;\n    }\n\n    /**\n     * @return Collection|TranslationInterface[]\n     */\n    public function getTranslations(): Collection\n    {\n        return $this->translations;\n    }\n\n    public function hasTranslation(TranslationInterface $translation): bool\n    {\n        return isset($this->translationsCache[$translation->getLocale()]) || $this->translations->containsKey($translation->getLocale());\n    }\n\n    public function addTranslation(TranslationInterface $translation): void\n    {\n        if (!$this->hasTranslation($translation)) {\n            $this->translationsCache[$translation->getLocale()] = $translation;\n\n            $this->translations->set($translation->getLocale(), $translation);\n            $translation->setTranslatable($this);\n        }\n    }\n\n    public function removeTranslation(TranslationInterface $translation): void\n    {\n        if ($this->translations->removeElement($translation)) {\n            unset($this->translationsCache[$translation->getLocale()]);\n\n            $translation->setTranslatable(null);\n        }\n    }\n\n    public function setCurrentLocale(string $currentLocale): void\n    {\n        $this->currentLocale = $currentLocale;\n    }\n\n    public function setFallbackLocale(string $fallbackLocale): void\n    {\n        $this->fallbackLocale = $fallbackLocale;\n    }\n\n    /**\n     * Create resource translation model.\n     */\n    abstract protected function createTranslation(): TranslationInterface;\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Model\\TranslatableTrait::class, false)) {\n    class_alias(TranslatableTrait::class, \\Sylius\\Component\\Resource\\Model\\TranslatableTrait::class);\n}\n"
  },
  {
    "path": "src/Component/src/Model/TranslationInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Model;\n\ninterface TranslationInterface\n{\n    public function getTranslatable(): TranslatableInterface;\n\n    public function setTranslatable(?TranslatableInterface $translatable): void;\n\n    public function getLocale(): ?string;\n\n    public function setLocale(?string $locale): void;\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Model\\TranslationInterface::class, false)) {\n    class_alias(TranslationInterface::class, \\Sylius\\Component\\Resource\\Model\\TranslationInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Model/VersionedInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Model;\n\ninterface VersionedInterface\n{\n    public function getVersion(): ?int;\n\n    public function setVersion(?int $version): void;\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Model\\VersionedInterface::class, false)) {\n    class_alias(VersionedInterface::class, \\Sylius\\Component\\Resource\\Model\\VersionedInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Reflection/CallableReflection.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Reflection;\n\nfinal class CallableReflection\n{\n    public static function from(callable $callable): \\ReflectionFunctionAbstract\n    {\n        if ($callable instanceof \\Closure) {\n            return new \\ReflectionFunction($callable);\n        }\n\n        if (is_string($callable)) {\n            $callableParts = explode('::', $callable);\n            /** @psalm-var class-string $object */\n            $object = $callableParts[0];\n\n            return count($callableParts) > 1 ? new \\ReflectionMethod($object, $callableParts[1]) : new \\ReflectionFunction($callable);\n        }\n\n        if (!is_array($callable)) {\n            $callable = [$callable, '__invoke'];\n        }\n\n        return new \\ReflectionMethod($callable[0], $callable[1]);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Reflection/ClassInfoTrait.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Reflection;\n\nuse Webmozart\\Assert\\Assert;\n\n/**\n * Retrieves information about a class.\n *\n * @internal\n */\ntrait ClassInfoTrait\n{\n    /**\n     * Get class name of the given object.\n     *\n     * @return class-string\n     */\n    private function getObjectClass(object $object): string\n    {\n        return $this->getRealClassName($object::class);\n    }\n\n    /**\n     * Get the real class name of a class name that could be a proxy.\n     *\n     * @param class-string $className\n     *\n     * @return class-string\n     */\n    private function getRealClassName(string $className): string\n    {\n        // __CG__: Doctrine Common Marker for Proxy (ODM < 2.0 and ORM < 3.0)\n        // __PM__: Ocramius Proxy Manager (ODM >= 2.0)\n        $positionCg = strrpos($className, '\\\\__CG__\\\\');\n        $positionPm = strrpos($className, '\\\\__PM__\\\\');\n\n        if (false === $positionCg && false === $positionPm) {\n            return $className;\n        }\n\n        if (false !== $positionCg) {\n            $unProxiedClassName = substr($className, $positionCg + 8);\n\n            Assert::classExists($unProxiedClassName);\n\n            return $unProxiedClassName;\n        }\n\n        $className = ltrim($className, '\\\\');\n\n        $unProxiedClassName = substr(\n            $className,\n            8 + $positionPm,\n            strrpos($className, '\\\\') - ($positionPm + 8),\n        );\n\n        Assert::classExists($unProxiedClassName);\n\n        return $unProxiedClassName;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Reflection/ClassReflection.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Reflection;\n\nfinal class ClassReflection\n{\n    /**\n     * @return \\Generator<class-string>\n     */\n    public static function getResourcesByPaths(array $paths): iterable\n    {\n        trigger_deprecation('sylius/resource-bundle', '1.14', 'The method \"%s\" is deprecated, use \"%s::%s\" instead.', __METHOD__, ReflectionClassRecursiveIterator::class, 'getReflectionClassesFromDirectories');\n\n        foreach (ReflectionClassRecursiveIterator::getReflectionClassesFromDirectories($paths) as $reflectionClass) {\n            yield $reflectionClass->getName();\n        }\n    }\n\n    public static function getResourcesByPath(string $path): iterable\n    {\n        trigger_deprecation('sylius/resource-bundle', '1.14', 'The method \"%s\" is deprecated, use \"%s::%s\" instead.', __METHOD__, ReflectionClassRecursiveIterator::class, 'getReflectionClassesFromDirectories');\n\n        foreach (ReflectionClassRecursiveIterator::getReflectionClassesFromDirectories([$path]) as $reflectionClass) {\n            yield $reflectionClass->getName();\n        }\n    }\n\n    /**\n     * @param class-string $className\n     *\n     * @return \\ReflectionAttribute[]\n     */\n    public static function getClassAttributes(string $className, ?string $attributeName = null): array\n    {\n        $reflectionClass = new \\ReflectionClass($className);\n\n        /** @psalm-suppress ArgumentTypeCoercion */\n        return $reflectionClass->getAttributes($attributeName);\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Reflection\\ClassReflection::class, false)) {\n    class_alias(ClassReflection::class, \\Sylius\\Component\\Resource\\Reflection\\ClassReflection::class);\n}\n"
  },
  {
    "path": "src/Component/src/Reflection/Filter/FunctionArgumentsFilter.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Reflection\\Filter;\n\nfinal class FunctionArgumentsFilter\n{\n    public static function filter(\\ReflectionFunctionAbstract $reflectionFunction, array $arguments): array\n    {\n        $repositoryArguments = self::getFunctionArguments($reflectionFunction);\n\n        $allowed = array_intersect_key($repositoryArguments, $arguments);\n\n        return array_intersect_key($arguments, array_flip(array_keys($allowed)));\n    }\n\n    private static function getFunctionArguments(\\ReflectionFunctionAbstract $reflectionFunction): array\n    {\n        $arguments = [];\n\n        foreach ($reflectionFunction->getParameters() as $param) {\n            $arguments[$param->name] = null;\n        }\n\n        return $arguments;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Reflection/ReflectionClassRecursiveIterator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Reflection;\n\n/**\n * Gets reflection classes for php files in the given directories.\n *\n * This class in inspired by this API Platform one:\n *\n * @see https://github.com/api-platform/core/blob/main/src/Metadata/Util/ReflectionClassRecursiveIterator.php\n *\n * @internal\n */\nfinal class ReflectionClassRecursiveIterator\n{\n    /** @var array<string, array<class-string, \\ReflectionClass<object>>> */\n    private static array $localCache;\n\n    private function __construct()\n    {\n    }\n\n    /**\n     * @param string[] $directories\n     *\n     * @return array<class-string, \\ReflectionClass<object>>\n     */\n    public static function getReflectionClassesFromDirectories(array $directories, string $ignoreRegex = ''): array\n    {\n        $id = hash('xxh3', implode('', $directories) . $ignoreRegex);\n        if (isset(self::$localCache[$id])) {\n            return self::$localCache[$id];\n        }\n\n        $includedFiles = [];\n        foreach ($directories as $path) {\n            $iterator = new \\RegexIterator(\n                new \\RecursiveIteratorIterator(\n                    new \\RecursiveDirectoryIterator($path, \\FilesystemIterator::SKIP_DOTS | \\FilesystemIterator::FOLLOW_SYMLINKS),\n                    \\RecursiveIteratorIterator::LEAVES_ONLY,\n                ),\n                '/^' . $ignoreRegex . '.+\\.php$/i',\n                \\RecursiveRegexIterator::GET_MATCH,\n            );\n\n            foreach ($iterator as $file) {\n                /** @var array{0: string} $file */\n                $sourceFile = $file[0];\n\n                if (!preg_match('(^phar:)i', (string) $sourceFile)) {\n                    $sourceFile = realpath($sourceFile);\n                }\n\n                try {\n                    require_once $sourceFile;\n                } catch (\\Throwable) {\n                    // invalid PHP file (example: missing parent class)\n                    continue;\n                }\n\n                $includedFiles[$sourceFile] = true;\n            }\n        }\n\n        $sortedClasses = get_declared_classes();\n        sort($sortedClasses);\n        $sortedInterfaces = get_declared_interfaces();\n        sort($sortedInterfaces);\n        $declared = [...$sortedClasses, ...$sortedInterfaces];\n        $ret = [];\n        foreach ($declared as $className) {\n            $reflectionClass = new \\ReflectionClass($className);\n            $sourceFile = $reflectionClass->getFileName();\n            if (isset($includedFiles[$sourceFile])) {\n                $ret[$className] = $reflectionClass;\n            }\n        }\n\n        return self::$localCache[$id] = $ret;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/ResourceActions.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource;\n\nfinal class ResourceActions\n{\n    public const SHOW = 'show';\n\n    public const INDEX = 'index';\n\n    public const CREATE = 'create';\n\n    public const UPDATE = 'update';\n\n    public const DELETE = 'delete';\n\n    public const BULK_DELETE = 'bulk_delete';\n\n    private function __construct()\n    {\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\ResourceActions::class, false)) {\n    class_alias(ResourceActions::class, \\Sylius\\Component\\Resource\\ResourceActions::class);\n}\n"
  },
  {
    "path": "src/Component/src/State/Factory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\State;\n\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Factory\\FactoryInterface as ResourceFactoryInterface;\nuse Sylius\\Resource\\Metadata\\FactoryAwareOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\ArgumentParserInterface;\nuse Webmozart\\Assert\\Assert;\n\n/**\n * @experimental\n */\nfinal class Factory implements FactoryInterface\n{\n    public function __construct(\n        private ContainerInterface $locator,\n        private ArgumentParserInterface $argumentParser,\n    ) {\n    }\n\n    public function create(Operation $operation, Context $context): ?object\n    {\n        if (!$operation instanceof FactoryAwareOperationInterface) {\n            return null;\n        }\n\n        $factory = $operation->getFactory();\n\n        if (!$factory) {\n            return null;\n        }\n\n        $arguments = $this->parseArgumentValues($operation->getFactoryArguments() ?? []);\n\n        if (\\is_callable($factory)) {\n            return $factory(...$arguments);\n        }\n\n        if (!$this->locator->has($factory)) {\n            throw new \\RuntimeException(sprintf('Factory \"%s\" not found on operation \"%s\"', $factory, $operation->getName() ?? ''));\n        }\n\n        $factoryInstance = $this->locator->get($factory);\n        Assert::isInstanceOf($factoryInstance, ResourceFactoryInterface::class);\n\n        $factoryMethod = $operation->getFactoryMethod();\n\n        if (null === $factoryMethod) {\n            throw new \\RuntimeException(sprintf('No Factory method was configured on operation \"%s\"', $operation->getName() ?? ''));\n        }\n\n        return $factoryInstance->$factoryMethod(...$arguments);\n    }\n\n    private function parseArgumentValues(array $arguments): array\n    {\n        foreach ($arguments as $key => $value) {\n            if (!str_starts_with($value, '@=')) {\n                $value = '@=' . $value;\n                trigger_deprecation('sylius/resource-bundle', '1.14', 'You passed \"%s\" as a string value in your repository arguments. If this is a value that needs to be parsed using the expression language, please prefix your string with \"@=\". In your case, use \"@=%s\".\"', $value, $value);\n            }\n\n            // Not reachable as long as the BC layer above is there\n            if (!str_starts_with($value, '@=')) {\n                $arguments[$key] = $value;\n\n                continue;\n            }\n\n            $value = substr($value, 2);\n            $arguments[$key] = $this->argumentParser->parseExpression($value);\n        }\n\n        return $arguments;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/State/FactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\State;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\n\n/**\n * @experimental\n */\ninterface FactoryInterface\n{\n    public function create(Operation $operation, Context $context): ?object;\n}\n"
  },
  {
    "path": "src/Component/src/State/Processor/BulkAwareProcessor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\State\\Processor;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\BulkOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ProcessorInterface;\n\n/**\n * @experimental\n */\nfinal class BulkAwareProcessor implements ProcessorInterface\n{\n    public function __construct(\n        private ProcessorInterface $processor,\n    ) {\n    }\n\n    /**\n     * @inheritDoc\n     */\n    public function process(mixed $data, Operation $operation, Context $context): mixed\n    {\n        if (\n            !$operation instanceof BulkOperationInterface ||\n            !\\is_iterable($data)\n        ) {\n            return $this->processor->process($data, $operation, $context);\n        }\n\n        foreach ($data as $item) {\n            $this->processor->process($item, $operation, $context);\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/State/Processor/EventDispatcherBulkAwareProcessor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\State\\Processor;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\BulkOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventDispatcherInterface;\n\n/**\n * @experimental\n */\nfinal class EventDispatcherBulkAwareProcessor implements ProcessorInterface\n{\n    public function __construct(\n        private ProcessorInterface $decorated,\n        private OperationEventDispatcherInterface $operationEventDispatcher,\n    ) {\n    }\n\n    /**\n     * @inheritDoc\n     */\n    public function process(mixed $data, Operation $operation, Context $context): mixed\n    {\n        if ($operation instanceof BulkOperationInterface && \\is_iterable($data)) {\n            $this->operationEventDispatcher->dispatchBulkEvent($data, $operation, $context);\n        }\n\n        return $this->decorated->process($data, $operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/State/Processor/FlashProcessor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\State\\Processor;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Sylius\\Resource\\Symfony\\Session\\Flash\\FlashHelperInterface;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\n/**\n * @experimental\n */\nfinal class FlashProcessor implements ProcessorInterface\n{\n    public function __construct(\n        private ProcessorInterface $processor,\n        private FlashHelperInterface $flashHelper,\n    ) {\n    }\n\n    public function process(mixed $data, Operation $operation, Context $context): mixed\n    {\n        $request = $context->get(RequestOption::class)?->request();\n\n        if (null === $request) {\n            return $this->processor->process($data, $operation, $context);\n        }\n\n        $format = $request->getRequestFormat();\n\n        if (\n            $data instanceof Response ||\n            $request->isMethodSafe() ||\n            $format !== 'html' ||\n            !($operation->canWrite() ?? true)\n        ) {\n            return $this->processor->process($data, $operation, $context);\n        }\n\n        $this->addFlash($request, $operation, $context);\n\n        return $this->processor->process($data, $operation, $context);\n    }\n\n    private function addFlash(Request $request, Operation $operation, Context $context): void\n    {\n        if ($request->attributes->has('error')) {\n            $this->flashHelper->addErrorFlash($operation, $context);\n\n            return;\n        }\n\n        $this->flashHelper->addSuccessFlash($operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/State/Processor/RespondProcessor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\State\\Processor;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Sylius\\Resource\\State\\ResponderInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Webmozart\\Assert\\Assert;\n\n/**\n * @experimental\n */\nfinal class RespondProcessor implements ProcessorInterface\n{\n    public function __construct(\n        private ResponderInterface $responder,\n    ) {\n    }\n\n    public function process(mixed $data, Operation $operation, Context $context): mixed\n    {\n        if ($data instanceof Response) {\n            return $data;\n        }\n\n        $response = $this->responder->respond($data, $operation, $context);\n        Assert::isInstanceOf($response, Response::class);\n\n        return $response;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/State/Processor/WriteProcessor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\State\\Processor;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Exception\\WriteResourceException;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\n/**\n * @experimental\n */\nfinal class WriteProcessor implements ProcessorInterface\n{\n    public function __construct(\n        private ProcessorInterface $processor,\n        private ProcessorInterface $locatorProcessor,\n    ) {\n    }\n\n    public function process(mixed $data, Operation $operation, Context $context): mixed\n    {\n        if (\n            $data instanceof Response ||\n            !($operation->canWrite() ?? true) ||\n            !$operation->getProcessor()\n        ) {\n            return $this->processor->process($data, $operation, $context);\n        }\n\n        try {\n            return $this->processor->process($this->locatorProcessor->process($data, $operation, $context), $operation, $context);\n        } catch (WriteResourceException $exception) {\n            $request = $context->get(RequestOption::class)?->request();\n            $request?->attributes->set('error', $exception->getMessage());\n\n            return $this->processor->process(null, $operation, $context);\n        }\n    }\n}\n"
  },
  {
    "path": "src/Component/src/State/Processor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\State;\n\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Webmozart\\Assert\\Assert;\n\n/**\n * @experimental\n */\nfinal class Processor implements ProcessorInterface\n{\n    public function __construct(private ContainerInterface $locator)\n    {\n    }\n\n    /**\n     * @inheritDoc\n     */\n    public function process(mixed $data, Operation $operation, Context $context): mixed\n    {\n        $processor = $operation->getProcessor();\n\n        if (null === $processor) {\n            return null;\n        }\n\n        if (\\is_callable($processor)) {\n            return $processor($data, $operation, $context);\n        }\n\n        if (!$this->locator->has($processor)) {\n            throw new \\RuntimeException(sprintf('Processor \"%s\" not found on operation \"%s\"', $processor, $operation->getName() ?? ''));\n        }\n\n        /** @var ProcessorInterface $processorInstance */\n        $processorInstance = $this->locator->get($processor);\n        Assert::isInstanceOf($processorInstance, ProcessorInterface::class);\n\n        return $processorInstance->process($data, $operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/State/ProcessorInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\State;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\n\n/**\n * Process data: send an email, persist to storage, add to queue etc.\n *\n * @experimental\n */\ninterface ProcessorInterface\n{\n    /**\n     * Handle the state.\n     */\n    public function process(mixed $data, Operation $operation, Context $context): mixed;\n}\n"
  },
  {
    "path": "src/Component/src/State/Provider/FactoryProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\State\\Provider;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\FactoryAwareOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\FactoryInterface;\nuse Sylius\\Resource\\State\\ProviderInterface;\n\n/**\n * @experimental\n */\nfinal class FactoryProvider implements ProviderInterface\n{\n    public function __construct(\n        private ProviderInterface $decorated,\n        private FactoryInterface $factory,\n    ) {\n    }\n\n    public function provide(Operation $operation, Context $context): object|array|null\n    {\n        $data = $this->decorated->provide($operation, $context);\n\n        $request = $context->get(RequestOption::class)?->request();\n\n        if (\n            !$operation instanceof FactoryAwareOperationInterface ||\n            !($operation->getFactory() ?? true)\n        ) {\n            return $data;\n        }\n\n        $data = $this->factory->create($operation, $context);\n\n        $request?->attributes->set('data', $data);\n\n        return $data;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/State/Provider/ReadProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\State\\Provider;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\CreateOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException;\n\n/**\n * @experimental\n */\nfinal class ReadProvider implements ProviderInterface\n{\n    public function __construct(\n        private ProviderInterface $provider,\n    ) {\n    }\n\n    public function provide(Operation $operation, Context $context): object|array|null\n    {\n        $request = $context->get(RequestOption::class)?->request();\n\n        if (\n            $operation instanceof CreateOperationInterface ||\n            !($operation->canRead() ?? true)\n        ) {\n            return null;\n        }\n\n        $data = $this->provider->provide($operation, $context);\n\n        if (null === $data) {\n            throw new NotFoundHttpException('Resource has not been found.');\n        }\n\n        $request?->attributes->set('data', $data);\n\n        return $data;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/State/Provider/SecurityProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\State\\Provider;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\OperationAccessCheckerInterface;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException;\n\n/**\n * @experimental\n */\nfinal class SecurityProvider implements ProviderInterface\n{\n    public function __construct(\n        private readonly ProviderInterface $provider,\n        private readonly OperationAccessCheckerInterface $operationAccessChecker,\n    ) {\n    }\n\n    public function provide(Operation $operation, Context $context): object|array|null\n    {\n        $data = $this->provider->provide($operation, $context);\n\n        if ($this->operationAccessChecker->isGranted($operation, $context, ['object' => $data])) {\n            return $data;\n        }\n\n        $exception = new AccessDeniedException($operation->getSecurityMessage() ?? 'Access denied.');\n        $exception->setAttributes([\n            'operation' => $operation,\n            'context' => $context,\n        ]);\n        $exception->setSubject($data);\n\n        throw $exception;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/State/Provider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\State;\n\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Webmozart\\Assert\\Assert;\n\n/**\n * @experimental\n */\nfinal class Provider implements ProviderInterface\n{\n    public function __construct(\n        private ContainerInterface $locator,\n    ) {\n    }\n\n    public function provide(Operation $operation, Context $context): object|array|null\n    {\n        $provider = $operation->getProvider();\n\n        if (null === $provider) {\n            return null;\n        }\n\n        if (\\is_callable($provider)) {\n            return $provider($operation, $context);\n        }\n\n        if (!$this->locator->has($provider)) {\n            throw new \\RuntimeException(sprintf('Provider \"%s\" not found on operation \"%s\"', $provider, $operation->getName() ?? ''));\n        }\n\n        $providerInstance = $this->locator->get($provider);\n        Assert::isInstanceOf($providerInstance, ProviderInterface::class);\n\n        return $providerInstance->provide($operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/State/ProviderInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\State;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\n\n/**\n * Retrieves data from a persistence layer.\n *\n * @experimental\n */\ninterface ProviderInterface\n{\n    public function provide(Operation $operation, Context $context): object|array|null;\n}\n"
  },
  {
    "path": "src/Component/src/State/Responder.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\State;\n\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Webmozart\\Assert\\Assert;\n\n/**\n * @experimental\n */\nfinal class Responder implements ResponderInterface\n{\n    public function __construct(private ContainerInterface $locator)\n    {\n    }\n\n    public function respond(mixed $data, Operation $operation, Context $context): mixed\n    {\n        $responder = $operation->getResponder();\n\n        if (null === $responder) {\n            return null;\n        }\n\n        if (\\is_callable($responder)) {\n            return $responder($data, $operation, $context);\n        }\n\n        if (!$this->locator->has($responder)) {\n            throw new \\RuntimeException(sprintf('Responder \"%s\" not found on operation \"%s\"', $responder, $operation->getName() ?? ''));\n        }\n\n        $responderInstance = $this->locator->get($responder);\n        Assert::isInstanceOf($responderInstance, ResponderInterface::class);\n\n        return $responderInstance->respond($data, $operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/State/ResponderInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\State;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\n\n/**\n * @experimental\n */\ninterface ResponderInterface\n{\n    /**\n     * Handle the response.\n     */\n    public function respond(mixed $data, Operation $operation, Context $context): mixed;\n}\n"
  },
  {
    "path": "src/Component/src/StateMachine/OperationStateMachine.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\StateMachine;\n\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\StateMachineAwareOperationInterface;\nuse Webmozart\\Assert\\Assert;\n\n/**\n * @experimental\n */\nfinal class OperationStateMachine implements OperationStateMachineInterface\n{\n    public function __construct(private ContainerInterface $locator)\n    {\n    }\n\n    public function can(object $data, Operation $operation, Context $context): bool\n    {\n        $stateMachine = $this->getStateMachine($operation);\n\n        return $stateMachine?->can($data, $operation, $context) ?? false;\n    }\n\n    public function apply(object $data, Operation $operation, Context $context): void\n    {\n        $stateMachine = $this->getStateMachine($operation);\n\n        $stateMachine?->apply($data, $operation, $context);\n    }\n\n    private function getStateMachine(Operation $operation): ?OperationStateMachineInterface\n    {\n        Assert::isInstanceOf($operation, StateMachineAwareOperationInterface::class);\n        $stateMachine = $operation->getStateMachineComponent();\n\n        if (null === $stateMachine) {\n            return null;\n        }\n\n        if (!$this->locator->has($stateMachine)) {\n            throw new \\RuntimeException(sprintf('State machine \"%s\" not found on operation \"%s\"', $stateMachine, $operation->getName() ?? ''));\n        }\n\n        $stateMachineInstance = $this->locator->get($stateMachine);\n        Assert::isInstanceOf($stateMachineInstance, OperationStateMachineInterface::class);\n\n        return $stateMachineInstance;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/StateMachine/OperationStateMachineInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\StateMachine;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\n\n/**\n * @experimental\n */\ninterface OperationStateMachineInterface\n{\n    public function can(object $data, Operation $operation, Context $context): bool;\n\n    public function apply(object $data, Operation $operation, Context $context): void;\n}\n"
  },
  {
    "path": "src/Component/src/StateMachine/State/ApplyStateMachineTransitionProcessor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\StateMachine\\State;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Sylius\\Resource\\StateMachine\\OperationStateMachineInterface;\n\nfinal class ApplyStateMachineTransitionProcessor implements ProcessorInterface\n{\n    public function __construct(\n        private OperationStateMachineInterface $stateMachine,\n        private ?ProcessorInterface $writeProcessor = null,\n    ) {\n    }\n\n    public function process(mixed $data, Operation $operation, Context $context): mixed\n    {\n        if (\\is_object($data) && $this->stateMachine->can($data, $operation, $context)) {\n            $this->stateMachine->apply($data, $operation, $context);\n        }\n\n        return $this->writeProcessor?->process($data, $operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/StateMachine/StateMachine.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\StateMachine;\n\nuse SM\\StateMachine\\StateMachine as BaseStateMachine;\nuse Sylius\\Resource\\Exception\\RuntimeException;\n\nif (!class_exists(BaseStateMachine::class)) {\n    throw new RuntimeException(sprintf('Cannot use the \"%s\" class when the \"winzou/state-machine\" package is not installed.', StateMachine::class));\n}\n\nfinal class StateMachine extends BaseStateMachine implements StateMachineInterface\n{\n    public function getTransitionFromState(string $fromState): ?string\n    {\n        foreach ($this->getPossibleTransitions() as $transition) {\n            $config = $this->config['transitions'][$transition];\n            if (in_array($fromState, $config['from'], true)) {\n                return $transition;\n            }\n        }\n\n        return null;\n    }\n\n    public function getTransitionToState(string $toState): ?string\n    {\n        foreach ($this->getPossibleTransitions() as $transition) {\n            $config = $this->config['transitions'][$transition];\n            if ($toState === $config['to']) {\n                return $transition;\n            }\n        }\n\n        return null;\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\StateMachine\\StateMachine::class, false)) {\n    class_alias(StateMachine::class, \\Sylius\\Component\\Resource\\StateMachine\\StateMachine::class);\n}\n"
  },
  {
    "path": "src/Component/src/StateMachine/StateMachineInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\StateMachine;\n\nuse SM\\StateMachine\\StateMachineInterface as BaseStateMachineInterface;\nuse Sylius\\Resource\\Exception\\RuntimeException;\n\nif (!interface_exists(BaseStateMachineInterface::class)) {\n    throw new RuntimeException(sprintf('Cannot use the \"%s\" interface when the \"winzou/state-machine\" package is not installed.', StateMachineInterface::class));\n}\n\ninterface StateMachineInterface extends BaseStateMachineInterface\n{\n    /**\n     * Returns the possible transition from given state or null if no transition is possible\n     */\n    public function getTransitionFromState(string $fromState): ?string;\n\n    /**\n     * Returns the possible transition to the given state or null if no transition is possible\n     */\n    public function getTransitionToState(string $toState): ?string;\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\StateMachine\\StateMachineInterface::class, false)) {\n    class_alias(StateMachineInterface::class, \\Sylius\\Component\\Resource\\StateMachine\\StateMachineInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Storage/StorageInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Storage;\n\nuse Sylius\\Resource\\Exception\\StorageUnavailableException;\n\ninterface StorageInterface\n{\n    /**\n     * @throws StorageUnavailableException\n     */\n    public function has(string $name): bool;\n\n    /**\n     * @param mixed $default\n     *\n     * @return mixed\n     *\n     * @throws StorageUnavailableException\n     */\n    public function get(string $name, $default = null);\n\n    /**\n     * @param mixed $value\n     *\n     * @throws StorageUnavailableException\n     */\n    public function set(string $name, $value): void;\n\n    /**\n     * @throws StorageUnavailableException\n     */\n    public function remove(string $name): void;\n\n    /**\n     * @throws StorageUnavailableException\n     */\n    public function all(): array;\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Storage\\StorageInterface::class, false)) {\n    class_alias(StorageInterface::class, \\Sylius\\Component\\Resource\\Storage\\StorageInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Controller/MainController.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Controller;\n\nuse Sylius\\Resource\\Context\\Initiator\\RequestContextInitiatorInterface;\nuse Sylius\\Resource\\Exception\\RuntimeException;\nuse Sylius\\Resource\\Metadata\\Operation\\HttpOperationInitiatorInterface;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\n/**\n * @experimental\n */\nfinal class MainController\n{\n    public function __construct(\n        private HttpOperationInitiatorInterface $operationInitiator,\n        private RequestContextInitiatorInterface $requestContextInitiator,\n        private ProviderInterface $provider,\n        private ProcessorInterface $processor,\n    ) {\n    }\n\n    public function __invoke(Request $request): Response\n    {\n        $operation = $this->operationInitiator->initializeOperation($request);\n\n        if (null === $operation) {\n            throw new RuntimeException('Operation should not be null.');\n        }\n\n        $context = $this->requestContextInitiator->initializeContext($request);\n\n        if (null === $operation->canWrite()) {\n            $operation = $operation->withWrite(!$request->isMethodSafe());\n        }\n\n        $data = $this->provider->provide($operation, $context);\n\n        $valid = $request->attributes->getBoolean('is_valid', true);\n        if (!$valid) {\n            $operation = $operation->withWrite(false);\n        }\n\n        return $this->processor->process($data, $operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/DependencyInjection/Compiler/DisableMetadataCachePass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\DependencyInjection\\Compiler;\n\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\n\nfinal class DisableMetadataCachePass implements CompilerPassInterface\n{\n    public function process(ContainerBuilder $container): void\n    {\n        if (\n            !$container->hasParameter('kernel.debug') ||\n            !$container->getParameter('kernel.debug')\n        ) {\n            return;\n        }\n\n        $container->removeDefinition('sylius.resource_metadata_collection.factory.cached');\n        $container->removeDefinition('sylius.metadata.resource_class_list.cached');\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/DependencyInjection/Compiler/FallbackToKernelDefaultLocalePass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\DependencyInjection\\Compiler;\n\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\n\n/**\n * @internal\n */\nfinal class FallbackToKernelDefaultLocalePass implements CompilerPassInterface\n{\n    public function process(ContainerBuilder $container): void\n    {\n        if (\n            $container->hasParameter('locale') ||\n            !$container->hasParameter('kernel.default_locale')\n        ) {\n            return;\n        }\n\n        /** @var string $locale */\n        $locale = $container->getParameter('kernel.default_locale');\n\n        $this->replaceLocaleInFlashHelper($container, $locale);\n        $this->replaceLocaleProvider($container, $locale);\n    }\n\n    private function replaceLocaleInFlashHelper(ContainerBuilder $container, string $locale): void\n    {\n        if (!$container->hasDefinition('sylius.resource_controller.flash_helper')) {\n            return;\n        }\n\n        $flashHelper = $container->getDefinition('sylius.resource_controller.flash_helper');\n        $flashHelper->replaceArgument(2, $locale);\n    }\n\n    private function replaceLocaleProvider(ContainerBuilder $container, string $locale): void\n    {\n        if (!$container->hasDefinition('sylius.translation_locale_provider.immutable')) {\n            return;\n        }\n\n        $localeProvider = $container->getDefinition('sylius.translation_locale_provider.immutable');\n        $localeProvider->replaceArgument(0, [$locale]);\n        $localeProvider->replaceArgument(1, $locale);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/DependencyInjection/Compiler/MetadataMutatorPass.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\DependencyInjection\\Compiler;\n\nuse Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Reference;\n\nfinal class MetadataMutatorPass implements CompilerPassInterface\n{\n    public function process(ContainerBuilder $container): void\n    {\n        $this->processResourceMutators($container);\n        $this->processOperationMutators($container);\n    }\n\n    public function processResourceMutators(ContainerBuilder $container): void\n    {\n        if (!$container->hasDefinition('sylius.metadata.mutator_collection.resource')) {\n            return;\n        }\n\n        $definition = $container->getDefinition('sylius.metadata.mutator_collection.resource');\n\n        $mutators = $container->findTaggedServiceIds('sylius.resource_mutator');\n\n        foreach ($mutators as $id => $tags) {\n            foreach ($tags as $tag) {\n                $definition->addMethodCall('add', [\n                    $tag['resourceClass'],\n                    new Reference($id),\n                ]);\n            }\n        }\n    }\n\n    private function processOperationMutators(ContainerBuilder $container): void\n    {\n        if (!$container->hasDefinition('sylius.metadata.mutator_collection.operation')) {\n            return;\n        }\n\n        $definition = $container->getDefinition('sylius.metadata.mutator_collection.operation');\n\n        $mutators = $container->findTaggedServiceIds('sylius.operation_mutator');\n\n        foreach ($mutators as $id => $tags) {\n            foreach ($tags as $tag) {\n                $definition->addMethodCall('add', [\n                    $tag['operationName'],\n                    new Reference($id),\n                ]);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/EventDispatcher/GenericEvent.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\EventDispatcher;\n\nuse Symfony\\Component\\EventDispatcher\\GenericEvent as BaseGenericEvent;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nclass GenericEvent extends BaseGenericEvent\n{\n    public const TYPE_ERROR = 'error';\n\n    public const TYPE_WARNING = 'warning';\n\n    public const TYPE_INFO = 'info';\n\n    public const TYPE_SUCCESS = 'success';\n\n    private string $messageType = '';\n\n    private string $message = '';\n\n    /** @var array */\n    private $messageParameters = [];\n\n    private int $errorCode = 500;\n\n    private ?Response $response = null;\n\n    /**\n     * @psalm-suppress MissingReturnType\n     */\n    public function stop(string $message, string $type = self::TYPE_ERROR, array $parameters = [], int $errorCode = 500)\n    {\n        $this->messageType = $type;\n        $this->message = $message;\n        $this->messageParameters = $parameters;\n        $this->errorCode = $errorCode;\n\n        $this->stopPropagation();\n    }\n\n    public function isStopped(): bool\n    {\n        return $this->isPropagationStopped();\n    }\n\n    public function getMessageType(): string\n    {\n        return $this->messageType;\n    }\n\n    /**\n     * @param string $messageType Should be one of ResourceEvent's TYPE constants\n     */\n    public function setMessageType($messageType): void\n    {\n        $this->messageType = $messageType;\n    }\n\n    public function getMessage(): string\n    {\n        return $this->message;\n    }\n\n    public function setMessage(string $message): void\n    {\n        $this->message = $message;\n    }\n\n    public function getMessageParameters(): array\n    {\n        return $this->messageParameters;\n    }\n\n    public function setMessageParameters(array $messageParameters): void\n    {\n        $this->messageParameters = $messageParameters;\n    }\n\n    public function getErrorCode(): int\n    {\n        return $this->errorCode;\n    }\n\n    public function setErrorCode(int $errorCode): void\n    {\n        $this->errorCode = $errorCode;\n    }\n\n    public function setResponse(Response $response): void\n    {\n        $this->response = $response;\n    }\n\n    public function hasResponse(): bool\n    {\n        return null !== $this->response;\n    }\n\n    public function getResponse(): ?Response\n    {\n        return $this->response;\n    }\n}\n\nif (!class_exists(\\Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent::class, false)) {\n    class_alias(GenericEvent::class, \\Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent::class);\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/EventDispatcher/OperationEvent.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\EventDispatcher;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\n\n/**\n * @experimental\n */\nfinal class OperationEvent extends GenericEvent\n{\n    public function getOperation(): Operation\n    {\n        /** @var Operation $operation */\n        $operation = $this->getArgument('operation');\n\n        return $operation;\n    }\n\n    public function getContext(): Context\n    {\n        /** @var Context $context */\n        $context = $this->getArgument('context');\n\n        return $context;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/EventDispatcher/OperationEventDispatcher.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\EventDispatcher;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Symfony\\Component\\EventDispatcher\\EventDispatcherInterface;\n\n/**\n * @experimental\n */\nfinal class OperationEventDispatcher implements OperationEventDispatcherInterface\n{\n    public function __construct(\n        private EventDispatcherInterface $eventDispatcher,\n    ) {\n    }\n\n    public function dispatch(mixed $data, Operation $operation, Context $context): OperationEvent\n    {\n        return $this->dispatchEvent($data, $operation, $context);\n    }\n\n    public function dispatchBulkEvent(mixed $data, Operation $operation, Context $context): OperationEvent\n    {\n        return $this->dispatchEvent($data, $operation, $context, 'bulk');\n    }\n\n    public function dispatchPreEvent(mixed $data, Operation $operation, Context $context): OperationEvent\n    {\n        return $this->dispatchEvent($data, $operation, $context, 'pre');\n    }\n\n    public function dispatchPostEvent(mixed $data, Operation $operation, Context $context): OperationEvent\n    {\n        return $this->dispatchEvent($data, $operation, $context, 'post');\n    }\n\n    public function dispatchInitializeEvent(mixed $data, Operation $operation, Context $context): OperationEvent\n    {\n        return $this->dispatchEvent($data, $operation, $context, 'initialize');\n    }\n\n    private function dispatchEvent(mixed $data, Operation $operation, Context $context, ?string $eventType = null): OperationEvent\n    {\n        $operationEvent = new OperationEvent($data, ['operation' => $operation, 'context' => $context]);\n\n        $resource = $operation->getResource();\n\n        if (null === $resource) {\n            return $operationEvent;\n        }\n\n        $eventName = sprintf(\n            '%s.%s.%s%s',\n            $resource->getApplicationName() ?? '',\n            $resource->getName() ?? '',\n            $eventType ? $eventType . '_' : '',\n            $operation->getEventShortName() ?? '',\n        );\n\n        $this->eventDispatcher->dispatch($operationEvent, $eventName);\n\n        return $operationEvent;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/EventDispatcher/OperationEventDispatcherInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\EventDispatcher;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\n\n/**\n * @experimental\n */\ninterface OperationEventDispatcherInterface\n{\n    public function dispatch(mixed $data, Operation $operation, Context $context): OperationEvent;\n\n    public function dispatchBulkEvent(mixed $data, Operation $operation, Context $context): OperationEvent;\n\n    public function dispatchPreEvent(mixed $data, Operation $operation, Context $context): OperationEvent;\n\n    public function dispatchPostEvent(mixed $data, Operation $operation, Context $context): OperationEvent;\n\n    public function dispatchInitializeEvent(mixed $data, Operation $operation, Context $context): OperationEvent;\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/EventDispatcher/OperationEventHandler.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\EventDispatcher;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Symfony\\Routing\\RedirectHandlerInterface;\nuse Sylius\\Resource\\Symfony\\Session\\Flash\\FlashHelperInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\HttpKernel\\Exception\\HttpException;\n\n/**\n * @experimental\n */\nfinal class OperationEventHandler implements OperationEventHandlerInterface\n{\n    public function __construct(\n        private RedirectHandlerInterface $redirectHandler,\n        private FlashHelperInterface $flashHelper,\n    ) {\n    }\n\n    public function handlePreProcessEvent(\n        OperationEvent $event,\n        Context $context,\n        ?string $newOperation = null,\n    ): ?Response {\n        if (!$event->isStopped()) {\n            return null;\n        }\n\n        $request = $context->get(RequestOption::class)?->request();\n\n        if ('html' !== $request?->getRequestFormat()) {\n            throw new HttpException($event->getErrorCode(), $event->getMessage());\n        }\n\n        $this->flashHelper->addFlashFromEvent($event, $context);\n\n        if (null !== $operationEventResponse = $event->getResponse()) {\n            return $operationEventResponse;\n        }\n\n        $operation = $event->getOperation();\n\n        if ($operation instanceof HttpOperation && null !== $request) {\n            if (null === $newOperation) {\n                return $this->redirectHandler->redirectToResource($event->getSubject(), $operation, $request);\n            }\n\n            return $this->redirectHandler->redirectToOperation($event->getSubject(), $operation, $request, $newOperation);\n        }\n\n        return null;\n    }\n\n    public function handlePostProcessEvent(\n        OperationEvent $event,\n        Context $context,\n    ): ?Response {\n        $request = $context->get(RequestOption::class)?->request();\n\n        if ('html' !== $request?->getRequestFormat()) {\n            return null;\n        }\n\n        return $event->getResponse();\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/EventDispatcher/OperationEventHandlerInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\EventDispatcher;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\n/**\n * @experimental\n */\ninterface OperationEventHandlerInterface\n{\n    public function handlePreProcessEvent(OperationEvent $event, Context $context, ?string $newOperation = null): ?Response;\n\n    public function handlePostProcessEvent(OperationEvent $event, Context $context): ?Response;\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/EventDispatcher/State/DispatchPostReadEventProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\EventDispatcher\\State;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\CollectionOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\ShowOperationInterface;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventDispatcherInterface;\n\n/**\n * @experimental\n */\nfinal class DispatchPostReadEventProvider implements ProviderInterface\n{\n    public function __construct(\n        private ProviderInterface $provider,\n        private OperationEventDispatcherInterface $operationEventDispatcher,\n    ) {\n    }\n\n    public function provide(Operation $operation, Context $context): object|array|null\n    {\n        $data = $this->provider->provide($operation, $context);\n\n        if (\n            $operation instanceof CollectionOperationInterface ||\n            $operation instanceof ShowOperationInterface\n        ) {\n            $this->operationEventDispatcher->dispatch(null, $operation, $context);\n        }\n\n        return $data;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/EventDispatcher/State/DispatchPostWriteEventProcessor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\EventDispatcher\\State;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventDispatcherInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventHandlerInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\n/**\n * @experimental\n */\nfinal class DispatchPostWriteEventProcessor implements ProcessorInterface\n{\n    public function __construct(\n        private ProcessorInterface $processor,\n        private OperationEventDispatcherInterface $operationEventDispatcher,\n        private OperationEventHandlerInterface $eventHandler,\n    ) {\n    }\n\n    /**\n     * @inheritDoc\n     */\n    public function process(mixed $data, Operation $operation, Context $context): mixed\n    {\n        $data = $this->processor->process($data, $operation, $context);\n\n        if ($data instanceof Response) {\n            return $data;\n        }\n\n        $operationEvent = $this->operationEventDispatcher->dispatchPostEvent($data, $operation, $context);\n\n        $eventResponse = $this->eventHandler->handlePostProcessEvent(\n            $operationEvent,\n            $context,\n        );\n\n        if (null !== $eventResponse) {\n            return $eventResponse;\n        }\n\n        return $data;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/EventDispatcher/State/DispatchPreWriteEventProcessor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\EventDispatcher\\State;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\CreateOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\ResourceActions;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventDispatcherInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventHandlerInterface;\n\n/**\n * @experimental\n */\nfinal class DispatchPreWriteEventProcessor implements ProcessorInterface\n{\n    public function __construct(\n        private ProcessorInterface $processor,\n        private OperationEventDispatcherInterface $operationEventDispatcher,\n        private OperationEventHandlerInterface $eventHandler,\n    ) {\n    }\n\n    /**\n     * @inheritDoc\n     */\n    public function process(mixed $data, Operation $operation, Context $context): mixed\n    {\n        $operationEvent = $this->operationEventDispatcher->dispatchPreEvent($data, $operation, $context);\n\n        $eventResponse = $this->eventHandler->handlePreProcessEvent(\n            $operationEvent,\n            $context,\n            $operation instanceof CreateOperationInterface ? ResourceActions::INDEX : null,\n        );\n\n        if (null !== $eventResponse) {\n            return $eventResponse;\n        }\n\n        return $this->processor->process($data, $operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/EventListener/AddFormatListener.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\EventListener;\n\nuse Negotiation\\BaseAccept;\nuse Negotiation\\Negotiator;\nuse Sylius\\Resource\\Metadata\\Operation\\HttpOperationInitiatorInterface;\nuse Symfony\\Component\\HttpKernel\\Event\\RequestEvent;\nuse Symfony\\Component\\HttpKernel\\Exception\\NotAcceptableHttpException;\n\n/**\n * @experimental\n */\nfinal class AddFormatListener\n{\n    public function __construct(\n        private HttpOperationInitiatorInterface $operationInitiator,\n        private Negotiator $negotiator,\n    ) {\n    }\n\n    public function onKernelRequest(RequestEvent $event): void\n    {\n        $request = $event->getRequest();\n        $operation = $this->operationInitiator->initializeOperation($request);\n\n        if (\n            null === $operation\n        ) {\n            return;\n        }\n\n        $mimeTypes = ['text/html', 'application/json', 'application/xml'];\n\n        // First, try to guess the format from the Accept header\n        $accept = $request->headers->get('Accept');\n        if (null !== $accept) {\n            /** @var BaseAccept|null $mediaType */\n            $mediaType = $this->negotiator->getBest($accept, $mimeTypes);\n\n            if (null !== $mediaType) {\n                $request->setRequestFormat($request->getFormat($mediaType->getType()));\n\n                return;\n            }\n        }\n\n        // Then use the Symfony request format if available and applicable\n        $requestFormat = $request->getRequestFormat(null);\n        if (null !== $requestFormat) {\n            $mimeType = $request->getMimeType($requestFormat);\n\n            if (\\in_array($mimeType, $mimeTypes, true)) {\n                return;\n            }\n\n            throw $this->getNotAcceptableHttpException($mimeType ?? '', $mimeTypes);\n        }\n    }\n\n    /**\n     * Retrieves an instance of NotAcceptableHttpException.\n     */\n    private function getNotAcceptableHttpException(string $accept, array $mimeTypes): NotAcceptableHttpException\n    {\n        return new NotAcceptableHttpException(sprintf(\n            'Requested format \"%s\" is not supported. Supported MIME types are \"%s\".',\n            $accept,\n            implode('\", \"', $mimeTypes),\n        ));\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/ExpressionLanguage/ArgumentParser.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\ExpressionLanguage;\n\nuse Symfony\\Component\\ExpressionLanguage\\ExpressionFunctionProviderInterface;\nuse Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage;\nuse Webmozart\\Assert\\Assert;\n\n/**\n * @experimental\n */\nfinal class ArgumentParser implements ArgumentParserInterface\n{\n    public function __construct(\n        private readonly ExpressionLanguage $expressionLanguage,\n        private readonly VariablesCollectionInterface $variablesCollection,\n        ?iterable $providers = null,\n    ) {\n        foreach ($providers ?? [] as $provider) {\n            Assert::isInstanceOf($provider, ExpressionFunctionProviderInterface::class);\n\n            $this->expressionLanguage->registerProvider($provider);\n        }\n    }\n\n    public function parseExpression(string $expression, array $variables = []): mixed\n    {\n        return $this->expressionLanguage->evaluate(\n            $expression,\n            array_merge(\n                $this->variablesCollection->getVariables(),\n                $variables,\n            ),\n        );\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/ExpressionLanguage/ArgumentParserInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\ExpressionLanguage;\n\n/**\n * @experimental\n */\ninterface ArgumentParserInterface\n{\n    public function parseExpression(string $expression, array $variables = []): mixed;\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/ExpressionLanguage/Provider/ThrowNotFoundOnNullExpressionFunctionProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\ExpressionLanguage\\Provider;\n\nuse Symfony\\Component\\ExpressionLanguage\\ExpressionFunction;\nuse Symfony\\Component\\ExpressionLanguage\\ExpressionFunctionProviderInterface;\nuse Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException;\n\nfinal class ThrowNotFoundOnNullExpressionFunctionProvider implements ExpressionFunctionProviderInterface\n{\n    public function getFunctions(): array\n    {\n        return [\n            new ExpressionFunction(\n                'throw_not_found_on_null',\n                function (string $value, string ...$args): string {\n                    $message = $args[0] ?? '';\n\n                    return sprintf(\n                        '(null !== %1$s) ? %1$s : throw new \\Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(%2$s)',\n                        $value,\n                        $message,\n                    );\n                },\n                function (array $arguments, mixed $value, ?string $message = null): mixed {\n                    if (null === $value) {\n                        throw new NotFoundHttpException($message ?? '');\n                    }\n\n                    return $value;\n                },\n            ),\n        ];\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/ExpressionLanguage/RequestVariables.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\ExpressionLanguage;\n\nuse Symfony\\Component\\HttpFoundation\\RequestStack;\n\n/**\n * @experimental\n */\nfinal class RequestVariables implements VariablesInterface\n{\n    public function __construct(private RequestStack $requestStack)\n    {\n    }\n\n    public function getVariables(): array\n    {\n        return [\n            'request' => $this->requestStack->getCurrentRequest(),\n        ];\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/ExpressionLanguage/SyliusRepositoriesVariables.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\ExpressionLanguage;\n\nuse Psr\\Container\\ContainerInterface;\n\nfinal class SyliusRepositoriesVariables implements VariablesInterface\n{\n    public function __construct(\n        private readonly ContainerInterface $repositories,\n    ) {\n    }\n\n    public function getVariables(): array\n    {\n        return [\n            'sylius_repositories' => $this->repositories,\n        ];\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/ExpressionLanguage/TokenVariables.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\ExpressionLanguage;\n\nuse Symfony\\Component\\Security\\Core\\Authentication\\Token\\NullToken;\nuse Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorageInterface;\n\n/**\n * @experimental\n */\nfinal class TokenVariables implements VariablesInterface\n{\n    public function __construct(private ?TokenStorageInterface $tokenStorage = null)\n    {\n    }\n\n    public function getVariables(): array\n    {\n        if (null === $this->tokenStorage) {\n            throw new \\LogicException('The \"symfony/security-bundle\" must be installed and configured to use the \"token\" & \"user\" attribute. Try running \"composer require symfony/security-bundle\"');\n        }\n\n        if (null === $token = $this->tokenStorage->getToken()) {\n            $token = new NullToken();\n        }\n\n        return [\n            'token' => $token,\n            'user' => $token->getUser(),\n        ];\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/ExpressionLanguage/VariablesCollection.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\ExpressionLanguage;\n\nuse Webmozart\\Assert\\Assert;\n\n/**\n * @experimental\n */\nfinal class VariablesCollection implements VariablesCollectionInterface\n{\n    /** @param iterable<int, VariablesInterface> $iterator */\n    public function __construct(private iterable $iterator)\n    {\n        Assert::allIsInstanceOf($this->iterator, VariablesInterface::class);\n    }\n\n    public function getVariables(): array\n    {\n        $variables = [];\n\n        foreach ($this->iterator as $variable) {\n            $variables = array_merge($variables, $variable->getVariables());\n        }\n\n        return $variables;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/ExpressionLanguage/VariablesCollectionInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\ExpressionLanguage;\n\n/**\n * @experimental\n */\ninterface VariablesCollectionInterface\n{\n    public function getVariables(): array;\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/ExpressionLanguage/VariablesInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\ExpressionLanguage;\n\n/**\n * @experimental\n */\ninterface VariablesInterface\n{\n    public function getVariables(): array;\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/ExpressionLanguage/VarsResolver.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\ExpressionLanguage;\n\n/**\n * @experimental\n */\nfinal class VarsResolver implements VarsResolverInterface\n{\n    public function __construct(\n        private readonly ArgumentParser $argumentParser,\n    ) {\n    }\n\n    public function resolve(array $vars): array\n    {\n        foreach ($vars as $key => $value) {\n            if (\\is_array($value)) {\n                $vars[$key] = $this->resolve($value);\n\n                continue;\n            }\n\n            // Parse only vars that contain expressions\n            if (!str_starts_with($value, '@=')) {\n                continue;\n            }\n\n            $value = str_replace('@=', '', $value);\n\n            $vars[$key] = $this->argumentParser->parseExpression($value);\n        }\n\n        return $vars;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/ExpressionLanguage/VarsResolverInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\ExpressionLanguage;\n\n/**\n * @experimental\n */\ninterface VarsResolverInterface\n{\n    public function resolve(array $vars): array;\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Form/Factory/FormFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Form\\Factory;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Exception\\InvalidArgumentException;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\ArgumentParserInterface;\nuse Symfony\\Component\\Form\\FormFactoryInterface as SymfonyFormFactoryInterface;\nuse Symfony\\Component\\Form\\FormInterface;\n\n/**\n * @experimental\n */\nfinal class FormFactory implements FormFactoryInterface\n{\n    public function __construct(\n        private readonly SymfonyFormFactoryInterface $formFactory,\n        private readonly ArgumentParserInterface $argumentParser,\n    ) {\n    }\n\n    public function create(Operation $operation, Context $context, mixed $data = null): FormInterface\n    {\n        $formType = $operation->getFormType();\n        $formOptions = $this->parseFormOptions($operation->getFormOptions() ?? []);\n\n        if (null === $formType) {\n            throw new \\RuntimeException(sprintf('Operation \"%s\" has no configured form type.', $operation->getName() ?? ''));\n        }\n\n        $request = $context->get(RequestOption::class)?->request();\n\n        if ('html' === $request?->getRequestFormat()) {\n            return $this->formFactory->create($formType, $data, $formOptions);\n        }\n\n        return $this->formFactory->createNamed('', $formType, $data, array_merge($formOptions, ['csrf_protection' => false]));\n    }\n\n    /**\n     * @param array<string, mixed> $formOptions\n     *\n     * @return array<string, mixed>\n     */\n    private function parseFormOptions(array $formOptions): array\n    {\n        foreach ($formOptions as $key => $value) {\n            if (\\is_array($value)) {\n                $formOptions[$key] = $this->parseFormOptions($value);\n\n                continue;\n            }\n\n            if (!\\is_scalar($value)) {\n                throw new InvalidArgumentException(sprintf('Parameter \"%s\" should be a scalar or an array.', $key));\n            }\n\n            if (!is_string($value) || !str_starts_with($value, '@=')) {\n                continue;\n            }\n\n            $value = substr($value, 2);\n\n            $formOptions[$key] = $this->argumentParser->parseExpression($value);\n        }\n\n        return $formOptions;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Form/Factory/FormFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Form\\Factory;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Symfony\\Component\\Form\\FormInterface;\n\n/**\n * @experimental\n */\ninterface FormFactoryInterface\n{\n    public function create(Operation $operation, Context $context, mixed $data = null): FormInterface;\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Form/State/FormProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Form\\State;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\BulkOperationInterface;\nuse Sylius\\Resource\\Metadata\\CreateOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\UpdateOperationInterface;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Sylius\\Resource\\Symfony\\Form\\Factory\\FormFactoryInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\n/**\n * @experimental\n */\nfinal class FormProvider implements ProviderInterface\n{\n    public function __construct(\n        private ProviderInterface $decorated,\n        private FormFactoryInterface $formFactory,\n    ) {\n    }\n\n    public function provide(Operation $operation, Context $context): object|array|null\n    {\n        $data = $this->decorated->provide($operation, $context);\n\n        $request = $context->get(RequestOption::class)?->request();\n\n        if (null === $request) {\n            return $data;\n        }\n\n        /** @var string $format */\n        $format = $request->getRequestFormat();\n\n        if (\n            $data instanceof Response ||\n            $operation instanceof BulkOperationInterface ||\n            !($operation instanceof CreateOperationInterface || $operation instanceof UpdateOperationInterface) ||\n            'html' !== $format ||\n            null === $operation->getFormType()\n        ) {\n            return $data;\n        }\n\n        $form = $this->formFactory->create($operation, $context, $data);\n        $form->handleRequest($request);\n\n        $request->attributes->set('form', $form);\n\n        return $data;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Request/RepositoryArgumentResolver.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Request;\n\nuse Sylius\\Resource\\Reflection\\Filter\\FunctionArgumentsFilter;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\n/**\n * @experimental\n */\nfinal class RepositoryArgumentResolver\n{\n    public function getArguments(Request $request, \\ReflectionFunctionAbstract $reflector): array\n    {\n        $allArguments = [\n            $request->attributes->all('_route_params'),\n            $request->query->all(),\n            $request->request->all(),\n        ];\n\n        foreach ($allArguments as $arguments) {\n            $matchedArguments = FunctionArgumentsFilter::filter($reflector, $arguments);\n\n            if (0 === count($matchedArguments) && $this->hasOnlyOneRequiredArrayParameter($reflector)) {\n                $arguments = $this->filterPrivateArguments($arguments);\n\n                return [$arguments];\n            }\n\n            if ('__call' === $reflector->getName()) {\n                $arguments = $this->filterPrivateArguments($arguments);\n\n                if ([] === $arguments) {\n                    continue;\n                }\n\n                return array_values($arguments);\n            }\n\n            if ([] === $matchedArguments) {\n                continue;\n            }\n\n            return $matchedArguments;\n        }\n\n        return [];\n    }\n\n    /**\n     * @param array<string, mixed> $arguments\n     */\n    private function filterPrivateArguments(array $arguments): array\n    {\n        return array_filter($arguments, function (string $key): bool {\n            return !str_starts_with($key, '_');\n        }, \\ARRAY_FILTER_USE_KEY);\n    }\n\n    private function hasOnlyOneRequiredArrayParameter(\\ReflectionFunctionAbstract $reflector): bool\n    {\n        /** @var array|\\ReflectionParameter[] $parameters */\n        $parameters = $reflector->getParameters();\n\n        $parameters = array_filter($parameters, function ($parameter): bool {\n            return !$parameter->isDefaultValueAvailable();\n        });\n\n        if (1 !== \\count($parameters)) {\n            return false;\n        }\n\n        $parameterType = $parameters[0]->getType()?->__toString();\n\n        return 'array' === $parameterType;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Request/State/ApiResponder.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Request\\State;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\CreateOperationInterface;\nuse Sylius\\Resource\\Metadata\\DeleteOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\UpdateOperationInterface;\nuse Sylius\\Resource\\State\\ResponderInterface;\nuse Sylius\\Resource\\Symfony\\Response\\HeadersInitiatorInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Webmozart\\Assert\\Assert;\n\n/**\n * @experimental\n */\nfinal class ApiResponder implements ResponderInterface\n{\n    public function __construct(private HeadersInitiatorInterface $headersInitializer)\n    {\n    }\n\n    public function respond(mixed $data, Operation $operation, Context $context): ?Response\n    {\n        $request = $context->get(RequestOption::class)?->request();\n\n        if (null === $request) {\n            return null;\n        }\n\n        $isValid = $request->attributes->getBoolean('is_valid', true);\n\n        Assert::string($data, 'Data are not serialized but it should.');\n\n        /** @var string $format */\n        $format = $request->getRequestFormat();\n\n        /** @var string $mimeType */\n        $mimeType = $request->getMimeType($format);\n\n        $headers = $this->headersInitializer->initializeHeaders($mimeType);\n\n        $status = Response::HTTP_OK;\n\n        if ($operation instanceof CreateOperationInterface) {\n            $status = Response::HTTP_CREATED;\n        }\n\n        if ($operation instanceof DeleteOperationInterface || $operation instanceof UpdateOperationInterface) {\n            $status = Response::HTTP_NO_CONTENT;\n        }\n\n        return new Response($data, $isValid ? $status : Response::HTTP_UNPROCESSABLE_ENTITY, $headers);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Request/State/Provider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Request\\State;\n\nuse Pagerfanta\\PagerfantaInterface;\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\CreatePaginatorTrait;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Exception\\InvalidArgumentException;\nuse Sylius\\Resource\\Exception\\RuntimeException;\nuse Sylius\\Resource\\Metadata\\BulkOperationInterface;\nuse Sylius\\Resource\\Metadata\\CollectionOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Reflection\\CallableReflection;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\ArgumentParserInterface;\nuse Sylius\\Resource\\Symfony\\Request\\RepositoryArgumentResolver;\n\n/**\n * @experimental\n */\nfinal class Provider implements ProviderInterface\n{\n    public function __construct(\n        private ContainerInterface $locator,\n        private RepositoryArgumentResolver $argumentResolver,\n        private ArgumentParserInterface $argumentParser,\n    ) {\n    }\n\n    public function provide(Operation $operation, Context $context): object|array|null\n    {\n        $request = $context->get(RequestOption::class)?->request();\n        $repository = $operation->getRepository();\n\n        if (\n            null === $request ||\n            null === $repository\n        ) {\n            return null;\n        }\n\n        $repositoryInstance = null;\n        $arguments = $this->parseArgumentValues($operation->getRepositoryArguments() ?? []);\n\n        if (\\is_string($repository)) {\n            $defaultMethod = $operation instanceof CollectionOperationInterface ? 'createPaginator' : 'findOneBy';\n\n            if ($operation instanceof BulkOperationInterface) {\n                $defaultMethod = 'findById';\n            }\n\n            $customMethod = $operation->getRepositoryMethod();\n            $method = $customMethod ?? $defaultMethod;\n\n            if (!$this->locator->has($repository)) {\n                throw new RuntimeException(sprintf('Repository \"%s\" not found on operation \"%s\".', $repository, $operation->getName() ?? ''));\n            }\n\n            /** @var object $repositoryInstance */\n            $repositoryInstance = $this->locator->get($repository);\n\n            if (\n                !str_starts_with($method, 'find') &&  // to allow magic calls on Doctrine repository methods\n                !\\method_exists($repositoryInstance, $method)) {\n                $errorMessage = sprintf('Method \"%s\" not found on repository \"%s\". You can either add it or configure another one in the repositoryMethod option for your operation.', $method, get_debug_type($repositoryInstance));\n\n                if ('createPaginator' === $method) {\n                    $errorMessage = sprintf('Method \"%s\" not found on repository \"%s\". You can use the \"%s\" trait on this repository class.', $method, get_debug_type($repositoryInstance), CreatePaginatorTrait::class);\n                }\n\n                throw new RuntimeException($errorMessage);\n            }\n\n            // make it as callable\n            /** @var callable $repository */\n            $repository = [$repositoryInstance, $method];\n        }\n\n        try {\n            $reflector = CallableReflection::from($repository);\n        } catch (\\ReflectionException $exception) {\n            if (null === $repositoryInstance) {\n                throw $exception;\n            }\n\n            /** @var callable $callable */\n            $callable = [$repositoryInstance, '__call'];\n\n            $reflector = CallableReflection::from($callable);\n        }\n\n        if ([] === $arguments) {\n            $arguments = $this->argumentResolver->getArguments($request, $reflector);\n        }\n\n        $data = $repository(...$arguments);\n\n        if ($data instanceof PagerfantaInterface) {\n            $currentPage = $request->query->getInt('page', 1);\n            $data->setCurrentPage($currentPage);\n        }\n\n        return $data;\n    }\n\n    private function parseArgumentValues(array $arguments): array\n    {\n        foreach ($arguments as $key => $value) {\n            if (is_array($value)) {\n                $arguments[$key] = $this->parseArgumentValues($value);\n\n                continue;\n            }\n\n            if (!\\is_scalar($value)) {\n                throw new InvalidArgumentException(sprintf('Parameter \"%s\" should be a scalar or an array.', $key));\n            }\n\n            $arguments[$key] = \\is_string($value) ? $this->parseStringValue($value) : $value;\n        }\n\n        return $arguments;\n    }\n\n    private function parseStringValue(string $value): mixed\n    {\n        if (!str_starts_with($value, '@=')) {\n            $value = '@=' . $value;\n            trigger_deprecation('sylius/resource-bundle', '1.14', 'You passed \"%s\" as a string value in your repository arguments. If this is a value that needs to be parsed using the expression language, please prefix your string with \"@=\". In your case, use \"@=%s\".\"', $value, $value);\n        }\n\n        // Not reachable as long as the BC layer above is there\n        if (!str_starts_with($value, '@=')) {\n            return $value;\n        }\n\n        $value = substr($value, 2);\n\n        return $this->argumentParser->parseExpression($value);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Request/State/Responder.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Request\\State;\n\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ResponderInterface;\n\n/**\n * @experimental\n */\nfinal class Responder implements ResponderInterface\n{\n    private const RESPONDER_HTML = 'sylius.state_responder.html';\n\n    private const RESPONDER_API = 'sylius.state_responder.api';\n\n    public function __construct(private ContainerInterface $locator)\n    {\n    }\n\n    public function respond(mixed $data, Operation $operation, Context $context): mixed\n    {\n        $request = $context->get(RequestOption::class)?->request();\n\n        if (null === $request) {\n            return null;\n        }\n\n        $format = $request->getRequestFormat();\n\n        if ('html' === $format) {\n            if (!$this->locator->has(self::RESPONDER_HTML)) {\n                throw new \\LogicException(sprintf('Responder \"%s\" was not found but it should.', self::RESPONDER_HTML));\n            }\n\n            /** @var ResponderInterface $responder */\n            $responder = $this->locator->get(self::RESPONDER_HTML);\n\n            return $responder->respond($data, $operation, $context);\n        }\n\n        if (!$this->locator->has(self::RESPONDER_API)) {\n            throw new \\LogicException(sprintf('Responder \"%s\" was not found but it should.', self::RESPONDER_API));\n        }\n\n        /** @var ResponderInterface $responder */\n        $responder = $this->locator->get(self::RESPONDER_API);\n\n        return $responder->respond($data, $operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Request/State/TwigResponder.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Request\\State;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\CreateOperationInterface;\nuse Sylius\\Resource\\Metadata\\DeleteOperationInterface;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\UpdateOperationInterface;\nuse Sylius\\Resource\\State\\ResponderInterface;\nuse Sylius\\Resource\\Symfony\\Routing\\RedirectHandlerInterface;\nuse Sylius\\Resource\\Twig\\Context\\Factory\\ContextFactoryInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Twig\\Environment;\n\n/**\n * @experimental\n */\nfinal class TwigResponder implements ResponderInterface\n{\n    public function __construct(\n        private RedirectHandlerInterface $redirectHandler,\n        private ContextFactoryInterface $contextFactory,\n        private ?Environment $twig,\n    ) {\n    }\n\n    public function respond(mixed $data, Operation $operation, Context $context): ?Response\n    {\n        $request = $context->get(RequestOption::class)?->request();\n\n        if (null === $this->twig) {\n            throw new \\LogicException('You can not use the \"Twig\" if it is not available. Try running \"composer require twig\".');\n        }\n\n        if (null === $request) {\n            return null;\n        }\n\n        $isValid = $request->attributes->getBoolean('is_valid', true);\n\n        if ($operation instanceof DeleteOperationInterface && $operation instanceof HttpOperation) {\n            return $this->redirectHandler->redirectToResource($data, $operation, $request);\n        }\n\n        if (\n            $isValid &&\n            !$request->isMethodSafe() &&\n            $operation instanceof HttpOperation &&\n            ($operation instanceof UpdateOperationInterface || $operation instanceof CreateOperationInterface)\n        ) {\n            return $this->redirectHandler->redirectToResource($data, $operation, $request);\n        }\n\n        $content = $this->twig->render(\n            $operation->getTemplate() ?? '',\n            $this->contextFactory->create($data, $operation, $context),\n        );\n\n        return new Response($content, $request->isMethodSafe() || $isValid ? Response::HTTP_OK : Response::HTTP_UNPROCESSABLE_ENTITY);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Response/ApiHeadersInitiator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Response;\n\n/**\n * @experimental\n */\nfinal class ApiHeadersInitiator implements HeadersInitiatorInterface\n{\n    public function initializeHeaders(string $mimeType): array\n    {\n        return [\n            'Content-Type' => sprintf('%s; charset=utf-8', $mimeType),\n            'Vary' => 'Accept',\n            'X-Content-Type-Options' => 'nosniff',\n            'X-Frame-Options' => 'deny',\n        ];\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Response/HeadersInitiatorInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Response;\n\n/**\n * @experimental\n */\ninterface HeadersInitiatorInterface\n{\n    public function initializeHeaders(string $mimeType): array;\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Factory/AttributesOperationRouteFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Factory;\n\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\Resource\\ResourceRouteCollectionFactory;\nuse Symfony\\Component\\Routing\\Route;\nuse Symfony\\Component\\Routing\\RouteCollection;\nuse Webmozart\\Assert\\Assert;\n\n/**\n * @deprecated use ResourceRouteCollectionFactory instead\n */\nfinal class AttributesOperationRouteFactory implements AttributesOperationRouteFactoryInterface\n{\n    public function __construct(\n        private RegistryInterface $resourceRegistry,\n        private OperationRouteFactoryInterface $operationRouteFactory,\n        private ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory,\n    ) {\n    }\n\n    public function createRouteForClass(RouteCollection $routeCollection, string $className): void\n    {\n        $resourceMetadata = $this->resourceMetadataFactory->create($className);\n\n        /** @var ResourceMetadata $resource */\n        foreach ($resourceMetadata->getIterator() as $resource) {\n            $this->createRoutesForResource($routeCollection, $resource);\n        }\n    }\n\n    private function createRoutesForResource(RouteCollection $routeCollection, ResourceMetadata $resource): void\n    {\n        foreach ($resource->getOperations() ?? new Operations() as $operation) {\n            if (!$operation instanceof HttpOperation) {\n                continue;\n            }\n\n            $this->addRouteForOperation($routeCollection, $resource, $operation);\n        }\n    }\n\n    private function addRouteForOperation(RouteCollection $routeCollection, ResourceMetadata $resource, HttpOperation $operation): void\n    {\n        $metadata = $this->resourceRegistry->get($resource->getAlias() ?? '');\n        $routeName = $operation->getRouteName();\n\n        Assert::notNull($routeName, sprintf('Operation %s has no route name. Please define one.', $operation::class));\n\n        $route = $this->createRoute($metadata, $resource, $operation);\n        $routeCollection->add($routeName, $route, $operation->getRoutePriority() ?? 0);\n    }\n\n    private function createRoute(MetadataInterface $metadata, ResourceMetadata $resource, HttpOperation $operation): Route\n    {\n        return $this->operationRouteFactory->create($metadata, $resource, $operation);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Factory/AttributesOperationRouteFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Factory;\n\nuse Symfony\\Component\\Routing\\RouteCollection;\n\n/**\n * @deprecated use Sylius\\Resource\\Symfony\\Routing\\Factory\\Resource\\ResourceRouteCollectionFactoryInterface instead\n */\ninterface AttributesOperationRouteFactoryInterface\n{\n    /** @psalm-param class-string $className */\n    public function createRouteForClass(RouteCollection $routeCollection, string $className): void;\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Factory/OperationRouteFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Factory;\n\nuse Behat\\Transliterator\\Transliterator;\nuse Gedmo\\Sluggable\\Util\\Urlizer;\nuse Sylius\\Resource\\Exception\\RuntimeException;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\Operation\\PathSegmentNameGeneratorInterface;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\OperationRoutePathFactoryInterface;\nuse Symfony\\Component\\Routing\\Route;\n\n/**\n * @experimental\n */\nfinal class OperationRouteFactory implements OperationRouteFactoryInterface\n{\n    public function __construct(\n        private OperationRoutePathFactoryInterface $routePathFactory,\n        private PathSegmentNameGeneratorInterface $pathSegmentNameGenerator,\n        private bool $routingPathBcLayer = true,\n    ) {\n    }\n\n    public function create(MetadataInterface $metadata, ResourceMetadata $resource, HttpOperation $operation): Route\n    {\n        $routePath = $operation->getPath() ?? $this->getDefaultRoutePath($metadata, $resource, $operation);\n\n        if (null !== $routePrefix = $operation->getRoutePrefix()) {\n            $routePath = sprintf('%s/%s', rtrim($routePrefix, '/'), ltrim($routePath, '/'));\n        }\n\n        return new Route(\n            path: $routePath,\n            defaults: [\n                '_controller' => 'sylius.main_controller',\n                '_sylius' => $this->getSyliusOptions($resource, $operation),\n            ],\n            requirements: $operation->getRouteRequirements() ?? [],\n            methods: $operation->getMethods() ?? [],\n            condition: $operation->getRouteCondition(),\n        );\n    }\n\n    private function getDefaultRoutePath(MetadataInterface $legacyMetadata, ResourceMetadata $resource, HttpOperation $operation): string\n    {\n        return $this->getDefaultRoutePathForOperation($legacyMetadata, $resource, $operation);\n    }\n\n    private function getDefaultRoutePathForOperation(MetadataInterface $legacyMetadata, ResourceMetadata $resource, HttpOperation $operation): string\n    {\n        if (null !== $path = $operation->getPath()) {\n            return $path;\n        }\n\n        return $this->routePathFactory->createRoutePath($operation, $this->getRootPath($legacyMetadata, $resource));\n    }\n\n    private function getRootPath(MetadataInterface $legacyMetadata, ResourceMetadata $resource): string\n    {\n        if ($this->routingPathBcLayer) {\n            if (!class_exists(Urlizer::class) || !class_exists(Transliterator::class)) {\n                throw new RuntimeException('Cannot use the routing bc-layer when the \"behat/transliterator\" package is not installed. Try to disable the routing path bc-layer in the Sylius Resource Bundle configuration using \"sylius_resource.routing_path_bc_layer: false\"');\n            }\n\n            return Urlizer::urlize($legacyMetadata->getPluralName());\n        }\n\n        return $this->pathSegmentNameGenerator->getSegmentName(\n            name: $resource->getPluralName() ?? '',\n            pluralize: false,\n        );\n    }\n\n    private function getSyliusOptions(ResourceMetadata $resource, HttpOperation $operation): array\n    {\n        $options = ['resource' => $resource->getAlias()];\n\n        if (null !== $section = $resource->getSection()) {\n            $options['section'] = $section;\n        }\n\n        // For Legacy Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration\n        if (null !== $vars = $operation->getVars()) {\n            $options['vars'] = $vars;\n        }\n\n        return $options;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Factory/OperationRouteFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Factory;\n\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Symfony\\Component\\Routing\\Route;\n\n/**\n * @experimental\n */\ninterface OperationRouteFactoryInterface\n{\n    public function create(MetadataInterface $metadata, ResourceMetadata $resource, HttpOperation $operation): Route;\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Factory/Resource/ResourceRouteCollectionFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Factory\\Resource;\n\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\OperationRouteFactoryInterface;\nuse Symfony\\Component\\Routing\\Route;\nuse Symfony\\Component\\Routing\\RouteCollection;\nuse Webmozart\\Assert\\Assert;\n\n/**\n * @experimental\n */\nfinal class ResourceRouteCollectionFactory implements ResourceRouteCollectionFactoryInterface\n{\n    public function __construct(\n        private readonly OperationRouteFactoryInterface $operationRouteFactory,\n        private readonly ResourceMetadataCollectionFactoryInterface $resourceMetadataFactory,\n        private readonly RegistryInterface $resourceRegistry,\n    ) {\n    }\n\n    public function createRouteCollectionForClass(string $className): RouteCollection\n    {\n        $routeCollection = new RouteCollection();\n        $resourceMetadata = $this->resourceMetadataFactory->create($className);\n\n        /** @var ResourceMetadata $resource */\n        foreach ($resourceMetadata->getIterator() as $resource) {\n            $this->createRoutesForResource($routeCollection, $resource);\n        }\n\n        return $routeCollection;\n    }\n\n    private function createRoutesForResource(RouteCollection $routeCollection, ResourceMetadata $resource): void\n    {\n        foreach ($resource->getOperations() ?? new Operations() as $operation) {\n            if (!$operation instanceof HttpOperation) {\n                continue;\n            }\n\n            $this->addRouteForOperation($routeCollection, $resource, $operation);\n        }\n    }\n\n    private function addRouteForOperation(RouteCollection $routeCollection, ResourceMetadata $resource, HttpOperation $operation): void\n    {\n        $alias = $resource->getAlias();\n        Assert::notNull($alias, sprintf('Resource of %s has no alias.', $resource->getClass() ?? ''));\n\n        $metadata = $this->resourceRegistry->get($alias);\n        $routeName = $operation->getRouteName();\n\n        Assert::notNull($routeName, sprintf(\n            'Operation %s of %s has no route name. Please define one.',\n            $operation::class,\n            $alias,\n        ));\n\n        $route = $this->createRoute($metadata, $resource, $operation);\n        $routeCollection->add($routeName, $route, $operation->getRoutePriority() ?? 0);\n    }\n\n    private function createRoute(MetadataInterface $metadata, ResourceMetadata $resource, HttpOperation $operation): Route\n    {\n        return $this->operationRouteFactory->create($metadata, $resource, $operation);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Factory/Resource/ResourceRouteCollectionFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Factory\\Resource;\n\nuse Symfony\\Component\\Routing\\RouteCollection;\n\n/**\n * @experimental\n */\ninterface ResourceRouteCollectionFactoryInterface\n{\n    /** @param class-string $className */\n    public function createRouteCollectionForClass(string $className): RouteCollection;\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Factory/RouteName/OperationRouteNameFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Factory\\RouteName;\n\nuse Sylius\\Resource\\Metadata\\Operation;\n\n/**\n * @experimental\n */\nfinal class OperationRouteNameFactory implements OperationRouteNameFactoryInterface\n{\n    public function createRouteName(Operation $operation, ?string $shortName = null): string\n    {\n        $resource = $operation->getResource();\n\n        if (null === $resource) {\n            throw new \\RuntimeException(sprintf('No resource was found on the operation \"%s\"', $operation->getShortName() ?? ''));\n        }\n\n        $section = $resource->getSection();\n        $sectionPrefix = $section ? $section . '_' : '';\n\n        return sprintf(\n            '%s_%s%s_%s',\n            $resource->getApplicationName() ?? '',\n            $sectionPrefix,\n            $resource->getName() ?? '',\n            $shortName ?? $operation->getShortName() ?? '',\n        );\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Factory/RouteName/OperationRouteNameFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Factory\\RouteName;\n\nuse Sylius\\Resource\\Metadata\\Operation;\n\n/**\n * @experimental\n */\ninterface OperationRouteNameFactoryInterface\n{\n    public function createRouteName(Operation $operation, ?string $shortName = null): string;\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Factory/RoutePath/BulkOperationRoutePathFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath;\n\nuse Sylius\\Resource\\Metadata\\BulkOperationInterface;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Operation\\PathSegmentNameGeneratorInterface;\n\n/**\n * @experimental\n */\nfinal class BulkOperationRoutePathFactory implements OperationRoutePathFactoryInterface\n{\n    public function __construct(\n        private OperationRoutePathFactoryInterface $decorated,\n        private PathSegmentNameGeneratorInterface $pathSegmentNameGenerator,\n    ) {\n    }\n\n    public function createRoutePath(HttpOperation $operation, string $rootPath): string\n    {\n        $shortName = $operation->getShortName() ?? '';\n\n        if ($operation instanceof BulkOperationInterface) {\n            return sprintf('%s/%s', $rootPath, $this->pathSegmentNameGenerator->getSegmentName($shortName, false));\n        }\n\n        return $this->decorated->createRoutePath($operation, $rootPath);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Factory/RoutePath/CollectionOperationRoutePathFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath;\n\nuse Sylius\\Resource\\Metadata\\CollectionOperationInterface;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Operation\\PathSegmentNameGeneratorInterface;\n\n/**\n * @experimental\n */\nfinal class CollectionOperationRoutePathFactory implements OperationRoutePathFactoryInterface\n{\n    public function __construct(\n        private OperationRoutePathFactoryInterface $decorated,\n        private PathSegmentNameGeneratorInterface $pathSegmentNameGenerator,\n    ) {\n    }\n\n    public function createRoutePath(HttpOperation $operation, string $rootPath): string\n    {\n        $shortName = $operation->getShortName();\n\n        if ($operation instanceof CollectionOperationInterface) {\n            $path = match ($shortName) {\n                'index', 'get_collection' => '',\n                default => '/' . $this->pathSegmentNameGenerator->getSegmentName($shortName ?? '', false),\n            };\n\n            return sprintf('%s%s', $rootPath, $path);\n        }\n\n        return $this->decorated->createRoutePath($operation, $rootPath);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Factory/RoutePath/CreateOperationRoutePathFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath;\n\nuse Sylius\\Resource\\Metadata\\CreateOperationInterface;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Operation\\PathSegmentNameGeneratorInterface;\n\n/**\n * @experimental\n */\nfinal class CreateOperationRoutePathFactory implements OperationRoutePathFactoryInterface\n{\n    public function __construct(\n        private OperationRoutePathFactoryInterface $decorated,\n        private PathSegmentNameGeneratorInterface $pathSegmentNameGenerator,\n    ) {\n    }\n\n    public function createRoutePath(HttpOperation $operation, string $rootPath): string\n    {\n        $shortName = $operation->getShortName();\n\n        if ($operation instanceof CreateOperationInterface) {\n            $path = match ($shortName) {\n                'create' => '/new',\n                'post' => '',\n                default => '/' . $this->pathSegmentNameGenerator->getSegmentName($shortName ?? '', false),\n            };\n\n            return sprintf('%s%s', $rootPath, $path);\n        }\n\n        return $this->decorated->createRoutePath($operation, $rootPath);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Factory/RoutePath/DeleteOperationRoutePathFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath;\n\nuse Sylius\\Resource\\Metadata\\Api\\ApiOperationInterface;\nuse Sylius\\Resource\\Metadata\\DeleteOperationInterface;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Operation\\PathSegmentNameGeneratorInterface;\n\n/**\n * @experimental\n */\nfinal class DeleteOperationRoutePathFactory implements OperationRoutePathFactoryInterface\n{\n    public function __construct(\n        private OperationRoutePathFactoryInterface $decorated,\n        private PathSegmentNameGeneratorInterface $pathSegmentNameGenerator,\n    ) {\n    }\n\n    public function createRoutePath(HttpOperation $operation, string $rootPath): string\n    {\n        $shortName = $operation->getShortName();\n        $identifier = $operation->getResource()?->getIdentifier() ?? 'id';\n\n        if ($operation instanceof DeleteOperationInterface) {\n            $path = $operation instanceof ApiOperationInterface && 'delete' === $shortName\n                ? ''\n                : '/' . $this->pathSegmentNameGenerator->getSegmentName($shortName ?? '', false)\n            ;\n\n            return sprintf('%s/{%s}%s', $rootPath, $identifier, $path);\n        }\n\n        return $this->decorated->createRoutePath($operation, $rootPath);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Factory/RoutePath/OperationRoutePathFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath;\n\nuse Sylius\\Resource\\Metadata\\Operation;\n\n/**\n * @experimental\n */\nfinal class OperationRoutePathFactory implements OperationRoutePathFactoryInterface\n{\n    public function createRoutePath(Operation $operation, string $rootPath): string\n    {\n        throw new \\InvalidArgumentException(sprintf('Impossible to get a default route path for operation \"%s\". Please define a path.', $operation->getName() ?? ''));\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Factory/RoutePath/OperationRoutePathFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath;\n\nuse Sylius\\Resource\\Metadata\\HttpOperation;\n\n/**\n * @experimental\n */\ninterface OperationRoutePathFactoryInterface\n{\n    public function createRoutePath(HttpOperation $operation, string $rootPath): string;\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Factory/RoutePath/ShowOperationRoutePathFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath;\n\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Operation\\PathSegmentNameGeneratorInterface;\nuse Sylius\\Resource\\Metadata\\ShowOperationInterface;\n\n/**\n * @experimental\n */\nfinal class ShowOperationRoutePathFactory implements OperationRoutePathFactoryInterface\n{\n    public function __construct(\n        private OperationRoutePathFactoryInterface $decorated,\n        private PathSegmentNameGeneratorInterface $pathSegmentNameGenerator,\n    ) {\n    }\n\n    public function createRoutePath(HttpOperation $operation, string $rootPath): string\n    {\n        $shortName = $operation->getShortName();\n        $identifier = $operation->getResource()?->getIdentifier() ?? 'id';\n\n        if ($operation instanceof ShowOperationInterface) {\n            $path = match ($shortName) {\n                'show', 'get' => '',\n                default => '/' . $this->pathSegmentNameGenerator->getSegmentName($shortName ?? '', false),\n            };\n\n            return sprintf('%s/{%s}%s', $rootPath, $identifier, $path);\n        }\n\n        return $this->decorated->createRoutePath($operation, $rootPath);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Factory/RoutePath/UpdateOperationRoutePathFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath;\n\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Operation\\PathSegmentNameGeneratorInterface;\nuse Sylius\\Resource\\Metadata\\UpdateOperationInterface;\n\n/**\n * @experimental\n */\nfinal class UpdateOperationRoutePathFactory implements OperationRoutePathFactoryInterface\n{\n    public function __construct(\n        private OperationRoutePathFactoryInterface $decorated,\n        private PathSegmentNameGeneratorInterface $pathSegmentNameGenerator,\n    ) {\n    }\n\n    public function createRoutePath(HttpOperation $operation, string $rootPath): string\n    {\n        $shortName = $operation->getShortName();\n        $identifier = $operation->getResource()?->getIdentifier() ?? 'id';\n\n        if ($operation instanceof UpdateOperationInterface) {\n            $path = match ($shortName) {\n                'update' => '/edit',\n                'put', 'patch' => '',\n                default => '/' . $this->pathSegmentNameGenerator->getSegmentName($shortName ?? '', false),\n            };\n\n            return sprintf('%s/{%s}%s', $rootPath, $identifier, $path);\n        }\n\n        return $this->decorated->createRoutePath($operation, $rootPath);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/Loader/ResourceLoader.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing\\Loader;\n\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceClassListFactoryInterface;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\Resource\\ResourceRouteCollectionFactoryInterface;\nuse Symfony\\Bundle\\FrameworkBundle\\Routing\\RouteLoaderInterface;\nuse Symfony\\Component\\Routing\\RouteCollection;\n\n/**\n * @experimental\n */\nfinal class ResourceLoader implements RouteLoaderInterface\n{\n    public function __construct(\n        private readonly ResourceClassListFactoryInterface $resourceClassListFactory,\n        private readonly ResourceRouteCollectionFactoryInterface $resourceRouteCollectionFactory,\n    ) {\n    }\n\n    public function __invoke(): RouteCollection\n    {\n        $routeCollection = new RouteCollection();\n        $resourceClasses = $this->resourceClassListFactory->create();\n\n        /** @var class-string $class */\n        foreach ($resourceClasses as $class) {\n            $routeCollection->addCollection($this->resourceRouteCollectionFactory->createRouteCollectionForClass($class));\n        }\n\n        return $routeCollection;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/RedirectHandler.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing;\n\nuse Sylius\\Bundle\\GridBundle\\Storage\\FilterStorageInterface;\nuse Sylius\\Resource\\Exception\\InvalidArgumentException;\nuse Sylius\\Resource\\Metadata\\BulkOperationInterface;\nuse Sylius\\Resource\\Metadata\\DeleteOperationInterface;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\ArgumentParserInterface;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RouteName\\OperationRouteNameFactoryInterface;\nuse Symfony\\Component\\HttpFoundation\\RedirectResponse;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\PropertyAccess\\PropertyAccess;\nuse Symfony\\Component\\Routing\\RouterInterface;\n\n/**\n * @experimental\n */\nfinal class RedirectHandler implements RedirectHandlerInterface\n{\n    public function __construct(\n        private RouterInterface $router,\n        private ArgumentParserInterface $argumentParser,\n        private OperationRouteNameFactoryInterface $operationRouteNameFactory,\n        private ?FilterStorageInterface $filterStorage = null,\n    ) {\n    }\n\n    public function redirectToResource(mixed $data, HttpOperation $operation, Request $request): RedirectResponse\n    {\n        if (self::REFERER === $operation->getRedirectTo()) {\n            /** @var string|null $referer */\n            $referer = $request->headers->get('referer');\n\n            if (null !== $referer && $this->isValidReferer($referer, $request)) {\n                return new RedirectResponse($referer);\n            }\n        }\n\n        $route = $operation->getRedirectToRoute();\n\n        if (null === $route) {\n            throw new \\RuntimeException(sprintf('Operation \"%s\" has no redirection route, but it should.', $operation->getName() ?? ''));\n        }\n\n        $parameters = $this->getRouteArguments($data, $operation);\n\n        return $this->redirectToRoute($data, $route, $parameters);\n    }\n\n    public function redirectToOperation(mixed $data, HttpOperation $operation, Request $request, string $newOperation): RedirectResponse\n    {\n        $route = $this->operationRouteNameFactory->createRouteName($operation, $newOperation);\n\n        $parameters = $this->getRouteArguments($data, $operation);\n\n        return $this->redirectToRoute($data, $route, $parameters);\n    }\n\n    public function redirectToRoute(mixed $data, string $route, array $parameters = []): RedirectResponse\n    {\n        if (\\str_ends_with($route, '_index') && [] === $parameters) {\n            $parameters = $this->filterStorage?->all() ?? [];\n        }\n\n        return new RedirectResponse($this->router->generate($route, $parameters));\n    }\n\n    private function getRouteArguments(mixed $data, HttpOperation $operation): array\n    {\n        $resource = $operation->getResource();\n\n        if (null === $resource) {\n            throw new \\RuntimeException(sprintf('Operation \"%s\" has no resource, but it should.', $operation->getName() ?? ''));\n        }\n\n        $redirectArguments = $operation->getRedirectArguments() ?? [];\n\n        if (\n            [] === $redirectArguments &&\n            !$operation instanceof DeleteOperationInterface &&\n            !$operation instanceof BulkOperationInterface\n        ) {\n            $identifier = $resource->getIdentifier() ?? 'id';\n\n            $redirectArguments[$identifier] = 'resource.' . $identifier;\n        }\n\n        return $this->parseResourceValues($resource, $redirectArguments, $data);\n    }\n\n    private function parseResourceValues(ResourceMetadata $resource, array $parameters, mixed $data): array\n    {\n        $accessor = PropertyAccess::createPropertyAccessor();\n\n        foreach ($parameters as $key => $value) {\n            if (\\is_array($value)) {\n                $parameters[$key] = $this->parseResourceValues($resource, $value, $data);\n\n                continue;\n            }\n\n            if (!\\is_scalar($value)) {\n                throw new InvalidArgumentException(sprintf('Parameter \"%s\" should be a scalar or an array.', $key));\n            }\n\n            if (\\is_string($value) && str_starts_with($value, 'resource.')) {\n                $propertyPath = substr($value, 9);\n\n                if (\\is_object($data) && $accessor->isReadable($data, $propertyPath)) {\n                    $parameters[$key] = $accessor->getValue($data, $propertyPath);\n\n                    continue;\n                }\n            }\n\n            $variables = ['resource' => $data];\n            $resourceName = $resource->getName();\n\n            if (null !== $resourceName) {\n                $variables[$resourceName] = $data;\n            }\n\n            $parameters[$key] = \\is_string($value) ? $this->parseStringValue($value, $variables) : $value;\n        }\n\n        return $parameters;\n    }\n\n    /**\n     * @param array<string, mixed> $variables\n     */\n    private function parseStringValue(string $value, array $variables): mixed\n    {\n        if (!str_starts_with($value, '@=')) {\n            $value = '@=' . $value;\n            trigger_deprecation('sylius/resource-bundle', '1.14', 'You passed \"%s\" as a string value in your redirect arguments. If this is a value that needs to be parsed using the expression language, please prefix your string with \"@=\". In your case, use \"@=%s\".\"', $value, $value);\n        }\n\n        // Not reachable as long as the BC layer above is there\n        if (!str_starts_with($value, '@=')) {\n            return $value;\n        }\n\n        $value = substr($value, 2);\n\n        return $this->argumentParser->parseExpression($value, $variables);\n    }\n\n    private function isValidReferer(string $referer, Request $request): bool\n    {\n        $parsed = parse_url($referer);\n        if ($parsed === false) {\n            return false;\n        }\n\n        // Relative URL → OK\n        if (!isset($parsed['host'])) {\n            return true;\n        }\n\n        // Same host only\n        return $parsed['host'] === $request->getHost();\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Routing/RedirectHandlerInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Routing;\n\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Symfony\\Component\\HttpFoundation\\RedirectResponse;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\n/**\n * @experimental\n */\ninterface RedirectHandlerInterface\n{\n    public const REFERER = 'referer';\n\n    public function redirectToResource(mixed $data, HttpOperation $operation, Request $request): RedirectResponse;\n\n    public function redirectToOperation(mixed $data, HttpOperation $operation, Request $request, string $newOperation): RedirectResponse;\n\n    public function redirectToRoute(mixed $data, string $route, array $parameters = []): RedirectResponse;\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Security/OperationAccessChecker.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Security;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\OperationAccessCheckerInterface;\nuse Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage;\nuse Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationTrustResolverInterface;\nuse Symfony\\Component\\Security\\Core\\Authentication\\Token\\NullToken;\nuse Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorageInterface;\nuse Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface;\nuse Symfony\\Component\\Security\\Core\\Authorization\\AuthorizationCheckerInterface;\nuse Symfony\\Component\\Security\\Core\\Role\\RoleHierarchyInterface;\n\nfinal class OperationAccessChecker implements OperationAccessCheckerInterface\n{\n    public function __construct(\n        private readonly ?ExpressionLanguage $expressionLanguage = null,\n        private readonly ?AuthenticationTrustResolverInterface $authenticationTrustResolver = null,\n        private readonly ?RoleHierarchyInterface $roleHierarchy = null,\n        private readonly ?TokenStorageInterface $tokenStorage = null,\n        private readonly ?AuthorizationCheckerInterface $authorizationChecker = null,\n    ) {\n    }\n\n    public function isGranted(Operation $operation, Context $context, array $extraVariables = []): bool\n    {\n        if (null === $this->tokenStorage || null === $this->authenticationTrustResolver) {\n            throw new \\LogicException('The \"symfony/security\" library must be installed to use the \"security\" attribute.');\n        }\n\n        if (null === $this->expressionLanguage) {\n            throw new \\LogicException('The \"symfony/expression-language\" library must be installed to use the \"security\" attribute.');\n        }\n\n        $expression = $operation->getSecurity();\n        if (null === $expression) {\n            return true;\n        }\n\n        $token = $this->tokenStorage->getToken();\n        if (null === $token) {\n            $token = new NullToken();\n        }\n\n        $variables = array_merge($extraVariables, $this->getVariables($token));\n\n        return (bool) $this->expressionLanguage->evaluate($expression, $variables);\n    }\n\n    /**\n     * @see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php\n     */\n    private function getVariables(TokenInterface $token): array\n    {\n        $roleNames = $token->getRoleNames();\n\n        if (null !== $this->roleHierarchy) {\n            $roleNames = $this->roleHierarchy->getReachableRoleNames($roleNames);\n        }\n\n        return [\n            'token' => $token,\n            'user' => $token->getUser(),\n            'roles' => $roleNames,\n            'trust_resolver' => $this->authenticationTrustResolver,\n            'auth_checker' => $this->authorizationChecker, // needed for the is_granted expression function\n        ];\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Serializer/State/DeserializeProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Serializer\\State;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\DeleteOperationInterface;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Symfony\\Component\\Serializer\\Normalizer\\AbstractNormalizer;\nuse Symfony\\Component\\Serializer\\SerializerInterface;\n\n/**\n * @experimental\n */\nfinal class DeserializeProvider implements ProviderInterface\n{\n    public function __construct(\n        private ProviderInterface $decorated,\n        private ?SerializerInterface $serializer,\n    ) {\n    }\n\n    public function provide(Operation $operation, Context $context): object|array|null\n    {\n        $data = $this->decorated->provide($operation, $context);\n\n        if (!$operation instanceof HttpOperation) {\n            return $data;\n        }\n\n        $request = $context->get(RequestOption::class)?->request() ?? null;\n        if (!$request) {\n            return $data;\n        }\n\n        if (!($operation->canDeserialize() ?? true)) {\n            return $data;\n        }\n\n        $resourceClass = $operation->getResource()?->getClass();\n        /** @var string $format */\n        $format = $request->getRequestFormat();\n\n        if (\n            null === $resourceClass ||\n            'html' === $format ||\n            $request->isMethodSafe() ||\n            $operation instanceof DeleteOperationInterface\n        ) {\n            return $data;\n        }\n\n        if (null === $this->serializer) {\n            throw new \\LogicException(sprintf('You can not use the \"%s\" format if the Serializer is not available. Try running \"composer require symfony/serializer\".', $format));\n        }\n\n        $denormalizationContext = $operation->getDenormalizationContext() ?? [];\n        $method = $request->getMethod();\n\n        if (null !== $data && in_array($method, ['POST', 'PATCH', 'PUT'])) {\n            $denormalizationContext[AbstractNormalizer::OBJECT_TO_POPULATE] = $data;\n        }\n\n        return $this->serializer->deserialize($request->getContent(), $resourceClass, $format, $denormalizationContext);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Serializer/State/SerializeProcessor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Serializer\\State;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Symfony\\Component\\Serializer\\SerializerInterface;\n\n/**\n * Serializes the data to the requested format.\n *\n * @experimental\n */\nfinal class SerializeProcessor implements ProcessorInterface\n{\n    public function __construct(\n        private ProcessorInterface $processor,\n        private ?SerializerInterface $serializer,\n    ) {\n    }\n\n    public function process(mixed $data, Operation $operation, Context $context): mixed\n    {\n        $request = $context->get(RequestOption::class)?->request();\n\n        if (null === $request) {\n            return $this->processor->process($data, $operation, $context);\n        }\n\n        /** @var string $format */\n        $format = $request->getRequestFormat();\n\n        if (\n            'html' === $format ||\n            !($operation->canSerialize() ?? true)\n        ) {\n            return $this->processor->process($data, $operation, $context);\n        }\n\n        if (null === $this->serializer) {\n            throw new \\LogicException(sprintf('You can not use the \"%s\" format if the Serializer is not available. Try running \"composer require symfony/serializer\".', $format));\n        }\n\n        $serialized = $this->serializer->serialize($data, $format, $operation->getNormalizationContext() ?? []);\n\n        return $this->processor->process($serialized, $operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Session/Flash/FlashHelper.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Session\\Flash;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Humanizer\\StringHumanizer;\nuse Sylius\\Resource\\Metadata\\BulkOperationInterface;\nuse Sylius\\Resource\\Metadata\\CreateOperationInterface;\nuse Sylius\\Resource\\Metadata\\DeleteOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\UpdateOperationInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\GenericEvent;\nuse Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface;\nuse Symfony\\Component\\Translation\\TranslatorBagInterface;\nuse Symfony\\Contracts\\Translation\\TranslatorInterface;\nuse Webmozart\\Assert\\Assert;\n\n/**\n * @experimental\n */\nfinal class FlashHelper implements FlashHelperInterface\n{\n    public function __construct(\n        private TranslatorInterface $translator,\n    ) {\n    }\n\n    public function addSuccessFlash(Operation $operation, Context $context, ?string $message = null): void\n    {\n        $this->addFlashFromOperation($operation, $context, 'success', $message);\n    }\n\n    public function addErrorFlash(Operation $operation, Context $context, ?string $message = null): void\n    {\n        $this->addFlashFromOperation($operation, $context, 'error', $message);\n    }\n\n    public function addFlashFromEvent(GenericEvent $event, Context $context): void\n    {\n        $message = $this->buildEventMessage($event);\n\n        $this->addFlash($message, $event->getMessageType(), $context);\n    }\n\n    private function addFlashFromOperation(Operation $operation, Context $context, string $type, ?string $message): void\n    {\n        $message ??= $this->buildOperationMessage($operation, $type);\n\n        $this->addFlash($message, $type, $context);\n    }\n\n    private function buildEventMessage(GenericEvent $event): string\n    {\n        $message = $event->getMessage();\n        $parameters = $event->getMessageParameters();\n\n        if (!$this->translator instanceof TranslatorBagInterface) {\n            return $this->translator->trans($message, $parameters, 'flashes');\n        }\n\n        if ($this->translator->getCatalogue()->has($message, 'flashes')) {\n            return $this->translator->trans($message, $parameters, 'flashes');\n        }\n\n        return $message;\n    }\n\n    private function buildOperationMessage(Operation $operation, string $type): string\n    {\n        $resource = $operation->getResource();\n        Assert::notNull($resource);\n\n        $translationKeys = iterator_to_array($this->getTranslationKeys($resource, $operation, $type));\n\n        /** @var string $firstTranslationKey */\n        $firstTranslationKey = reset($translationKeys);\n\n        $parameters = $this->getTranslationParameters($operation);\n        $notificationMessage = $operation->getNotificationMessage();\n\n        // It's defined by the user, it should be used.\n        if ('success' === $type && null !== $notificationMessage) {\n            // Do not use the translator if not needed\n            if ($this->translator instanceof TranslatorBagInterface && !$this->translator->getCatalogue()->has($notificationMessage, 'flashes')) {\n                return $notificationMessage;\n            }\n\n            return $this->translator->trans($notificationMessage, $parameters, 'flashes');\n        }\n\n        if (!$this->translator instanceof TranslatorBagInterface) {\n            return $this->translator->trans($firstTranslationKey, $parameters, 'flashes');\n        }\n\n        foreach ($translationKeys as $translationKey) {\n            if ($this->translator->getCatalogue()->has($translationKey, 'flashes')) {\n                return $this->translator->trans($translationKey, $parameters, 'flashes');\n            }\n        }\n\n        // Last fallback, use the first translation key.\n        return $this->translator->trans($firstTranslationKey, $parameters, 'flashes');\n    }\n\n    private function addFlash(string $message, string $type, Context $context): void\n    {\n        $request = $context->get(RequestOption::class)?->request();\n\n        if (null === $request) {\n            return;\n        }\n\n        /** @var FlashBagInterface $flashBag */\n        $flashBag = $request->getSession()->getBag('flashes');\n\n        $flashBag->add($type, $message);\n    }\n\n    private function getTranslationParameters(Operation $operation): array\n    {\n        $resource = $operation->getResource();\n\n        if (null === $resource) {\n            return [];\n        }\n\n        $resourceName = $this->translateResource($resource);\n        $humanizedName = $resourceName ?? ucfirst(StringHumanizer::humanize($resource->getName() ?? ''));\n\n        if ($operation instanceof BulkOperationInterface) {\n            $resourcePluralName = $this->translateResource($resource, true);\n            $humanizedPluralName = $resourcePluralName ?? ucfirst(StringHumanizer::humanize($resource->getPluralName() ?? ''));\n\n            return [\n                '%resource%' => $humanizedName,\n                '%resources%' => $humanizedPluralName,\n            ];\n        }\n\n        return ['%resource%' => $humanizedName];\n    }\n\n    private function translateResource(ResourceMetadata $resource, bool $plurialize = false): ?string\n    {\n        $translationKey = sprintf(\n            '%s.ui.%s',\n            $resource->getApplicationName() ?? '',\n            $plurialize ? ($resource->getPluralName() ?? '') : ($resource->getName() ?? ''),\n        );\n\n        if ($this->translator instanceof TranslatorBagInterface && $this->translator->getCatalogue()->has($translationKey)) {\n            return $this->translator->trans($translationKey);\n        }\n\n        return null;\n    }\n\n    /**\n     * @return iterable<string>\n     */\n    private function getTranslationKeys(ResourceMetadata $resource, Operation $operation, string $type): iterable\n    {\n        $applicationName = $resource->getApplicationName() ?? '';\n        $resourceName = $resource->getName() ?? '';\n        $operationShortName = $operation->getShortName() ?? '';\n\n        $translationKeySuffix = 'error' === $type ? '_error' : '';\n\n        /**\n         * Examples:\n         * app.product.my_operation\n         * app.product.my_operation_error\n         */\n        yield sprintf(\n            '%s.%s.%s%s',\n            $applicationName,\n            $resourceName,\n            $operationShortName,\n            $translationKeySuffix,\n        );\n\n        $genericOperationType = $this->getGenericOperationType($operation);\n\n        /**\n         * Examples:\n         * app.product.delete\n         * app.product.delete_error\n         */\n        if ($genericOperationType !== $operationShortName) {\n            yield sprintf(\n                '%s.%s.%s%s',\n                $applicationName,\n                $resourceName,\n                $genericOperationType,\n                $translationKeySuffix,\n            );\n        }\n\n        /**\n         * Examples:\n         * sylius.resource.my_operation\n         * sylius.resource.my_operation_error\n         */\n        yield sprintf(\n            'sylius.resource.%s%s',\n            $operationShortName,\n            $translationKeySuffix,\n        );\n\n        /**\n         * Examples:\n         * sylius.resource.delete\n         * sylius.resource.delete_error\n         */\n        if ($genericOperationType !== $operationShortName) {\n            yield sprintf(\n                'sylius.resource.%s%s',\n                $genericOperationType,\n                $translationKeySuffix,\n            );\n        }\n    }\n\n    private function getGenericOperationType(Operation $operation): ?string\n    {\n        if ($operation instanceof DeleteOperationInterface) {\n            return 'delete';\n        }\n\n        if ($operation instanceof CreateOperationInterface) {\n            return 'create';\n        }\n\n        if ($operation instanceof UpdateOperationInterface) {\n            return 'update';\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Session/Flash/FlashHelperInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Session\\Flash;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\GenericEvent;\n\n/**\n * @experimental\n */\ninterface FlashHelperInterface\n{\n    public function addSuccessFlash(Operation $operation, Context $context, ?string $message = null): void;\n\n    public function addErrorFlash(Operation $operation, Context $context, ?string $message = null): void;\n\n    public function addFlashFromEvent(GenericEvent $event, Context $context): void;\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Validator/EventListener/ValidationExceptionListener.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Validator\\EventListener;\n\nuse Sylius\\Resource\\Symfony\\Validator\\Exception\\ConstraintViolationListAwareExceptionInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent;\nuse Symfony\\Component\\Serializer\\SerializerInterface;\n\n/**\n * Handles validation errors.\n *\n * @experimental\n *\n * @final\n */\nclass ValidationExceptionListener\n{\n    public function __construct(private ?SerializerInterface $serializer = null)\n    {\n    }\n\n    /**\n     * Returns a list of violations normalized in the Hydra format.\n     */\n    public function onKernelException(ExceptionEvent $event): void\n    {\n        $exception = $event->getThrowable();\n\n        if (!$exception instanceof ConstraintViolationListAwareExceptionInterface) {\n            return;\n        }\n\n        if (null === $this->serializer) {\n            throw new \\LogicException('The Symfony Serializer is not available. Try running \"composer require symfony/serializer\".');\n        }\n\n        $request = $event->getRequest();\n\n        /** @var string $format */\n        $format = $request->getRequestFormat();\n\n        /** @var string $mimeType */\n        $mimeType = $request->getMimeType($format);\n\n        $event->setResponse(new Response(\n            $this->serializer->serialize($exception->getConstraintViolationList(), $format),\n            Response::HTTP_UNPROCESSABLE_ENTITY,\n            [\n                'Content-Type' => sprintf('%s; charset=utf-8', $mimeType),\n                'X-Content-Type-Options' => 'nosniff',\n                'X-Frame-Options' => 'deny',\n            ],\n        ));\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Validator/Exception/ConstraintViolationListAwareExceptionInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Validator\\Exception;\n\nuse Symfony\\Component\\Validator\\ConstraintViolationListInterface;\n\n/**\n * An exception which has a constraint violation list.\n *\n * @experimental\n */\ninterface ConstraintViolationListAwareExceptionInterface\n{\n    /**\n     * Gets constraint violations related to this exception.\n     */\n    public function getConstraintViolationList(): ConstraintViolationListInterface;\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Validator/Exception/ValidationException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Validator\\Exception;\n\nuse Symfony\\Component\\Validator\\ConstraintViolationListInterface;\n\n/**\n * Thrown when a validation error occurs.\n *\n * @experimental\n */\nfinal class ValidationException extends \\RuntimeException implements ConstraintViolationListAwareExceptionInterface\n{\n    public function __construct(private ConstraintViolationListInterface $constraintViolationList, string $message = '', int $code = 0, ?\\Exception $previous = null)\n    {\n        parent::__construct($message ?: $this->__toString(), $code, $previous);\n    }\n\n    public function getConstraintViolationList(): ConstraintViolationListInterface\n    {\n        return $this->constraintViolationList;\n    }\n\n    public function __toString(): string\n    {\n        $message = '';\n        foreach ($this->constraintViolationList as $violation) {\n            if ('' !== $message) {\n                $message .= \"\\n\";\n            }\n            if ($propertyPath = $violation->getPropertyPath()) {\n                $message .= \"$propertyPath: \";\n            }\n\n            $message .= $violation->getMessage();\n        }\n\n        return $message;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Validator/State/ValidateProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Validator\\State;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\CreateOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\UpdateOperationInterface;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Sylius\\Resource\\Symfony\\Validator\\Exception\\ValidationException;\nuse Symfony\\Component\\Form\\FormInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Validator\\Validator\\ValidatorInterface;\n\n/**\n * @experimental\n */\nfinal class ValidateProvider implements ProviderInterface\n{\n    public function __construct(\n        private ProviderInterface $decorated,\n        private ValidatorInterface $validator,\n    ) {\n    }\n\n    public function provide(Operation $operation, Context $context): object|array|null\n    {\n        $data = $this->decorated->provide($operation, $context);\n\n        $request = $context->get(RequestOption::class)?->request();\n\n        /** @var FormInterface|null $form */\n        $form = $request?->attributes->get('form');\n\n        /** @var string $format */\n        $format = $request?->getRequestFormat();\n\n        if (\n            $data instanceof Response ||\n            !($operation instanceof CreateOperationInterface || $operation instanceof UpdateOperationInterface) ||\n            !($operation->canValidate() ?? true)\n        ) {\n            return $data;\n        }\n\n        if ('html' !== $format) {\n            $validationGroups = $operation->getValidationContext()['groups'] ?? null;\n            $violations = $this->validator->validate(value: $data, groups: $validationGroups);\n            if (0 !== \\count($violations)) {\n                throw new ValidationException($violations);\n            }\n\n            return $data;\n        }\n\n        if (null === $form || null === $request) {\n            return $data;\n        }\n\n        if (\n            !$request->isMethodSafe() &&\n            $form->isSubmitted() &&\n            $form->isValid()\n        ) {\n            $request->attributes->set('is_valid', true);\n            /** @var array|object|null $data */\n            $data = $form->getData();\n\n            return $data;\n        }\n\n        $request->attributes->set('is_valid', false);\n\n        return $data;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Symfony/Workflow/OperationStateMachine.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Symfony\\Workflow;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\StateMachineAwareOperationInterface;\nuse Sylius\\Resource\\StateMachine\\OperationStateMachineInterface;\nuse Symfony\\Component\\Workflow\\Registry;\nuse Webmozart\\Assert\\Assert;\n\n/**\n * @experimental\n */\nfinal class OperationStateMachine implements OperationStateMachineInterface\n{\n    public function __construct(private ?Registry $registry = null)\n    {\n    }\n\n    public function can(object $data, Operation $operation, Context $context): bool\n    {\n        Assert::isInstanceOf($operation, StateMachineAwareOperationInterface::class);\n        $transition = $operation->getStateMachineTransition() ?? null;\n\n        Assert::notNull($transition, sprintf('No State machine transition was found on operation \"%s\".', $operation->getName() ?? ''));\n\n        $graph = $operation->getStateMachineGraph() ?? null;\n\n        return $this->getRegistry()->get($data, $graph)->can($data, $transition);\n    }\n\n    public function apply(object $data, Operation $operation, Context $context): void\n    {\n        Assert::isInstanceOf($operation, StateMachineAwareOperationInterface::class);\n        $transition = $operation->getStateMachineTransition() ?? null;\n\n        Assert::notNull($transition, sprintf('No State machine transition was found on operation \"%s\".', $operation->getName() ?? ''));\n\n        $graph = $operation->getStateMachineGraph() ?? null;\n\n        $this->getRegistry()->get($data, $graph)->apply($data, $transition);\n    }\n\n    private function getRegistry(): Registry\n    {\n        if (null === $this->registry) {\n            throw new \\LogicException('You can not use the \"state-machine\" if Symfony workflow is not available. Try running \"composer require symfony/workflow\".');\n        }\n\n        return $this->registry;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Translation/Provider/ImmutableTranslationLocaleProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Translation\\Provider;\n\nfinal class ImmutableTranslationLocaleProvider implements TranslationLocaleProviderInterface\n{\n    public function __construct(\n        private array $definedLocalesCodes,\n        private string $defaultLocaleCode,\n    ) {\n    }\n\n    public function getDefinedLocalesCodes(): array\n    {\n        return $this->definedLocalesCodes;\n    }\n\n    public function getDefaultLocaleCode(): string\n    {\n        return $this->defaultLocaleCode;\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Translation\\Provider\\ImmutableTranslationLocaleProvider::class, false)) {\n    class_alias(ImmutableTranslationLocaleProvider::class, \\Sylius\\Component\\Resource\\Translation\\Provider\\ImmutableTranslationLocaleProvider::class);\n}\n"
  },
  {
    "path": "src/Component/src/Translation/Provider/TranslationLocaleProviderInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Translation\\Provider;\n\ninterface TranslationLocaleProviderInterface\n{\n    /** @return string[] */\n    public function getDefinedLocalesCodes(): array;\n\n    public function getDefaultLocaleCode(): string;\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface::class, false)) {\n    class_alias(TranslationLocaleProviderInterface::class, \\Sylius\\Component\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Translation/TranslatableEntityLocaleAssigner.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Translation;\n\nuse Sylius\\Resource\\Model\\TranslatableInterface;\nuse Sylius\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface;\n\nfinal class TranslatableEntityLocaleAssigner implements TranslatableEntityLocaleAssignerInterface\n{\n    public function __construct(private TranslationLocaleProviderInterface $translationLocaleProvider)\n    {\n    }\n\n    public function assignLocale(TranslatableInterface $translatableEntity): void\n    {\n        $localeCode = $this->translationLocaleProvider->getDefaultLocaleCode();\n\n        $translatableEntity->setCurrentLocale($localeCode);\n        $translatableEntity->setFallbackLocale($localeCode);\n    }\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Translation\\TranslatableEntityLocaleAssigner::class, false)) {\n    class_alias(TranslatableEntityLocaleAssigner::class, \\Sylius\\Component\\Resource\\Translation\\TranslatableEntityLocaleAssigner::class);\n}\n"
  },
  {
    "path": "src/Component/src/Translation/TranslatableEntityLocaleAssignerInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Translation;\n\nuse Sylius\\Resource\\Model\\TranslatableInterface;\n\ninterface TranslatableEntityLocaleAssignerInterface\n{\n    public function assignLocale(TranslatableInterface $translatableEntity): void;\n}\n\nif (!class_exists(\\Sylius\\Component\\Resource\\Translation\\TranslatableEntityLocaleAssignerInterface::class, false)) {\n    class_alias(TranslatableEntityLocaleAssignerInterface::class, \\Sylius\\Component\\Resource\\Translation\\TranslatableEntityLocaleAssignerInterface::class);\n}\n"
  },
  {
    "path": "src/Component/src/Twig/Context/Factory/ContextFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Twig\\Context\\Factory;\n\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Webmozart\\Assert\\Assert;\n\n/**\n * @experimental\n */\nfinal class ContextFactory implements ContextFactoryInterface\n{\n    public function __construct(private ContainerInterface $locator)\n    {\n    }\n\n    public function create(mixed $data, Operation $operation, Context $context): array\n    {\n        if (\n            !$operation instanceof HttpOperation ||\n            null === $twigContextFactory = $operation->getTwigContextFactory()\n        ) {\n            return [];\n        }\n\n        if (\\is_callable($twigContextFactory)) {\n            return $twigContextFactory($data, $operation, $context);\n        }\n\n        if (!$this->locator->has($twigContextFactory)) {\n            throw new \\RuntimeException(sprintf('Twig context factory \"%s\" not found on operation \"%s\"', $twigContextFactory, $operation->getName() ?? ''));\n        }\n\n        /** @var ContextFactoryInterface $twigContextFactoryInstance */\n        $twigContextFactoryInstance = $this->locator->get($twigContextFactory);\n        Assert::isInstanceOf($twigContextFactoryInstance, ContextFactoryInterface::class);\n\n        return $twigContextFactoryInstance->create($data, $operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Twig/Context/Factory/ContextFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Twig\\Context\\Factory;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\n\n/**\n * @experimental\n */\ninterface ContextFactoryInterface\n{\n    public function create(mixed $data, Operation $operation, Context $context): array;\n}\n"
  },
  {
    "path": "src/Component/src/Twig/Context/Factory/DefaultContextFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Twig\\Context\\Factory;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\CollectionOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\n\n/**\n * @experimental\n */\nfinal class DefaultContextFactory implements ContextFactoryInterface\n{\n    public function create(mixed $data, Operation $operation, Context $context): array\n    {\n        $twigContext = [\n            'operation' => $operation,\n            'resource_metadata' => $operation->getResource(),\n        ];\n\n        if ($operation instanceof CollectionOperationInterface) {\n            $twigContext['resources'] = $data;\n            $pluralName = $operation->getResource()?->getPluralName();\n\n            if (null !== $pluralName) {\n                $twigContext[$pluralName] = $data;\n            }\n        } else {\n            $twigContext['resource'] = $data;\n            $name = $operation->getResource()?->getName();\n\n            if (null !== $name) {\n                $twigContext[$name] = $data;\n            }\n        }\n\n        return $twigContext;\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Twig/Context/Factory/RequestContextFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Twig\\Context\\Factory;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Symfony\\Component\\Form\\FormInterface;\n\n/**\n * @experimental\n */\nfinal class RequestContextFactory implements ContextFactoryInterface\n{\n    public function __construct(private ContextFactoryInterface $decorated)\n    {\n    }\n\n    public function create(mixed $data, Operation $operation, Context $context): array\n    {\n        $twigContext = $this->decorated->create($data, $operation, $context);\n\n        $request = $context->get(RequestOption::class)?->request();\n\n        if (null === $request) {\n            return $twigContext;\n        }\n\n        /** @var FormInterface|null $form */\n        $form = $request->attributes->get('form');\n\n        if (null === $form) {\n            return $twigContext;\n        }\n\n        return array_merge($twigContext, ['form' => $form->createView()]);\n    }\n}\n"
  },
  {
    "path": "src/Component/src/Winzou/StateMachine/OperationStateMachine.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Winzou\\StateMachine;\n\nuse SM\\Factory\\Factory;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\StateMachineAwareOperationInterface;\nuse Sylius\\Resource\\StateMachine\\OperationStateMachineInterface;\nuse Webmozart\\Assert\\Assert;\n\n/**\n * @experimental\n */\nfinal class OperationStateMachine implements OperationStateMachineInterface\n{\n    public function __construct(private ?Factory $factory = null)\n    {\n    }\n\n    public function can(object $data, Operation $operation, Context $context): bool\n    {\n        Assert::isInstanceOf($operation, StateMachineAwareOperationInterface::class);\n        $transition = $operation->getStateMachineTransition() ?? null;\n\n        Assert::notNull($transition, sprintf('No State machine transition was found on operation \"%s\".', $operation->getName() ?? ''));\n\n        $graph = $operation->getStateMachineGraph() ?? 'default';\n\n        return $this->getFactory()->get($data, $graph)->can($transition);\n    }\n\n    public function apply(object $data, Operation $operation, Context $context): void\n    {\n        Assert::isInstanceOf($operation, StateMachineAwareOperationInterface::class);\n        $transition = $operation->getStateMachineTransition() ?? null;\n\n        Assert::notNull($transition, sprintf('No State machine transition was found on operation \"%s\".', $operation->getName() ?? ''));\n\n        $graph = $operation->getStateMachineGraph() ?? 'default';\n\n        $this->getFactory()->get($data, $graph)->apply($transition);\n    }\n\n    private function getFactory(): Factory\n    {\n        if (null === $this->factory) {\n            throw new \\LogicException('You can not use the \"state-machine\" if Winzou State Machine is not available. Try running \"composer require winzou/state-machine-bundle\".');\n        }\n\n        return $this->factory;\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Context/ContextTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Context;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyClassOne;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyClassTwo;\nuse Sylius\\Resource\\Context\\Context;\n\nfinal class ContextTest extends TestCase\n{\n    /** @test */\n    public function it_is_an_iterator(): void\n    {\n        $context = new Context();\n        $this->assertInstanceOf(\\IteratorAggregate::class, $context);\n    }\n\n    /** @test */\n    public function it_can_be_constructed_with_options(): void\n    {\n        $optionOne = new DummyClassOne();\n        $optionTwo = new DummyClassTwo();\n\n        $context = new Context($optionOne, $optionTwo);\n\n        $this->assertEquals($optionOne, $context->get(DummyClassOne::class));\n        $this->assertEquals($optionTwo, $context->get(DummyClassTwo::class));\n    }\n\n    /** @test */\n    public function it_can_be_with_options(): void\n    {\n        $optionOne = new DummyClassOne();\n        $optionTwo = new DummyClassTwo();\n\n        $context = new Context();\n        $context = $context->with($optionOne, $optionTwo);\n\n        $this->assertEquals($optionOne, $context->get(DummyClassOne::class));\n        $this->assertEquals($optionTwo, $context->get(DummyClassTwo::class));\n    }\n\n    /** @test */\n    public function it_can_be_without_options(): void\n    {\n        $optionOne = new DummyClassOne();\n        $optionTwo = new DummyClassTwo();\n\n        $context = new Context();\n        $context = $context->with($optionOne, $optionTwo);\n        $context = $context->without(DummyClassOne::class, DummyClassTwo::class);\n\n        $this->assertNull($context->get(DummyClassOne::class));\n        $this->assertNull($context->get(DummyClassTwo::class));\n    }\n\n    /** @test */\n    public function it_can_be_iterated(): void\n    {\n        $optionOne = new DummyClassOne();\n        $optionTwo = new DummyClassTwo();\n\n        $context = new Context($optionOne, $optionTwo);\n\n        $this->assertEquals($optionOne, $context->getIterator()->current());\n        $this->assertEquals(2, iterator_count($context->getIterator()));\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Context/Initiator/RequestContextInitiatorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Context\\Initiator;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Initiator\\RequestContextInitiator;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class RequestContextInitiatorTest extends TestCase\n{\n    private RequestContextInitiator $requestContextInitiator;\n\n    protected function setUp(): void\n    {\n        $this->requestContextInitiator = new RequestContextInitiator();\n    }\n\n    /** @test */\n    public function it_initializes_context(): void\n    {\n        $request = $this->createMock(Request::class);\n\n        $request->attributes = new ParameterBag(['_sylius' => ['resource_class' => 'App\\Resource']]);\n\n        $context = $this->requestContextInitiator->initializeContext($request);\n\n        $this->assertInstanceOf(Context::class, $context);\n        $this->assertEquals($request, $context->get(RequestOption::class)?->request());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Context/Option/MetadataOptionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Context\\Option;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Option\\MetadataOption;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\n\nfinal class MetadataOptionTest extends TestCase\n{\n    private MetadataInterface|MockObject $metadata;\n\n    private MetadataOption $metadataOption;\n\n    protected function setUp(): void\n    {\n        $this->metadata = $this->createMock(MetadataInterface::class);\n\n        $this->metadataOption = new MetadataOption($this->metadata);\n    }\n\n    /** @test */\n    public function it_returns_request_configuration(): void\n    {\n        $this->assertEquals($this->metadata, $this->metadataOption->metadata());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Context/Option/RequestOptionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Context\\Option;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class RequestOptionTest extends TestCase\n{\n    private Request|MockObject $request;\n\n    private RequestOption $requestOption;\n\n    protected function setUp(): void\n    {\n        $this->request = $this->createMock(Request::class);\n\n        $this->requestOption = new RequestOption($this->request);\n    }\n\n    /** @test */\n    public function it_contains_request(): void\n    {\n        $this->assertEquals($this->request, $this->requestOption->request());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Doctrine/Common/Metadata/Resource/Factory/DoctrineResourceMetadataCollectionFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Doctrine\\Common\\Metadata\\Resource\\Factory;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Doctrine\\Common\\Metadata\\Resource\\Factory\\DoctrineResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Doctrine\\Common\\State\\PersistProcessor;\nuse Sylius\\Resource\\Doctrine\\Common\\State\\RemoveProcessor;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Delete;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nfinal class DoctrineResourceMetadataCollectionFactoryTest extends TestCase\n{\n    private RegistryInterface|MockObject $resourceRegistry;\n\n    private ResourceMetadataCollectionFactoryInterface|MockObject $decorated;\n\n    private DoctrineResourceMetadataCollectionFactory $factory;\n\n    protected function setUp(): void\n    {\n        $this->resourceRegistry = $this->createMock(RegistryInterface::class);\n        $this->decorated = $this->createMock(ResourceMetadataCollectionFactoryInterface::class);\n\n        $this->factory = new DoctrineResourceMetadataCollectionFactory(\n            $this->resourceRegistry,\n            $this->decorated,\n        );\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(DoctrineResourceMetadataCollectionFactory::class, $this->factory);\n    }\n\n    public function testItAddsPersistProcessorToOperationsForResourceWithDoctrineOrmDriver(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $operation = new Create(name: 'app_dummy_create');\n        $resource = (new ResourceMetadata(alias: 'app.dummy'))\n            ->withOperations(new Operations([$operation]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection([$resource]);\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n        $this->resourceRegistry->method('get')->with('app.dummy')->willReturn($metadata);\n        $metadata->method('getDriver')->willReturn('doctrine/orm');\n\n        $result = $this->factory->create('App\\Resource');\n\n        $this->assertEquals(\n            PersistProcessor::class,\n            $result->getOperation('app.dummy', 'app_dummy_create')->getProcessor(),\n        );\n    }\n\n    public function testItAddsPersistProcessorToOperationsForResourceWithDoctrineDbalDriver(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $operation = new Create(name: 'app_dummy_create');\n        $resource = (new ResourceMetadata(alias: 'app.dummy'))\n            ->withOperations(new Operations([$operation]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection([$resource]);\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n        $this->resourceRegistry->method('get')->with('app.dummy')->willReturn($metadata);\n        $metadata->method('getDriver')->willReturn('doctrine/dbal');\n\n        $result = $this->factory->create('App\\Resource');\n\n        $this->assertEquals(\n            PersistProcessor::class,\n            $result->getOperation('app.dummy', 'app_dummy_create')->getProcessor(),\n        );\n    }\n\n    public function testItAddsRemoveProcessorToDeleteOperationsForResourceWithDoctrineDriver(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $operation = new Delete(name: 'app_dummy_delete');\n        $resource = (new ResourceMetadata(alias: 'app.dummy'))\n            ->withOperations(new Operations([$operation]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection([$resource]);\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n        $this->resourceRegistry->method('get')->with('app.dummy')->willReturn($metadata);\n        $metadata->method('getDriver')->willReturn('doctrine/orm');\n\n        $result = $this->factory->create('App\\Resource');\n\n        $this->assertEquals(\n            RemoveProcessor::class,\n            $result->getOperation('app.dummy', 'app_dummy_delete')->getProcessor(),\n        );\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Doctrine/Common/State/PersistProcessorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Doctrine\\Common\\State;\n\nuse Doctrine\\ORM\\Mapping\\ClassMetadata;\nuse Doctrine\\Persistence\\ManagerRegistry;\nuse Doctrine\\Persistence\\ObjectManager;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Doctrine\\Common\\State\\PersistProcessor;\nuse Sylius\\Resource\\Metadata\\Operation;\n\nfinal class PersistProcessorTest extends TestCase\n{\n    private ManagerRegistry|MockObject $managerRegistry;\n\n    private PersistProcessor $persistProcessor;\n\n    protected function setUp(): void\n    {\n        $this->managerRegistry = $this->createMock(ManagerRegistry::class);\n        $this->persistProcessor = new PersistProcessor($this->managerRegistry);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(PersistProcessor::class, $this->persistProcessor);\n    }\n\n    public function testItPersistsDataWhenManagerDoesNotContainTheResourceYet(): void\n    {\n        $manager = $this->createMock(ObjectManager::class);\n        $operation = $this->createMock(Operation::class);\n        $data = new \\stdClass();\n\n        $this->managerRegistry->method('getManagerForClass')->with(\\stdClass::class)->willReturn($manager);\n        $manager->method('contains')->with($data)->willReturn(false);\n\n        $manager->expects($this->once())->method('persist')->with($data);\n        $manager->expects($this->once())->method('flush');\n        $manager->expects($this->once())->method('refresh')->with($data);\n\n        $this->persistProcessor->process($data, $operation, new Context());\n    }\n\n    public function testItOnlyFlushesWhenManagerContainsTheResource(): void\n    {\n        $manager = $this->createMock(ObjectManager::class);\n        $operation = $this->createMock(Operation::class);\n        $metadata = $this->createMock(ClassMetadata::class);\n        $data = new \\stdClass();\n\n        $metadata->expects(self::once())->method('isChangeTrackingDeferredExplicit')->willReturn(false);\n\n        $this->managerRegistry->method('getManagerForClass')->with(\\stdClass::class)->willReturn($manager);\n        $manager->method('contains')->with($data)->willReturn(true);\n        $manager->method('getClassMetadata')->with(\\stdClass::class)->willReturn($metadata);\n\n        $manager->expects($this->never())->method('persist')->with($data);\n        $manager->expects($this->once())->method('flush');\n        $manager->expects($this->once())->method('refresh')->with($data);\n\n        $this->persistProcessor->process($data, $operation, new Context());\n    }\n\n    public function testItPersistsWhenDeferredExplicitly(): void\n    {\n        $manager = $this->createMock(ObjectManager::class);\n        $operation = $this->createMock(Operation::class);\n        $classMetadataInfo = $this->createMock(ClassMetadata::class);\n        $data = new \\stdClass();\n\n        $this->managerRegistry->method('getManagerForClass')->with(\\stdClass::class)->willReturn($manager);\n        $manager->method('contains')->with($data)->willReturn(true);\n        $manager->method('getClassMetadata')->with(\\stdClass::class)->willReturn($classMetadataInfo);\n\n        $classMetadataInfo->expects($this->once())->method('isChangeTrackingDeferredExplicit')->willReturn(true);\n\n        $manager->expects($this->once())->method('persist')->with($data);\n        $manager->expects($this->once())->method('flush');\n        $manager->expects($this->once())->method('refresh')->with($data);\n\n        $this->persistProcessor->process($data, $operation, new Context());\n    }\n\n    public function testItDoesNothingWhenDataIsNotManagedByDoctrine(): void\n    {\n        $operation = $this->createMock(Operation::class);\n        $data = new \\stdClass();\n\n        $this->managerRegistry->method('getManagerForClass')->with(\\stdClass::class)->willReturn(null);\n\n        $this->assertSame($data, $this->persistProcessor->process($data, $operation, new Context()));\n    }\n\n    public function testItDoesNothingWhenDataIsNotAnObject(): void\n    {\n        $operation = $this->createMock(Operation::class);\n\n        $this->assertSame(1, $this->persistProcessor->process(1, $operation, new Context()));\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Doctrine/Common/State/RemoveProcessorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Doctrine\\Common\\State;\n\nuse Doctrine\\Persistence\\ManagerRegistry;\nuse Doctrine\\Persistence\\ObjectManager;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Doctrine\\Common\\State\\RemoveProcessor;\nuse Sylius\\Resource\\Metadata\\Operation;\n\nfinal class RemoveProcessorTest extends TestCase\n{\n    private ManagerRegistry|MockObject $managerRegistry;\n\n    private RemoveProcessor $removeProcessor;\n\n    protected function setUp(): void\n    {\n        $this->managerRegistry = $this->createMock(ManagerRegistry::class);\n        $this->removeProcessor = new RemoveProcessor($this->managerRegistry);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(RemoveProcessor::class, $this->removeProcessor);\n    }\n\n    public function testItRemovesData(): void\n    {\n        $data = new \\stdClass();\n        $operation = $this->createMock(Operation::class);\n        $manager = $this->createMock(ObjectManager::class);\n\n        $this->managerRegistry->method('getManagerForClass')->with(\\stdClass::class)->willReturn($manager);\n        $manager->method('contains')->with($data)->willReturn(false);\n\n        $manager->expects($this->once())->method('remove')->with($data);\n        $manager->expects($this->once())->method('flush');\n\n        $result = $this->removeProcessor->process($data, $operation, new Context());\n        $this->assertSame($data, $result);\n    }\n\n    public function testItDoesNothingWhenDataIsNotManagedByDoctrine(): void\n    {\n        $data = new \\stdClass();\n        $operation = $this->createMock(Operation::class);\n\n        $this->managerRegistry->method('getManagerForClass')->with(\\stdClass::class)->willReturn(null);\n\n        $this->assertNull($this->removeProcessor->process($data, $operation, new Context()));\n    }\n\n    public function testItDoesNothingWhenDataIsNotAnObject(): void\n    {\n        $operation = $this->createMock(Operation::class);\n\n        $this->assertNull($this->removeProcessor->process(1, $operation, new Context()));\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Doctrine/Persistence/Exception/ResourceExistsExceptionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Doctrine\\Persistence\\Exception;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Doctrine\\Persistence\\Exception\\ExceptionInterface;\nuse Sylius\\Resource\\Doctrine\\Persistence\\Exception\\ResourceExistsException;\n\nfinal class ResourceExistsExceptionTest extends TestCase\n{\n    public function testItExtendsException(): void\n    {\n        $exception = new ResourceExistsException();\n        $this->assertInstanceOf(\\Exception::class, $exception);\n    }\n\n    public function testItExtendsRuntimeException(): void\n    {\n        $exception = new ResourceExistsException();\n        $this->assertInstanceOf(\\RuntimeException::class, $exception);\n    }\n\n    public function testItImplementsExceptionInterface(): void\n    {\n        $exception = new ResourceExistsException();\n        $this->assertInstanceOf(ExceptionInterface::class, $exception);\n    }\n\n    public function testItHasAMessage(): void\n    {\n        $exception = new ResourceExistsException();\n        $this->assertEquals('Given resource already exists in the repository.', $exception->getMessage());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Doctrine/Persistence/InMemoryRepositoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Doctrine\\Persistence;\n\nuse Pagerfanta\\Pagerfanta;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Doctrine\\Persistence\\Exception\\ResourceExistsException;\nuse Sylius\\Resource\\Doctrine\\Persistence\\InMemoryRepository;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Exception\\UnexpectedTypeException;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\nfinal class InMemoryRepositoryTest extends TestCase\n{\n    private InMemoryRepository $repository;\n\n    protected function setUp(): void\n    {\n        $this->repository = new InMemoryRepository(SampleBookResourceInterface::class);\n    }\n\n    public function testItThrowsUnexpectedTypeExceptionWhenConstructingWithoutResourceInterface(): void\n    {\n        $this->expectException(UnexpectedTypeException::class);\n        new InMemoryRepository(\\stdClass::class);\n    }\n\n    public function testItImplementsRepositoryInterface(): void\n    {\n        $this->assertInstanceOf(RepositoryInterface::class, $this->repository);\n    }\n\n    public function testItThrowsInvalidArgumentExceptionWhenAddingWrongResourceType(): void\n    {\n        /** @var MockObject<ResourceInterface> $resource */\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->repository->add($resource);\n    }\n\n    public function testItAddsAnObject(): void\n    {\n        /** @var MockObject<SampleBookResourceInterface> $monocle */\n        $monocle = $this->createMock(SampleBookResourceInterface::class);\n\n        $monocle->method('getId')->willReturn(2);\n        $this->repository->add($monocle);\n        $this->assertSame($monocle, $this->repository->findOneBy(['id' => 2]));\n    }\n\n    public function testItThrowsExistingResourceExceptionOnAddingAResourceWhichIsAlreadyInRepository(): void\n    {\n        /** @var MockObject<SampleBookResourceInterface> $bike */\n        $bike = $this->createMock(SampleBookResourceInterface::class);\n\n        $this->repository->add($bike);\n        $this->expectException(ResourceExistsException::class);\n        $this->repository->add($bike);\n    }\n\n    public function testItRemovesAResource(): void\n    {\n        /** @var MockObject<SampleBookResourceInterface> $shirt */\n        $shirt = $this->createMock(SampleBookResourceInterface::class);\n        $shirt->method('getId')->willReturn(5);\n\n        $this->repository->add($shirt);\n        $this->repository->remove($shirt);\n\n        $this->assertNull($this->repository->findOneBy(['id' => 5]));\n    }\n\n    public function testItFindsObjectById(): void\n    {\n        /** @var MockObject<SampleBookResourceInterface> $monocle */\n        $monocle = $this->createMock(SampleBookResourceInterface::class);\n        $monocle->method('getId')->willReturn(2);\n\n        $this->repository->add($monocle);\n        $this->assertSame($monocle, $this->repository->find(2));\n    }\n\n    public function testItReturnsNullIfCannotFindObjectById(): void\n    {\n        $this->assertNull($this->repository->find(2));\n    }\n\n    public function testItReturnsAllObjectsWhenFindingByAnEmptyParameterArray(): void\n    {\n        /** @var MockObject<SampleBookResourceInterface> $book */\n        $book = $this->createMock(SampleBookResourceInterface::class);\n\n        /** @var MockObject<SampleBookResourceInterface> $shirt */\n        $shirt = $this->createMock(SampleBookResourceInterface::class);\n\n        $book->method('getId')->willReturn(10);\n        $book->method('getName')->willReturn('Book');\n\n        $shirt->method('getId')->willReturn(5);\n        $shirt->method('getName')->willReturn('Shirt');\n\n        $this->repository->add($book);\n        $this->repository->add($shirt);\n\n        $this->assertSame([$book, $shirt], $this->repository->findBy([]));\n    }\n\n    public function testItFindsManyObjectsByMultipleCriteriaOrdersALimitAndAnOffset(): void\n    {\n        /** @var MockObject<SampleBookResourceInterface> $firstBook */\n        $firstBook = $this->createMock(SampleBookResourceInterface::class);\n\n        /** @var MockObject<SampleBookResourceInterface> $secondBook */\n        $secondBook = $this->createMock(SampleBookResourceInterface::class);\n\n        /** @var MockObject<SampleBookResourceInterface> $thirdBook */\n        $thirdBook = $this->createMock(SampleBookResourceInterface::class);\n\n        /** @var MockObject<SampleBookResourceInterface> $fourthBook */\n        $fourthBook = $this->createMock(SampleBookResourceInterface::class);\n\n        /** @var MockObject<SampleBookResourceInterface> $wrongIdBook */\n        $wrongIdBook = $this->createMock(SampleBookResourceInterface::class);\n\n        /** @var MockObject<SampleBookResourceInterface> $wrongNameBook */\n        $wrongNameBook = $this->createMock(SampleBookResourceInterface::class);\n\n        $id = 80;\n        $name = 'Book';\n\n        $firstBook->method('getId')->willReturn($id);\n        $secondBook->method('getId')->willReturn($id);\n        $thirdBook->method('getId')->willReturn($id);\n        $fourthBook->method('getId')->willReturn($id);\n        $wrongNameBook->method('getId')->willReturn($id);\n        $wrongIdBook->method('getId')->willReturn(100);\n\n        $firstBook->method('getName')->willReturn($name);\n        $secondBook->method('getName')->willReturn($name);\n        $thirdBook->method('getName')->willReturn($name);\n        $fourthBook->method('getName')->willReturn($name);\n        $wrongIdBook->method('getName')->willReturn($name);\n        $wrongNameBook->method('getName')->willReturn('Tome');\n\n        $firstBook->method('getRating')->willReturn(3);\n        $secondBook->method('getRating')->willReturn(2);\n        $thirdBook->method('getRating')->willReturn(2);\n        $fourthBook->method('getRating')->willReturn(4);\n\n        $firstBook->method('getTitle')->willReturn('World War Z');\n        $secondBook->method('getTitle')->willReturn('World War Z');\n        $thirdBook->method('getTitle')->willReturn('Call of Cthulhu');\n        $fourthBook->method('getTitle')->willReturn('Art of War');\n\n        $this->repository->add($firstBook);\n        $this->repository->add($secondBook);\n        $this->repository->add($thirdBook);\n        $this->repository->add($fourthBook);\n        $this->repository->add($wrongIdBook);\n        $this->repository->add($wrongNameBook);\n\n        $this->assertSame(\n            [$thirdBook, $firstBook],\n            $this->repository->findBy(\n                ['name' => $name, 'id' => $id],\n                ['rating' => RepositoryInterface::ORDER_ASCENDING, 'title' => RepositoryInterface::ORDER_DESCENDING],\n                2,\n                1,\n            ),\n        );\n    }\n\n    public function testItThrowsInvalidArgumentExceptionWhenFindingOneObjectWithEmptyParameterArray(): void\n    {\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->repository->findOneBy([]);\n    }\n\n    public function testItFindsOneObjectByParameter(): void\n    {\n        $book = new SampleBookResource();\n        $book->name = 'Book';\n\n        $shirt = new SampleBookResource();\n        $shirt->name = 'Shirt';\n\n        $this->repository->add($book);\n        $this->repository->add($shirt);\n\n        $this->assertSame($book, $this->repository->findOneBy(['name' => 'Book']));\n    }\n\n    public function testItReturnsFirstResultWhileFindingOneByParameters(): void\n    {\n        $book = new SampleBookResource();\n        $book->name = 'Book';\n\n        $secondBook = new SampleBookResource();\n        $secondBook->name = 'Book';\n\n        $this->repository->add($book);\n        $this->repository->add($secondBook);\n\n        $this->assertSame($book, $this->repository->findOneBy(['name' => 'Book']));\n    }\n\n    public function testItFindsAllObjectsInMemory(): void\n    {\n        $book = $this->createMock(SampleBookResourceInterface::class);\n        $shirt = $this->createMock(SampleBookResourceInterface::class);\n\n        $this->repository->add($book);\n        $this->repository->add($shirt);\n\n        $this->assertSame([$book, $shirt], $this->repository->findAll());\n    }\n\n    public function testItReturnsEmptyArrayWhenMemoryIsEmpty(): void\n    {\n        $this->assertSame([], $this->repository->findAll());\n    }\n\n    public function testItCreatesPaginator(): void\n    {\n        $this->assertInstanceOf(Pagerfanta::class, $this->repository->createPaginator());\n    }\n\n    public function testItReturnsStatedClassName(): void\n    {\n        $this->assertSame(SampleBookResourceInterface::class, $this->repository->getClassName());\n    }\n}\n\ninterface SampleBookResourceInterface extends ResourceInterface\n{\n    public function getName(): string;\n\n    public function getRating(): int;\n\n    public function getTitle(): string;\n}\n\nclass SampleBookResource implements SampleBookResourceInterface\n{\n    public $id;\n\n    public $name;\n\n    public $rating;\n\n    public $title;\n\n    public function getId(): mixed\n    {\n        return $this->id;\n    }\n\n    public function getName(): string\n    {\n        return $this->name;\n    }\n\n    public function getRating(): int\n    {\n        return $this->rating;\n    }\n\n    public function getTitle(): string\n    {\n        return $this->title;\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Dummy/DummyResource.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\n\n#[AsResource]\nclass DummyResource\n{\n}\n"
  },
  {
    "path": "src/Component/tests/Dummy/PullRequest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Dummy;\n\nclass PullRequest\n{\n    private string $currentPlace = 'start';\n\n    public function getCurrentPlace(): string\n    {\n        return $this->currentPlace;\n    }\n\n    public function setCurrentPlace(string $currentPlace): void\n    {\n        $this->currentPlace = $currentPlace;\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Exception/RaceConditionExceptionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Exception;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Exception\\RaceConditionException;\nuse Sylius\\Resource\\Exception\\UpdateHandlingException;\n\nfinal class RaceConditionExceptionTest extends TestCase\n{\n    public function testItExtendsAnUpdateHandlingException(): void\n    {\n        $exception = new RaceConditionException();\n        $this->assertInstanceOf(UpdateHandlingException::class, $exception);\n    }\n\n    public function testItHasAMessage(): void\n    {\n        $exception = new RaceConditionException();\n        $this->assertSame('Operated entity was previously modified.', $exception->getMessage());\n    }\n\n    public function testItHasAFlash(): void\n    {\n        $exception = new RaceConditionException();\n        $this->assertSame('race_condition_error', $exception->getFlash());\n    }\n\n    public function testItHasAnApiResponseCode(): void\n    {\n        $exception = new RaceConditionException();\n        $this->assertSame(409, $exception->getApiResponseCode());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Factory/FactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Factory\\Factory;\nuse Sylius\\Resource\\Factory\\FactoryInterface;\n\nfinal class FactoryTest extends TestCase\n{\n    private Factory $factory;\n\n    protected function setUp(): void\n    {\n        $this->factory = new Factory(\\stdClass::class);\n    }\n\n    /** @test */\n    public function it_implements_factory_interface(): void\n    {\n        $this->assertInstanceOf(FactoryInterface::class, $this->factory);\n    }\n\n    /** @test */\n    public function it_creates_a_new_instance_of_a_resource(): void\n    {\n        $this->assertInstanceOf(\\stdClass::class, $this->factory->createNew());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Factory/TranslatableFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Factory;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Exception\\UnexpectedTypeException;\nuse Sylius\\Resource\\Factory\\FactoryInterface;\nuse Sylius\\Resource\\Factory\\TranslatableFactory;\nuse Sylius\\Resource\\Factory\\TranslatableFactoryInterface;\nuse Sylius\\Resource\\Model\\TranslatableInterface;\nuse Sylius\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface;\n\nfinal class TranslatableFactoryTest extends TestCase\n{\n    private FactoryInterface|MockObject $factory;\n\n    private TranslationLocaleProviderInterface|MockObject $localeProvider;\n\n    private TranslatableFactory $translatableFactory;\n\n    protected function setUp(): void\n    {\n        $this->factory = $this->createMock(FactoryInterface::class);\n        $this->localeProvider = $this->createMock(TranslationLocaleProviderInterface::class);\n\n        $this->translatableFactory = new TranslatableFactory($this->factory, $this->localeProvider);\n    }\n\n    /** @test */\n    public function it_implements_translatable_factory_interface(): void\n    {\n        $this->assertInstanceOf(TranslatableFactoryInterface::class, $this->translatableFactory);\n    }\n\n    /** @test */\n    public function it_throws_an_exception_if_resource_is_not_translatable(): void\n    {\n        $this->factory->method('createNew')->willReturn(new \\stdClass());\n\n        $this->expectException(UnexpectedTypeException::class);\n\n        $this->translatableFactory->createNew();\n    }\n\n    /** @test */\n    public function it_creates_translatable_and_sets_locales(): void\n    {\n        $resource = $this->createMock(TranslatableInterface::class);\n\n        $this->localeProvider->method('getDefaultLocaleCode')->willReturn('pl_PL');\n\n        $this->factory->method('createNew')->willReturn($resource);\n\n        $resource->expects($this->once())->method('setCurrentLocale')->with('pl_PL');\n        $resource->expects($this->once())->method('setFallbackLocale')->with('pl_PL');\n\n        $this->assertEquals($resource, $this->translatableFactory->createNew());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Generator/RandomnessGeneratorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Generator;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Generator\\RandomnessGenerator;\nuse Sylius\\Resource\\Generator\\RandomnessGeneratorInterface;\n\nfinal class RandomnessGeneratorTest extends TestCase\n{\n    private RandomnessGeneratorInterface $generator;\n\n    protected function setUp(): void\n    {\n        $this->generator = new RandomnessGenerator();\n    }\n\n    public function testItImplementsRandomnessGeneratorInterface(): void\n    {\n        $this->assertInstanceOf(RandomnessGeneratorInterface::class, $this->generator);\n    }\n\n    public function testItGeneratesRandomUriSafeStringOfLength(): void\n    {\n        $length = 9;\n        $result = $this->generator->generateUriSafeString($length);\n\n        $this->assertIsString($result);\n        $this->assertSame($length, strlen($result));\n    }\n\n    public function testItGeneratesRandomNumericStringOfLength(): void\n    {\n        $length = 12;\n        $result = $this->generator->generateNumeric($length);\n\n        $this->assertIsString($result);\n        $this->assertIsNumeric($result);\n        $this->assertSame($length, strlen($result));\n    }\n\n    public function testItGeneratesRandomIntInRange(): void\n    {\n        $min = 12;\n        $max = 2000000;\n        $result = $this->generator->generateInt($min, $max);\n\n        $this->assertIsInt($result);\n        $this->assertGreaterThanOrEqual($min, $result);\n        $this->assertLessThanOrEqual($max, $result);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Grid/State/RequestGridProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Grid\\State;\n\nuse Pagerfanta\\Pagerfanta;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Grid\\Definition\\Grid;\nuse Sylius\\Component\\Grid\\Parameters;\nuse Sylius\\Component\\Grid\\Provider\\GridProviderInterface;\nuse Sylius\\Component\\Grid\\View\\GridView;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Grid\\State\\RequestGridProvider;\nuse Sylius\\Resource\\Grid\\View\\Factory\\GridViewFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Symfony\\Component\\HttpFoundation\\InputBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class RequestGridProviderTest extends TestCase\n{\n    private RequestGridProvider $provider;\n\n    private GridViewFactoryInterface|MockObject $gridViewFactory;\n\n    private GridProviderInterface|MockObject $gridProvider;\n\n    protected function setUp(): void\n    {\n        $this->gridViewFactory = $this->createMock(GridViewFactoryInterface::class);\n        $this->gridProvider = $this->createMock(GridProviderInterface::class);\n        $this->provider = new RequestGridProvider(\n            $this->gridViewFactory,\n            $this->gridProvider,\n        );\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(RequestGridProvider::class, $this->provider);\n    }\n\n    public function testItProvidesAGridView(): void\n    {\n        $request = $this->createMock(Request::class);\n        $context = new Context(new RequestOption($request));\n        $operation = new Index(grid: 'app_book');\n\n        $request->query = new InputBag();\n        $gridDefinition = $this->createMock(Grid::class);\n        $gridView = $this->createMock(GridView::class);\n\n        $this->gridProvider->method('get')->with('app_book')->willReturn($gridDefinition);\n        $gridDefinition->method('getDriverConfiguration')->willReturn([]);\n        $this->gridViewFactory->method('create')->with($gridDefinition, $context, new Parameters(), [])->willReturn($gridView);\n\n        $this->assertSame($gridView, $this->provider->provide($operation, $context));\n    }\n\n    public function testItSetsCurrentPageFromRequest(): void\n    {\n        $request = $this->createMock(Request::class);\n        $context = new Context(new RequestOption($request));\n        $operation = new Index(grid: 'app_book');\n\n        $request->query = new InputBag(['page' => 42]);\n        $gridDefinition = $this->createMock(Grid::class);\n        $gridView = $this->createMock(GridView::class);\n        $pagerfanta = $this->createMock(Pagerfanta::class);\n\n        $this->gridProvider->method('get')->with('app_book')->willReturn($gridDefinition);\n        $gridDefinition->method('getLimits')->willReturn([]);\n        $gridDefinition->method('getDriverConfiguration')->willReturn([]);\n        $this->gridViewFactory->method('create')->with($gridDefinition, $context, new Parameters(['page' => 42]), [])->willReturn($gridView);\n\n        $gridView->method('getData')->willReturn($pagerfanta);\n        $pagerfanta->expects($this->once())->method('setCurrentPage')->with(42)->willReturn($pagerfanta);\n        $pagerfanta->expects($this->once())->method('setMaxPerPage')->with(10)->willReturn($pagerfanta);\n\n        $this->assertSame($gridView, $this->provider->provide($operation, $context));\n    }\n\n    public function testItSetsMaxPerPageFromRequest(): void\n    {\n        $request = $this->createMock(Request::class);\n        $context = new Context(new RequestOption($request));\n        $operation = new Index(grid: 'app_book');\n\n        $request->query = new InputBag(['limit' => 25]);\n        $gridDefinition = $this->createMock(Grid::class);\n        $gridView = $this->createMock(GridView::class);\n        $pagerfanta = $this->createMock(Pagerfanta::class);\n\n        $this->gridProvider->method('get')->with('app_book')->willReturn($gridDefinition);\n        $gridDefinition->method('getDriverConfiguration')->willReturn([]);\n        $gridDefinition->method('getLimits')->willReturn([10, 25]);\n        $this->gridViewFactory->method('create')->with($gridDefinition, $context, new Parameters(['limit' => 25]), [])->willReturn($gridView);\n\n        $gridView->method('getData')->willReturn($pagerfanta);\n        $pagerfanta->expects($this->once())->method('setCurrentPage')->with(1)->willReturn($pagerfanta);\n        $pagerfanta->expects($this->once())->method('setMaxPerPage')->with(25)->willReturn($pagerfanta);\n\n        $this->assertSame($gridView, $this->provider->provide($operation, $context));\n    }\n\n    public function testItSetsMaxPerPageFromGridConfiguration(): void\n    {\n        $request = $this->createMock(Request::class);\n        $context = new Context(new RequestOption($request));\n        $operation = new Index(grid: 'app_book');\n\n        $request->query = new InputBag();\n        $gridDefinition = $this->createMock(Grid::class);\n        $gridView = $this->createMock(GridView::class);\n        $pagerfanta = $this->createMock(Pagerfanta::class);\n\n        $this->gridProvider->method('get')->with('app_book')->willReturn($gridDefinition);\n        $gridDefinition->method('getDriverConfiguration')->willReturn([]);\n        $gridDefinition->method('getLimits')->willReturn([15, 30]);\n        $this->gridViewFactory->method('create')->with($gridDefinition, $context, new Parameters([]), [])->willReturn($gridView);\n\n        $gridView->method('getData')->willReturn($pagerfanta);\n        $pagerfanta->expects($this->once())->method('setCurrentPage')->with(1)->willReturn($pagerfanta);\n        $pagerfanta->expects($this->once())->method('setMaxPerPage')->with(15)->willReturn($pagerfanta);\n\n        $this->assertSame($gridView, $this->provider->provide($operation, $context));\n    }\n\n    public function testItLimitsMaxPerPageWithMaxGridConfigurationLimit(): void\n    {\n        $request = $this->createMock(Request::class);\n        $context = new Context(new RequestOption($request));\n        $operation = new Index(grid: 'app_book');\n\n        $request->query = new InputBag(['limit' => 40]);\n        $gridDefinition = $this->createMock(Grid::class);\n        $gridView = $this->createMock(GridView::class);\n        $pagerfanta = $this->createMock(Pagerfanta::class);\n\n        $this->gridProvider->method('get')->with('app_book')->willReturn($gridDefinition);\n        $gridDefinition->method('getDriverConfiguration')->willReturn([]);\n        $gridDefinition->method('getLimits')->willReturn([15, 30]);\n        $this->gridViewFactory->method('create')->with($gridDefinition, $context, new Parameters(['limit' => 40]), [])->willReturn($gridView);\n\n        $gridView->method('getData')->willReturn($pagerfanta);\n        $pagerfanta->expects($this->once())->method('setCurrentPage')->with(1)->willReturn($pagerfanta);\n        $pagerfanta->expects($this->once())->method('setMaxPerPage')->with(30)->willReturn($pagerfanta);\n\n        $this->assertSame($gridView, $this->provider->provide($operation, $context));\n    }\n\n    public function testItThrowsAnExceptionWhenOperationHasNoGrid(): void\n    {\n        $request = $this->createMock(Request::class);\n        $operation = new Index(name: 'app_book');\n\n        $this->expectException(\\RuntimeException::class);\n        $this->expectExceptionMessage('Operation has no grid, so you cannot use this provider for operation \"app_book\"');\n\n        $this->provider->provide($operation, new Context(new RequestOption($request)));\n    }\n\n    public function testItThrowsAnExceptionWhenOperationDoesNotImplementTheGridAwareInterface(): void\n    {\n        $request = $this->createMock(Request::class);\n        $operation = new Create(name: 'app_book');\n\n        $this->expectException(\\LogicException::class);\n        $this->expectExceptionMessage('You can not use a grid if your operation does not implement \"Sylius\\Resource\\Metadata\\GridAwareOperationInterface\".');\n\n        $this->provider->provide($operation, new Context(new RequestOption($request)));\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Humanizer/StringHumanizerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Humanizer;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Humanizer\\StringHumanizer;\n\nfinal class StringHumanizerTest extends TestCase\n{\n    public function testItIsInitializable(): void\n    {\n        $humanizer = new StringHumanizer();\n        $this->assertInstanceOf(StringHumanizer::class, $humanizer);\n    }\n\n    public function testItHumanizesAString(): void\n    {\n        $humanizer = new StringHumanizer();\n\n        $this->assertSame('admin user', $humanizer::humanize('admin_user'));\n        $this->assertSame('admin user', $humanizer::humanize('Admin_user'));\n        $this->assertSame('admin user', $humanizer::humanize('AdminUser'));\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/ApplyStateMachineTransitionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\ApplyStateMachineTransition;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\StateMachineAwareOperationInterface;\nuse Sylius\\Resource\\Metadata\\UpdateOperationInterface;\n\nfinal class ApplyStateMachineTransitionTest extends TestCase\n{\n    public function testIsInitializable(): void\n    {\n        $operation = new ApplyStateMachineTransition();\n\n        $this->assertInstanceOf(ApplyStateMachineTransition::class, $operation);\n    }\n\n    public function testIsAnOperation(): void\n    {\n        $operation = new ApplyStateMachineTransition();\n\n        $this->assertInstanceOf(Operation::class, $operation);\n    }\n\n    public function testImplementsUpdateOperationInterface(): void\n    {\n        $operation = new ApplyStateMachineTransition();\n\n        $this->assertInstanceOf(UpdateOperationInterface::class, $operation);\n    }\n\n    public function testImplementsStateMachineAwareOperationInterface(): void\n    {\n        $operation = new ApplyStateMachineTransition();\n\n        $this->assertInstanceOf(StateMachineAwareOperationInterface::class, $operation);\n    }\n\n    public function testHasNoResourceByDefault(): void\n    {\n        $operation = new ApplyStateMachineTransition();\n\n        $this->assertNull($operation->getResource());\n    }\n\n    public function testCouldHaveAResource(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book');\n        $operation = new ApplyStateMachineTransition();\n\n        $operationWithResource = $operation->withResource($resource);\n\n        $this->assertSame($resource, $operationWithResource->getResource());\n    }\n\n    public function testHasBulkDeleteShortNameByDefault(): void\n    {\n        $operation = new ApplyStateMachineTransition();\n\n        $this->assertSame('apply_state_machine_transition', $operation->getShortName());\n    }\n\n    public function testHasDeleteMethodsByDefault(): void\n    {\n        $operation = new ApplyStateMachineTransition();\n\n        $this->assertSame(['PUT', 'PATCH', 'POST'], $operation->getMethods());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/BulkDeleteTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\BulkDelete;\nuse Sylius\\Resource\\Metadata\\BulkOperationInterface;\nuse Sylius\\Resource\\Metadata\\DeleteOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nfinal class BulkDeleteTest extends TestCase\n{\n    public function testItIsInitializable(): void\n    {\n        $bulkDelete = new BulkDelete();\n        $this->assertInstanceOf(BulkDelete::class, $bulkDelete);\n    }\n\n    public function testItIsAnOperation(): void\n    {\n        $bulkDelete = new BulkDelete();\n        $this->assertInstanceOf(Operation::class, $bulkDelete);\n    }\n\n    public function testItImplementsDeleteOperationInterface(): void\n    {\n        $bulkDelete = new BulkDelete();\n        $this->assertInstanceOf(DeleteOperationInterface::class, $bulkDelete);\n    }\n\n    public function testItImplementsBulkOperationInterface(): void\n    {\n        $bulkDelete = new BulkDelete();\n        $this->assertInstanceOf(BulkOperationInterface::class, $bulkDelete);\n    }\n\n    public function testItHasNoResourceByDefault(): void\n    {\n        $bulkDelete = new BulkDelete();\n        $this->assertNull($bulkDelete->getResource());\n    }\n\n    public function testItCouldHaveAResource(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book');\n        $bulkDelete = (new BulkDelete())->withResource($resource);\n\n        $this->assertSame($resource, $bulkDelete->getResource());\n    }\n\n    public function testItHasBulkDeleteShortNameByDefault(): void\n    {\n        $bulkDelete = new BulkDelete();\n        $this->assertEquals('bulk_delete', $bulkDelete->getShortName());\n    }\n\n    public function testItHasDeleteMethodsByDefault(): void\n    {\n        $bulkDelete = new BulkDelete();\n        $this->assertEquals(['DELETE', 'POST'], $bulkDelete->getMethods());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/CreateTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\CreateOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nfinal class CreateTest extends TestCase\n{\n    public function testItIsInitializable(): void\n    {\n        $create = new Create();\n        $this->assertInstanceOf(Create::class, $create);\n    }\n\n    public function testItIsAnOperation(): void\n    {\n        $create = new Create();\n        $this->assertInstanceOf(Operation::class, $create);\n    }\n\n    public function testItImplementsCreateOperationInterface(): void\n    {\n        $create = new Create();\n        $this->assertInstanceOf(CreateOperationInterface::class, $create);\n    }\n\n    public function testItHasNoResourceByDefault(): void\n    {\n        $create = new Create();\n        $this->assertNull($create->getResource());\n    }\n\n    public function testItCouldHaveAResource(): void\n    {\n        $resource = new ResourceMetadata('app.book');\n        $create = (new Create())->withResource($resource);\n\n        $this->assertSame($resource, $create->getResource());\n    }\n\n    public function testItHasCreateShortNameByDefault(): void\n    {\n        $create = new Create();\n        $this->assertSame('create', $create->getShortName());\n    }\n\n    public function testItHasGetAndPostMethodsByDefault(): void\n    {\n        $create = new Create();\n        $this->assertSame(['GET', 'POST'], $create->getMethods());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/DeleteTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Delete;\nuse Sylius\\Resource\\Metadata\\DeleteOperationInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nfinal class DeleteTest extends TestCase\n{\n    public function testItIsInitializable(): void\n    {\n        $delete = new Delete();\n        $this->assertInstanceOf(Delete::class, $delete);\n    }\n\n    public function testItIsAnOperation(): void\n    {\n        $delete = new Delete();\n        $this->assertInstanceOf(Operation::class, $delete);\n    }\n\n    public function testItImplementsDeleteOperationInterface(): void\n    {\n        $delete = new Delete();\n        $this->assertInstanceOf(DeleteOperationInterface::class, $delete);\n    }\n\n    public function testItHasNoResourceByDefault(): void\n    {\n        $delete = new Delete();\n        $this->assertNull($delete->getResource());\n    }\n\n    public function testItCouldHaveAResource(): void\n    {\n        $resource = new ResourceMetadata('app.book');\n        $delete = (new Delete())->withResource($resource);\n\n        $this->assertSame($resource, $delete->getResource());\n    }\n\n    public function testItHasDeleteShortNameByDefault(): void\n    {\n        $delete = new Delete();\n        $this->assertSame('delete', $delete->getShortName());\n    }\n\n    public function testItHasDeleteMethodsByDefault(): void\n    {\n        $delete = new Delete();\n        $this->assertSame(['DELETE', 'POST'], $delete->getMethods());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Extractor/PhpFileResourceExtractorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Extractor;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Extractor\\PhpFileResourceExtractor;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nfinal class PhpFileResourceExtractorTest extends TestCase\n{\n    public function testItGetsResourcesFromPhpFileThatReturnsResourceMetadata(): void\n    {\n        $extractor = new PhpFileResourceExtractor([__DIR__ . '/php/valid_php_file.php', __DIR__ . '/php/another_valid_php_file.php']);\n\n        $expectedResources = [new ResourceMetadata(alias: 'dummy'), new ResourceMetadata(alias: 'another_dummy')];\n\n        $this->assertEquals($expectedResources, $extractor->getResources());\n    }\n\n    public function testItExcludesResourcesFromPhpFileThatDoesNotReturnResourceMetadata(): void\n    {\n        $extractor = new PhpFileResourceExtractor([__DIR__ . '/php/invalid_php_file.php']);\n\n        $this->assertEquals([], $extractor->getResources());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Extractor/php/another_valid_php_file.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nreturn new ResourceMetadata(alias: 'another_dummy');\n"
  },
  {
    "path": "src/Component/tests/Metadata/Extractor/php/invalid_php_file.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nuse Sylius\\Resource\\Tests\\Dummy\\PullRequest;\n\nreturn new PullRequest();\n"
  },
  {
    "path": "src/Component/tests/Metadata/Extractor/php/valid_php_file.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nreturn new ResourceMetadata(alias: 'dummy');\n"
  },
  {
    "path": "src/Component/tests/Metadata/HttpOperationTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\n\nfinal class HttpOperationTest extends TestCase\n{\n    public function testItIsInitializable(): void\n    {\n        $httpOperation = new HttpOperation();\n        $this->assertInstanceOf(HttpOperation::class, $httpOperation);\n    }\n\n    public function testItHasNoNameByDefault(): void\n    {\n        $httpOperation = new HttpOperation();\n        $this->assertNull($httpOperation->getName());\n    }\n\n    public function testItCouldHaveAName(): void\n    {\n        $httpOperation = (new HttpOperation())->withName('create');\n        $this->assertSame('create', $httpOperation->getName());\n    }\n\n    public function testItHasNoMethodsByDefault(): void\n    {\n        $httpOperation = new HttpOperation();\n        $this->assertNull($httpOperation->getMethods());\n    }\n\n    public function testItCouldHaveMethods(): void\n    {\n        $httpOperation = (new HttpOperation())->withMethods(['POST', 'GET']);\n        $this->assertSame(['POST', 'GET'], $httpOperation->getMethods());\n    }\n\n    public function testItHasNoPathByDefault(): void\n    {\n        $httpOperation = new HttpOperation();\n        $this->assertNull($httpOperation->getPath());\n    }\n\n    public function testItCouldHaveAPath(): void\n    {\n        $httpOperation = (new HttpOperation())->withPath('you_should_not_pass');\n        $this->assertSame('you_should_not_pass', $httpOperation->getPath());\n    }\n\n    public function testItHasNoRoutePrefixByDefault(): void\n    {\n        $httpOperation = new HttpOperation();\n        $this->assertNull($httpOperation->getRoutePrefix());\n    }\n\n    public function testItCouldHaveARoutePrefix(): void\n    {\n        $httpOperation = (new HttpOperation())->withRoutePrefix('/admin');\n        $this->assertSame('/admin', $httpOperation->getRoutePrefix());\n    }\n\n    public function testItHasNoRoutePriorityByDefault(): void\n    {\n        $httpOperation = new HttpOperation();\n        $this->assertNull($httpOperation->getROutePriority());\n    }\n\n    public function testItCouldHaveARoutePriority(): void\n    {\n        $httpOperation = (new HttpOperation())->withRoutePriority(100);\n        $this->assertSame(100, $httpOperation->getRoutePriority());\n    }\n\n    public function testItHasNoTemplateByDefault(): void\n    {\n        $httpOperation = new HttpOperation();\n        $this->assertNull($httpOperation->getTemplate());\n    }\n\n    public function testItCouldHaveATemplate(): void\n    {\n        $httpOperation = (new HttpOperation())->withTemplate('book/show.html.twig');\n        $this->assertSame('book/show.html.twig', $httpOperation->getTemplate());\n    }\n\n    public function testItCanBeConstructedWithAName(): void\n    {\n        $httpOperation = new HttpOperation(name: 'create');\n        $this->assertSame('create', $httpOperation->getName());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/IndexTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\CollectionOperationInterface;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nfinal class IndexTest extends TestCase\n{\n    private Index $index;\n\n    protected function setUp(): void\n    {\n        $this->index = new Index();\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(Index::class, $this->index);\n    }\n\n    public function testItIsAnOperation(): void\n    {\n        $this->assertInstanceOf(Operation::class, $this->index);\n    }\n\n    public function testItImplementsCollectionOperationInterface(): void\n    {\n        $this->assertInstanceOf(CollectionOperationInterface::class, $this->index);\n    }\n\n    public function testItHasNoResourceByDefault(): void\n    {\n        $this->assertNull($this->index->getResource());\n    }\n\n    public function testItCouldHaveAResource(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book');\n\n        $this->index = $this->index->withResource($resource);\n\n        $this->assertSame($resource, $this->index->getResource());\n    }\n\n    public function testItHasIndexShortNameByDefault(): void\n    {\n        $this->assertSame('index', $this->index->getShortName());\n    }\n\n    public function testItHasGetMethodsByDefault(): void\n    {\n        $this->assertSame(['GET'], $this->index->getMethods());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Inflector/InflectorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Inflector;\n\nuse PHPUnit\\Framework\\Attributes\\CoversClass;\nuse PHPUnit\\Framework\\Attributes\\DataProvider;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Inflector\\Inflector;\n\n#[CoversClass(Inflector::class)]\nfinal class InflectorTest extends TestCase\n{\n    #[DataProvider('tableizeProvider')]\n    public function testTableize(string $expected, string $string): void\n    {\n        $this->assertSame($expected, (new Inflector())->tableize($string));\n    }\n\n    #[DataProvider('pluralizeProvider')]\n    public function testPluralize(string $expected, string $string): void\n    {\n        $this->assertSame($expected, (new Inflector())->pluralize($string));\n    }\n\n    #[DataProvider('dashizeProvider')]\n    public function testDashize(string $expected, string $string): void\n    {\n        $this->assertSame($expected, (new Inflector())->dashize($string));\n    }\n\n    public static function tableizeProvider(): iterable\n    {\n        yield ['book', 'Book'];\n        yield ['stephen_king_book', 'StephenKingBook'];\n    }\n\n    public static function pluralizeProvider(): iterable\n    {\n        yield ['books', 'book'];\n        yield ['products', 'product'];\n        yield ['orders', 'order'];\n    }\n\n    public static function dashizeProvider(): iterable\n    {\n        yield ['stephen-king-book', 'StephenKingBook'];\n        yield ['stephen-king-book', 'Stephen_King_Book'];\n        yield ['stephen-king-book', 'Stephen King Book'];\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/MetadataTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Metadata;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\n\nfinal class MetadataTest extends TestCase\n{\n    private Metadata $metadata;\n\n    protected function setUp(): void\n    {\n        $this->metadata = Metadata::fromAliasAndConfiguration(\n            'app.product',\n            [\n                'driver' => 'doctrine/orm',\n                'state_machine_component' => 'symfony',\n                'templates' => 'product',\n                'classes' => [\n                    'model' => 'App\\Model\\Resource',\n                    'form' => [\n                        'default' => 'App\\Form\\Type\\ResourceType',\n                        'choice' => 'App\\Form\\Type\\ResourceChoiceType',\n                        'autocomplete' => 'App\\Type\\ResourceAutocompleteType',\n                    ],\n                ],\n            ],\n        );\n    }\n\n    public function testItImplementsMetadataInterface(): void\n    {\n        $this->assertInstanceOf(MetadataInterface::class, $this->metadata);\n    }\n\n    public function testItHasAlias(): void\n    {\n        $this->assertSame('app.product', $this->metadata->getAlias());\n    }\n\n    public function testItAllowsToHaveAliasWithDotInName(): void\n    {\n        $metadata = Metadata::fromAliasAndConfiguration(\n            'app.product.with.dots',\n            [\n                'driver' => 'doctrine/orm',\n                'templates' => 'product',\n                'classes' => [\n                    'model' => 'App\\Model\\Resource',\n                    'form' => [\n                        'default' => 'App\\Form\\Type\\ResourceType',\n                        'choice' => 'App\\Form\\Type\\ResourceChoiceType',\n                        'autocomplete' => 'App\\Type\\ResourceAutocompleteType',\n                    ],\n                ],\n            ],\n        );\n\n        $this->assertSame('app.product.with.dots', $metadata->getAlias());\n        $this->assertSame('app', $metadata->getApplicationName());\n        $this->assertSame('product.with.dots', $metadata->getName());\n    }\n\n    public function testItHasApplicationName(): void\n    {\n        $this->assertSame('app', $this->metadata->getApplicationName());\n    }\n\n    public function testItHasResourceName(): void\n    {\n        $this->assertSame('product', $this->metadata->getName());\n    }\n\n    public function testItHumanizesSimpleNames(): void\n    {\n        $this->assertSame('product', $this->metadata->getHumanizedName());\n    }\n\n    public function testItHumanizesMoreComplexNames(): void\n    {\n        $metadata = Metadata::fromAliasAndConfiguration('app.product_option', ['driver' => 'doctrine/orm']);\n\n        $this->assertSame('product option', $metadata->getHumanizedName());\n    }\n\n    public function testItHasPluralResourceName(): void\n    {\n        $this->assertSame('products', $this->metadata->getPluralName());\n    }\n\n    public function testItHasDriver(): void\n    {\n        $this->assertSame('doctrine/orm', $this->metadata->getDriver());\n    }\n\n    public function testItHasStateMachineComponent(): void\n    {\n        $this->assertSame('symfony', $this->metadata->getStateMachineComponent());\n    }\n\n    public function testItHasTemplatesNamespace(): void\n    {\n        $this->assertSame('product', $this->metadata->getTemplatesNamespace());\n    }\n\n    public function testItHasAccessToSpecificConfigParameter(): void\n    {\n        $this->assertSame('doctrine/orm', $this->metadata->getParameter('driver'));\n    }\n\n    public function testItChecksIfSpecificParameterExists(): void\n    {\n        $this->assertFalse($this->metadata->hasParameter('foo'));\n        $this->assertTrue($this->metadata->hasParameter('driver'));\n    }\n\n    public function testItThrowsAnExceptionWhenParameterDoesNotExist(): void\n    {\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->metadata->getParameter('foo');\n    }\n\n    public function testItHasAccessToSpecificClasses(): void\n    {\n        $this->assertSame('App\\Model\\Resource', $this->metadata->getClass('model'));\n    }\n\n    public function testItThrowsAnExceptionWhenClassDoesNotExist(): void\n    {\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->metadata->getClass('foo');\n    }\n\n    public function testItChecksIfSpecificClassExists(): void\n    {\n        $this->assertFalse($this->metadata->hasClass('bar'));\n        $this->assertTrue($this->metadata->hasClass('model'));\n    }\n\n    public function testItGeneratesServiceId(): void\n    {\n        $this->assertSame('app.factory.product', $this->metadata->getServiceId('factory'));\n        $this->assertSame('app.repository.product', $this->metadata->getServiceId('repository'));\n        $this->assertSame('app.form.type.product', $this->metadata->getServiceId('form.type'));\n    }\n\n    public function testItGeneratesPermissionCode(): void\n    {\n        $this->assertSame('app.product.show', $this->metadata->getPermissionCode('show'));\n        $this->assertSame('app.product.create', $this->metadata->getPermissionCode('create'));\n        $this->assertSame('app.product.custom', $this->metadata->getPermissionCode('custom'));\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Operation/DashPathSegmentNameGeneratorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Operation;\n\nuse PHPUnit\\Framework\\Attributes\\CoversClass;\nuse PHPUnit\\Framework\\Attributes\\DataProvider;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Inflector\\Inflector;\nuse Sylius\\Resource\\Metadata\\Operation\\DashPathSegmentNameGenerator;\n\n#[CoversClass(DashPathSegmentNameGenerator::class)]\nfinal class DashPathSegmentNameGeneratorTest extends TestCase\n{\n    #[DataProvider('segmentNameProvider')]\n    public function testGettingSegmentName(string $expected, string $name, bool $pluralize): void\n    {\n        $this->assertSame($expected, (new DashPathSegmentNameGenerator(new Inflector()))->getSegmentName($name, $pluralize));\n    }\n\n    public static function segmentNameProvider(): iterable\n    {\n        yield ['stephen-king-book', 'StephenKingBook', false];\n        yield ['stephen-king-book', 'Stephen_King_Book', false];\n        yield ['stephen-king-book', 'Stephen King Book', false];\n        yield ['stephen-king-books', 'StephenKingBook', true];\n        yield ['stephen-king-books', 'Stephen_King_Book', true];\n        yield ['stephen-king-books', 'Stephen King Book', true];\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Operation/HttpOperationInitiatorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Operation;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\Operation\\HttpOperationInitiator;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\VarsResolverInterface;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class HttpOperationInitiatorTest extends TestCase\n{\n    private RegistryInterface|MockObject $resourceRegistry;\n\n    private ResourceMetadataCollectionFactoryInterface|MockObject $resourceMetadataCollectionFactory;\n\n    private VarsResolverInterface|MockObject $varsResolver;\n\n    protected function setUp(): void\n    {\n        $this->resourceRegistry = $this->createMock(RegistryInterface::class);\n        $this->resourceMetadataCollectionFactory = $this->createMock(ResourceMetadataCollectionFactoryInterface::class);\n        $this->varsResolver = $this->createMock(VarsResolverInterface::class);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $initiator = new HttpOperationInitiator(\n            $this->resourceRegistry,\n            $this->resourceMetadataCollectionFactory,\n            $this->varsResolver,\n        );\n\n        $this->assertInstanceOf(HttpOperationInitiator::class, $initiator);\n    }\n\n    public function testItInitializesHttpOperationsFromRequest(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $metadata = $this->createMock(MetadataInterface::class);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $request->attributes = $attributes;\n\n        $attributes->method('get')->with('_route')->willReturn('app_dummy_index');\n        $attributes->method('all')->with('_sylius')->willReturn([\n            'resource' => 'app.dummy',\n        ]);\n        $attributes->expects($this->once())->method('set')->with('_sylius', ['resource' => 'app.dummy', 'resource_class' => 'App\\DummyResource']);\n\n        $this->resourceRegistry->method('get')->with('app.dummy')->willReturn($metadata);\n\n        $metadata->method('getClass')->with('model')->willReturn('App\\DummyResource');\n        $metadata->method('getAlias')->willReturn('app.dummy');\n\n        $operation->method('getName')->willReturn('app_dummy_index');\n        $operation->method('getVars')->willReturn(null);\n        $operation->method('getResource')->willReturn(null);\n\n        $operations = new Operations();\n        $operations->add('app_dummy_index', $operation);\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = (new ResourceMetadata(alias: 'app.dummy'))->withOperations($operations);\n\n        $this->resourceMetadataCollectionFactory->method('create')->with('App\\DummyResource')->willReturn($resourceMetadataCollection);\n\n        $initiator = new HttpOperationInitiator(\n            $this->resourceRegistry,\n            $this->resourceMetadataCollectionFactory,\n        );\n\n        $this->assertSame($operation, $initiator->initializeOperation($request));\n    }\n\n    public function testItResolvesOperationVars(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $metadata = $this->createMock(MetadataInterface::class);\n        $operation = new Index(name: 'app_dummy_index', vars: ['product' => '@=get_current_product()']);\n\n        $request->attributes = $attributes;\n\n        $attributes->method('get')->with('_route')->willReturn('app_dummy_index');\n        $attributes->method('all')->with('_sylius')->willReturn([\n            'resource' => 'app.dummy',\n        ]);\n        $attributes->expects($this->once())->method('set')->with('_sylius', ['resource' => 'app.dummy', 'resource_class' => 'App\\DummyResource']);\n\n        $this->resourceRegistry->method('get')->with('app.dummy')->willReturn($metadata);\n\n        $metadata->method('getClass')->with('model')->willReturn('App\\DummyResource');\n        $metadata->method('getAlias')->willReturn('app.dummy');\n\n        $operations = new Operations();\n        $operations->add('app_dummy_index', $operation);\n\n        $product = new \\stdClass();\n        $this->varsResolver->expects($this->once())->method('resolve')->with(['product' => '@=get_current_product()'])->willReturn(['product' => $product]);\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = (new ResourceMetadata(alias: 'app.dummy'))->withOperations($operations);\n\n        $this->resourceMetadataCollectionFactory->method('create')->with('App\\DummyResource')->willReturn($resourceMetadataCollection);\n\n        $initiator = new HttpOperationInitiator(\n            $this->resourceRegistry,\n            $this->resourceMetadataCollectionFactory,\n            $this->varsResolver,\n        );\n\n        $result = $initiator->initializeOperation($request);\n        $this->assertNotNull($result);\n        $this->assertSame(['product' => $product], $result->getVars());\n    }\n\n    public function testItReturnsNullWhenRequestHasNoSyliusOptions(): void\n    {\n        $request = $this->createMock(Request::class);\n        $parameterBag = $this->createMock(ParameterBag::class);\n\n        $request->attributes = $parameterBag;\n\n        $parameterBag->method('get')->with('_route')->willReturn('app_dummy_index');\n        $parameterBag->expects($this->once())->method('all')->with('_sylius')->willReturn([]);\n\n        $initiator = new HttpOperationInitiator(\n            $this->resourceRegistry,\n            $this->resourceMetadataCollectionFactory,\n        );\n\n        $this->assertNull($initiator->initializeOperation($request));\n    }\n\n    public function testItReturnsNullWhenRequestHasNoResourceOption(): void\n    {\n        $request = $this->createMock(Request::class);\n        $parameterBag = $this->createMock(ParameterBag::class);\n\n        $request->attributes = $parameterBag;\n\n        $parameterBag->method('get')->with('_route')->willReturn('app_dummy_index');\n        $parameterBag->expects($this->once())->method('all')->with('_sylius')->willReturn([\n            'foo' => 'bar',\n        ]);\n\n        $initiator = new HttpOperationInitiator(\n            $this->resourceRegistry,\n            $this->resourceMetadataCollectionFactory,\n        );\n\n        $this->assertNull($initiator->initializeOperation($request));\n    }\n\n    public function testItReturnsNullWhenRequestHasNoRoute(): void\n    {\n        $request = $this->createMock(Request::class);\n        $parameterBag = $this->createMock(ParameterBag::class);\n\n        $request->attributes = $parameterBag;\n\n        $parameterBag->method('all')->with('_sylius')->willReturn([\n            'resource' => 'app.dummy',\n        ]);\n\n        $parameterBag->expects($this->once())->method('get')->with('_route')->willReturn(null);\n\n        $initiator = new HttpOperationInitiator(\n            $this->resourceRegistry,\n            $this->resourceMetadataCollectionFactory,\n        );\n\n        $this->assertNull($initiator->initializeOperation($request));\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Operation/UnderscorePathSegmentNameGeneratorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Operation;\n\nuse PHPUnit\\Framework\\Attributes\\CoversClass;\nuse PHPUnit\\Framework\\Attributes\\DataProvider;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Inflector\\Inflector;\nuse Sylius\\Resource\\Metadata\\Operation\\UnderscorePathSegmentNameGenerator;\n\n#[CoversClass(UnderscorePathSegmentNameGenerator::class)]\nfinal class UnderscorePathSegmentNameGeneratorTest extends TestCase\n{\n    #[DataProvider('segmentNameProvider')]\n    public function testGettingSegmentName(string $expected, string $name, bool $pluralize): void\n    {\n        $this->assertSame($expected, (new UnderscorePathSegmentNameGenerator(new Inflector()))->getSegmentName($name, $pluralize));\n    }\n\n    public static function segmentNameProvider(): iterable\n    {\n        yield ['stephen_king_book', 'StephenKingBook', false];\n        yield ['stephen_king_book', 'Stephen_King_Book', false];\n        yield ['stephen_king_book', 'Stephen King Book', false];\n        yield ['stephen_king_books', 'StephenKingBook', true];\n        yield ['stephen_king_books', 'Stephen_King_Book', true];\n        yield ['stephen_king_books', 'Stephen King Book', true];\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/OperationsTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\Update;\n\nfinal class OperationsTest extends TestCase\n{\n    private Operations $operations;\n\n    protected function setUp(): void\n    {\n        $this->operations = new Operations();\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(Operations::class, $this->operations);\n    }\n\n    public function testItIsCountable(): void\n    {\n        $this->assertInstanceOf(\\Countable::class, $this->operations);\n    }\n\n    public function testItIsAnIterator(): void\n    {\n        $this->assertInstanceOf(\\IteratorAggregate::class, $this->operations);\n    }\n\n    public function testItAddsOperations(): void\n    {\n        $this->operations->add('create', new Create());\n\n        $this->assertTrue($this->operations->has('create'));\n    }\n\n    public function testItRemovesOperations(): void\n    {\n        $this->operations->add('create', new Create());\n\n        $this->operations->remove('create');\n\n        $this->assertFalse($this->operations->has('create'));\n    }\n\n    public function testItMergesOperations(): void\n    {\n        $this->operations->add('create', new Create());\n        $this->operations->add('create', new Create(name: 'new_name'));\n\n        $this->assertCount(1, $this->operations);\n        $this->assertTrue($this->operations->has('create'));\n        $this->assertSame('new_name', $this->operations->getIterator()->current()->getName());\n    }\n\n    public function testItThrowsARuntimeExceptionWhenRemovingNotFoundOperation(): void\n    {\n        $this->expectException(\\RuntimeException::class);\n        $this->operations->remove('not_found_operation');\n    }\n\n    public function testItReturnsOperationsCount(): void\n    {\n        $this->operations->add('create', new Create());\n        $this->operations->add('update', new Update());\n\n        $this->assertCount(2, $this->operations);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/RegistryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\Registry;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\n\nfinal class RegistryTest extends TestCase\n{\n    private Registry $registry;\n\n    protected function setUp(): void\n    {\n        $this->registry = new Registry();\n    }\n\n    public function testItImplementsRegistryInterface(): void\n    {\n        $this->assertInstanceOf(RegistryInterface::class, $this->registry);\n    }\n\n    public function testItReturnsAllResourcesMetadata(): void\n    {\n        $metadata1 = $this->createMock(MetadataInterface::class);\n        $metadata2 = $this->createMock(MetadataInterface::class);\n\n        $metadata1->method('getAlias')->willReturn('app.product');\n        $metadata2->method('getAlias')->willReturn('app.order');\n\n        $this->registry->add($metadata1);\n        $this->registry->add($metadata2);\n\n        $this->assertSame([\n            'app.product' => $metadata1,\n            'app.order' => $metadata2,\n        ], $this->registry->getAll());\n    }\n\n    public function testItThrowsAnExceptionIfResourceIsNotRegistered(): void\n    {\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->registry->get('foo.bar');\n    }\n\n    public function testItReturnsSpecificMetadata(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $metadata->method('getAlias')->willReturn('app.shipping_method');\n\n        $this->registry->add($metadata);\n\n        $this->assertSame($metadata, $this->registry->get('app.shipping_method'));\n    }\n\n    public function testItThrowsAnExceptionIfResourceIsNotRegisteredWithClass(): void\n    {\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->registry->getByClass('App\\Model\\OrderItem');\n    }\n\n    public function testItReturnsSpecificMetadataByModelClass(): void\n    {\n        $metadata1 = $this->createMock(MetadataInterface::class);\n        $metadata2 = $this->createMock(MetadataInterface::class);\n\n        $metadata1->method('getAlias')->willReturn('app.product');\n        $metadata1->method('getClass')->with('model')->willReturn('App\\Model\\Product');\n\n        $metadata2->method('getAlias')->willReturn('app.order');\n        $metadata2->method('getClass')->with('model')->willReturn('App\\Model\\Order');\n\n        $this->registry->add($metadata1);\n        $this->registry->add($metadata2);\n\n        $this->assertSame($metadata2, $this->registry->getByClass('App\\Model\\Order'));\n    }\n\n    public function testItAddsMetadataFromConfigurationArray(): void\n    {\n        $this->registry->addFromAliasAndConfiguration('app.product', [\n            'driver' => 'doctrine/orm',\n            'classes' => [\n                'model' => 'App\\Model\\Product',\n            ],\n        ]);\n\n        $this->assertInstanceOf(MetadataInterface::class, $this->registry->get('app.product'));\n        $this->assertInstanceOf(MetadataInterface::class, $this->registry->getByClass('App\\Model\\Product'));\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/Factory/AttributesResourceClassListFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Resource\\Factory;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\AttributesResourceClassListFactory;\nuse Sylius\\Resource\\Tests\\Dummy\\DummyResource;\nuse Sylius\\Resource\\Tests\\Dummy\\PullRequest;\n\nfinal class AttributesResourceClassListFactoryTest extends TestCase\n{\n    public function testCreateAResourceClassListForResourcesWithAsResourceAttribute(): void\n    {\n        $attributesResourceClassListFactory = new AttributesResourceClassListFactory(\n            mapping: ['paths' => [dirname(__DIR__, 3) . '/Dummy']],\n        );\n\n        $list = $attributesResourceClassListFactory->create();\n\n        $this->assertContains(DummyResource::class, $list->getIterator());\n        $this->assertNotContains(PullRequest::class, $list->getIterator());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/Factory/AttributesResourceMetadataCollectionFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Resource\\Factory;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyMultiResourcesWithOperations;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyOperationsWithoutResource;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResource;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithAlias;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithDenormalizationContext;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithFormOptions;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithFormType;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithName;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithNormalizationContext;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithOperations;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithPluralName;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithRouteCondition;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithRoutePrefix;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithRoutePriorities;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithRouteRequirements;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithSections;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithSectionsAndNestedOperations;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithValidationContext;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Metadata;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\AttributesResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\nuse Sylius\\Resource\\Symfony\\Request\\State\\Responder;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RouteName\\OperationRouteNameFactory;\n\nfinal class AttributesResourceMetadataCollectionFactoryTest extends TestCase\n{\n    private AttributesResourceMetadataCollectionFactory $factory;\n\n    private $resourceRegistry;\n\n    protected function setUp(): void\n    {\n        $this->resourceRegistry = $this->createMock(RegistryInterface::class);\n        $this->factory = new AttributesResourceMetadataCollectionFactory($this->resourceRegistry, new OperationRouteNameFactory());\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(AttributesResourceMetadataCollectionFactory::class, $this->factory);\n    }\n\n    public function testItCreatesResourceMetadata(): void\n    {\n        $metadata = Metadata::fromAliasAndConfiguration('app.dummy', ['driver' => 'dummy_driver']);\n        $this->resourceRegistry->method('get')->willReturn($metadata);\n\n        $metadataCollection = $this->factory->create(DummyResourceWithAlias::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n        $this->assertCount(1, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n    }\n\n    public function testItCreatesResourceMetadataWithoutResourceAlias(): void\n    {\n        $metadata = Metadata::fromAliasAndConfiguration('app.dummy', ['driver' => 'dummy_driver']);\n        $this->resourceRegistry->method('getByClass')->willReturn($metadata);\n\n        $metadataCollection = $this->factory->create(DummyResource::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n        $this->assertCount(1, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n        $this->assertSame(DummyResource::class, $resource->getClass());\n    }\n\n    public function testItCreatesResourceMetadataWithOperations(): void\n    {\n        $metadata = Metadata::fromAliasAndConfiguration('app.dummy', [\n            'driver' => 'dummy_driver',\n            'classes' => [\n                'model' => 'App\\Dummy',\n                'form' => 'App\\Form',\n            ],\n        ]);\n        $this->resourceRegistry->method('get')->willReturn($metadata);\n\n        $metadataCollection = $this->factory->create(DummyResourceWithOperations::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n\n        $this->assertCount(4, $operations);\n        $this->assertTrue($operations->has('app_dummy_index'));\n        $this->assertTrue($operations->has('app_dummy_create'));\n        $this->assertTrue($operations->has('app_dummy_update'));\n        $this->assertTrue($operations->has('app_dummy_show'));\n    }\n\n    public function testItCreatesMultiResourcesMetadataWithOperations(): void\n    {\n        $orderMetadata = Metadata::fromAliasAndConfiguration('app.order', [\n            'driver' => 'order_driver',\n            'classes' => [\n                'model' => 'App\\Order',\n                'form' => 'App\\Form\\OrderType',\n            ],\n        ]);\n        $cartMetadata = Metadata::fromAliasAndConfiguration('app.cart', [\n            'driver' => 'cart_driver',\n            'classes' => [\n                'model' => 'App\\Cart',\n                'form' => 'App\\Form\\CartType',\n            ],\n        ]);\n        $this->resourceRegistry->method('get')\n            ->willReturnMap([\n                ['app.order', $orderMetadata],\n                ['app.cart', $cartMetadata],\n            ]);\n\n        $metadataCollection = $this->factory->create(DummyMultiResourcesWithOperations::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n        $this->assertCount(2, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.order', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n        $this->assertCount(2, $operations);\n        $this->assertTrue($operations->has('app_order_index'));\n        $this->assertTrue($operations->has('app_order_create'));\n\n        $operation = $metadataCollection->getOperation('app.order', 'app_order_index');\n        $this->assertInstanceOf(Index::class, $operation);\n        $this->assertSame('app_order_index', $operation->getName());\n        $this->assertSame(['GET'], $operation->getMethods());\n        $this->assertSame('app.repository.order', $operation->getRepository());\n        $this->assertSame('App\\Form\\OrderType', $operation->getFormType());\n\n        $operation = $metadataCollection->getOperation('app.cart', 'app_cart_index');\n        $this->assertInstanceOf(Index::class, $operation);\n        $this->assertSame('app_cart_index', $operation->getName());\n        $this->assertSame(['GET'], $operation->getMethods());\n        $this->assertSame('app.repository.cart', $operation->getRepository());\n        $this->assertSame('App\\Form\\CartType', $operation->getFormType());\n\n        $operation = $metadataCollection->getOperation('app.cart', 'app_cart_show');\n        $this->assertInstanceOf(Show::class, $operation);\n        $this->assertSame('app_cart_show', $operation->getName());\n        $this->assertSame(['GET'], $operation->getMethods());\n        $this->assertSame('app.repository.cart', $operation->getRepository());\n        $this->assertSame('App\\Form\\CartType', $operation->getFormType());\n    }\n\n    public function testItCreatesMultiResourcesMetadataWithSections(): void\n    {\n        $metadata = Metadata::fromAliasAndConfiguration('app.dummy', [\n            'driver' => 'dummy_driver',\n            'classes' => [\n                'model' => 'App\\Dummy',\n                'form' => 'App\\Form',\n            ],\n        ]);\n        $this->resourceRegistry->method('get')->willReturn($metadata);\n\n        $metadataCollection = $this->factory->create(DummyResourceWithSections::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n        $this->assertCount(2, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n        $this->assertCount(2, $operations);\n        $this->assertTrue($operations->has('app_admin_dummy_index'));\n        $this->assertTrue($operations->has('app_admin_dummy_create'));\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_admin_dummy_index');\n        $this->assertInstanceOf(Index::class, $operation);\n        $this->assertSame('app_admin_dummy_index', $operation->getName());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_admin_dummy_create');\n        $this->assertInstanceOf(Create::class, $operation);\n        $this->assertSame('app_admin_dummy_create', $operation->getName());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_shop_dummy_show');\n        $this->assertInstanceOf(Show::class, $operation);\n        $this->assertSame('app_shop_dummy_show', $operation->getName());\n    }\n\n    public function testItCreatesMultiResourcesMetadataWithSectionsAndNestedOperations(): void\n    {\n        if (\\PHP_VERSION_ID < 80100) {\n            $this->markTestSkipped('Nested attributes are supported since PHP 8.1');\n        }\n\n        $metadata = Metadata::fromAliasAndConfiguration('app.dummy', [\n            'driver' => 'dummy_driver',\n            'classes' => [\n                'model' => 'App\\Dummy',\n                'form' => 'App\\Form',\n            ],\n        ]);\n        $this->resourceRegistry->method('get')->willReturn($metadata);\n\n        $metadataCollection = $this->factory->create(DummyResourceWithSectionsAndNestedOperations::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n        $this->assertCount(2, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n        $this->assertCount(2, $operations);\n        $this->assertTrue($operations->has('app_admin_dummy_index'));\n        $this->assertTrue($operations->has('app_admin_dummy_create'));\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_admin_dummy_index');\n        $this->assertInstanceOf(Index::class, $operation);\n        $this->assertSame('app_admin_dummy_index', $operation->getName());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_admin_dummy_create');\n        $this->assertInstanceOf(Create::class, $operation);\n        $this->assertSame('app_admin_dummy_create', $operation->getName());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_admin_dummy_index');\n        $this->assertInstanceOf(Index::class, $operation);\n        $this->assertSame('app_admin_dummy_index', $operation->getName());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_shop_dummy_show');\n        $this->assertInstanceOf(Show::class, $operation);\n        $this->assertSame('app_shop_dummy_show', $operation->getName());\n    }\n\n    public function testItCreatesOperationsEvenIfThereIsNoResourceAttribute(): void\n    {\n        $this->resourceRegistry\n            ->method('getByClass')\n            ->with(DummyOperationsWithoutResource::class)\n            ->willReturn(Metadata::fromAliasAndConfiguration('app.dummy', ['driver' => 'dummy_driver']));\n\n        $this->resourceRegistry\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn(Metadata::fromAliasAndConfiguration('app.dummy', [\n                'driver' => 'dummy_driver',\n                'classes' => [\n                    'model' => 'App\\Dummy',\n                    'form' => 'App\\Form',\n                ],\n            ]));\n\n        $metadataCollection = $this->factory->create(DummyOperationsWithoutResource::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n        $this->assertCount(1, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n        $this->assertCount(2, $operations);\n        $this->assertTrue($operations->has('app_dummy_index'));\n        $this->assertTrue($operations->has('app_dummy_create'));\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_index');\n        $this->assertInstanceOf(Index::class, $operation);\n        $this->assertSame('app_dummy_index', $operation->getName());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_create');\n        $this->assertInstanceOf(Create::class, $operation);\n        $this->assertSame('app_dummy_create', $operation->getName());\n    }\n\n    public function testItCreatesResourceMetadataWithFormType(): void\n    {\n        $this->resourceRegistry\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn(Metadata::fromAliasAndConfiguration('app.dummy', [\n                'driver' => 'dummy_driver',\n                'classes' => ['model' => 'App\\Dummy'],\n            ]));\n\n        $metadataCollection = $this->factory->create(DummyResourceWithFormType::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n        $this->assertCount(2, $operations);\n        $this->assertTrue($operations->has('app_dummy_create'));\n        $this->assertTrue($operations->has('app_dummy_update'));\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_create');\n        $this->assertSame('App\\Form\\DummyType', $operation->getFormType());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_update');\n        $this->assertSame('App\\Form\\DummyType', $operation->getFormType());\n    }\n\n    public function testItCreatesResourceMetadataWithFormOptions(): void\n    {\n        $this->resourceRegistry\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn(Metadata::fromAliasAndConfiguration('app.dummy', [\n                'driver' => 'dummy_driver',\n                'classes' => [\n                    'model' => 'App\\Dummy',\n                    'form' => 'App\\Form',\n                ],\n            ]));\n\n        $metadataCollection = $this->factory->create(DummyResourceWithFormOptions::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n        $this->assertCount(2, $operations);\n        $this->assertTrue($operations->has('app_dummy_create'));\n        $this->assertTrue($operations->has('app_dummy_update'));\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_create');\n        $this->assertInstanceOf(Create::class, $operation);\n        $this->assertSame([\n            'data_class' => 'App\\Dummy',\n            'html5' => false,\n        ], $operation->getFormOptions());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_update');\n        $this->assertInstanceOf(Update::class, $operation);\n        $this->assertSame([\n            'data_class' => 'App\\Dummy',\n            'html5' => true,\n        ], $operation->getFormOptions());\n    }\n\n    public function testItCreatesResourceMetadataWithValidationContext(): void\n    {\n        $this->resourceRegistry\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn(Metadata::fromAliasAndConfiguration('app.dummy', [\n                'driver' => 'dummy_driver',\n                'classes' => [\n                    'model' => 'App\\Dummy',\n                    'form' => 'App\\Form',\n                ],\n            ]));\n\n        $metadataCollection = $this->factory->create(DummyResourceWithValidationContext::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n        $this->assertCount(2, $operations);\n        $this->assertTrue($operations->has('app_dummy_create'));\n        $this->assertTrue($operations->has('app_dummy_update'));\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_create');\n        $this->assertInstanceOf(Create::class, $operation);\n        $this->assertSame(['groups' => ['sylius']], $operation->getValidationContext());\n        $this->assertSame([\n            'validation_groups' => ['sylius'],\n            'data_class' => 'App\\Dummy',\n        ], $operation->getFormOptions());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_update');\n        $this->assertInstanceOf(Update::class, $operation);\n        $this->assertSame(['groups' => ['sylius']], $operation->getValidationContext());\n        $this->assertSame([\n            'validation_groups' => ['sylius'],\n            'data_class' => 'App\\Dummy',\n        ], $operation->getFormOptions());\n    }\n\n    public function testItCreatesResourceMetadataWithResourceName(): void\n    {\n        $this->resourceRegistry\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn(Metadata::fromAliasAndConfiguration('app.dummy', [\n                'driver' => 'dummy_driver',\n                'classes' => [\n                    'model' => 'App\\Dummy',\n                    'form' => 'App\\Form',\n                ],\n            ]));\n\n        $metadataCollection = $this->factory->create(DummyResourceWithName::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n        $this->assertCount(4, $operations);\n        $this->assertTrue($operations->has('app_book_create'));\n        $this->assertTrue($operations->has('app_book_update'));\n        $this->assertTrue($operations->has('app_book_index'));\n        $this->assertTrue($operations->has('app_book_show'));\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_book_create');\n        $this->assertSame('book', $operation->getResource()->getName());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_book_update');\n        $this->assertSame('book', $operation->getResource()->getName());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_book_index');\n        $this->assertSame('book', $operation->getResource()->getName());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_book_show');\n        $this->assertSame('book', $operation->getResource()->getName());\n    }\n\n    public function testItCreatesResourceMetadataWithResourcePluralName(): void\n    {\n        $this->resourceRegistry\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn(Metadata::fromAliasAndConfiguration('app.dummy', [\n                'driver' => 'dummy_driver',\n                'classes' => [\n                    'model' => 'App\\Dummy',\n                    'form' => 'App\\Form',\n                ],\n            ]));\n\n        $metadataCollection = $this->factory->create(DummyResourceWithPluralName::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n        $this->assertCount(4, $operations);\n        $this->assertTrue($operations->has('app_dummy_create'));\n        $this->assertTrue($operations->has('app_dummy_update'));\n        $this->assertTrue($operations->has('app_dummy_index'));\n        $this->assertTrue($operations->has('app_dummy_show'));\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_create');\n        $this->assertSame('books', $operation->getResource()->getPluralName());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_update');\n        $this->assertSame('books', $operation->getResource()->getPluralName());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_index');\n        $this->assertSame('books', $operation->getResource()->getPluralName());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_show');\n        $this->assertSame('books', $operation->getResource()->getPluralName());\n    }\n\n    public function testItCreatesResourceMetadataWithDefaultResponderOnHttpOperations(): void\n    {\n        $this->resourceRegistry\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn(Metadata::fromAliasAndConfiguration('app.dummy', [\n                'driver' => 'dummy_driver',\n                'classes' => [\n                    'model' => 'App\\Dummy',\n                    'form' => 'App\\Form',\n                ],\n            ]));\n\n        $metadataCollection = $this->factory->create(DummyResourceWithOperations::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n        $this->assertCount(4, $operations);\n        $this->assertTrue($operations->has('app_dummy_create'));\n        $this->assertTrue($operations->has('app_dummy_update'));\n        $this->assertTrue($operations->has('app_dummy_index'));\n        $this->assertTrue($operations->has('app_dummy_show'));\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_create');\n        $this->assertSame(Responder::class, $operation->getResponder());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_update');\n        $this->assertSame(Responder::class, $operation->getResponder());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_index');\n        $this->assertSame(Responder::class, $operation->getResponder());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_show');\n        $this->assertSame(Responder::class, $operation->getResponder());\n    }\n\n    public function testItCreatesResourceMetadataWithRoutePrefix(): void\n    {\n        $this->resourceRegistry\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn(Metadata::fromAliasAndConfiguration('app.dummy', [\n                'driver' => 'dummy_driver',\n                'classes' => [\n                    'model' => 'App\\Dummy',\n                    'form' => 'App\\Form',\n                ],\n            ]));\n\n        $metadataCollection = $this->factory->create(DummyResourceWithRoutePrefix::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n        $this->assertCount(4, $operations);\n        $this->assertTrue($operations->has('app_dummy_create'));\n        $this->assertTrue($operations->has('app_dummy_update'));\n        $this->assertTrue($operations->has('app_dummy_index'));\n        $this->assertTrue($operations->has('app_dummy_show'));\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_create');\n        $this->assertInstanceOf(Create::class, $operation);\n        $this->assertSame('/admin', $operation->getRoutePrefix());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_update');\n        $this->assertInstanceOf(Update::class, $operation);\n        $this->assertSame('/admin', $operation->getRoutePrefix());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_index');\n        $this->assertInstanceOf(Index::class, $operation);\n        $this->assertSame('/admin', $operation->getRoutePrefix());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_show');\n        $this->assertInstanceOf(Show::class, $operation);\n        $this->assertSame('/admin', $operation->getRoutePrefix());\n    }\n\n    public function testItCreatesResourceMetadataWithRouteCondition(): void\n    {\n        $this->resourceRegistry\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn(Metadata::fromAliasAndConfiguration('app.dummy', [\n                'driver' => 'dummy_driver',\n                'classes' => [\n                    'model' => 'App\\Dummy',\n                    'form' => 'App\\Form',\n                ],\n            ]));\n\n        $metadataCollection = $this->factory->create(DummyResourceWithRouteCondition::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_create');\n        $this->assertSame('custom_condition', $operation->getRouteCondition());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_update');\n        $this->assertSame('custom_condition', $operation->getRouteCondition());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_index');\n        $this->assertSame('custom_condition', $operation->getRouteCondition());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_show');\n        $this->assertSame('custom_condition', $operation->getRouteCondition());\n    }\n\n    public function testItCreatesResourceMetadataWithRouteRequirements(): void\n    {\n        $this->resourceRegistry\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn(Metadata::fromAliasAndConfiguration('app.dummy', [\n                'driver' => 'dummy_driver',\n            ]));\n\n        $metadataCollection = $this->factory->create(DummyResourceWithRouteRequirements::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_create');\n        $this->assertSame(['_locale' => 'en|fr|pl'], $operation->getRouteRequirements());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_update');\n        $this->assertSame(['_locale' => 'en|fr|pl'], $operation->getRouteRequirements());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_index');\n        $this->assertSame(['_locale' => 'en|fr|pl'], $operation->getRouteRequirements());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_show');\n        $this->assertSame(['_locale' => 'en|fr|pl', 'page' => '\\d+'], $operation->getRouteRequirements());\n    }\n\n    public function testItCreatesResourceMetadataWithRoutePriorities(): void\n    {\n        $this->resourceRegistry\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn(Metadata::fromAliasAndConfiguration('app.dummy', [\n                'driver' => 'dummy_driver',\n            ]));\n\n        $metadataCollection = $this->factory->create(DummyResourceWithRoutePriorities::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_create');\n        $this->assertSame(1, $operation->getRoutePriority());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_update');\n        $this->assertSame(1, $operation->getRoutePriority());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_index');\n        $this->assertSame(1, $operation->getRoutePriority());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_show');\n        $this->assertSame(-100, $operation->getRoutePriority());\n    }\n\n    public function testItCreatesResourceMetadataWithNormalizationContext(): void\n    {\n        $this->resourceRegistry\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn(Metadata::fromAliasAndConfiguration('app.dummy', [\n                'driver' => 'dummy_driver',\n                'classes' => [\n                    'model' => 'App\\Dummy',\n                    'form' => 'App\\Form',\n                ],\n            ]));\n\n        $metadataCollection = $this->factory->create(DummyResourceWithNormalizationContext::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n        $this->assertCount(4, $operations);\n        $this->assertTrue($operations->has('app_dummy_create'));\n        $this->assertTrue($operations->has('app_dummy_update'));\n        $this->assertTrue($operations->has('app_dummy_index'));\n        $this->assertTrue($operations->has('app_dummy_show'));\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_create');\n        $this->assertInstanceOf(Create::class, $operation);\n        $this->assertSame(['groups' => ['dummy:read']], $operation->getNormalizationContext());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_update');\n        $this->assertInstanceOf(Update::class, $operation);\n        $this->assertSame(['groups' => ['dummy:read']], $operation->getNormalizationContext());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_index');\n        $this->assertInstanceOf(Index::class, $operation);\n        $this->assertSame(['groups' => ['dummy:read']], $operation->getNormalizationContext());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_show');\n        $this->assertInstanceOf(Show::class, $operation);\n        $this->assertSame(['groups' => ['dummy:read']], $operation->getNormalizationContext());\n    }\n\n    public function testItCreatesResourceMetadataWithDenormalizationContext(): void\n    {\n        $this->resourceRegistry\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn(Metadata::fromAliasAndConfiguration('app.dummy', [\n                'driver' => 'dummy_driver',\n                'classes' => [\n                    'model' => 'App\\Dummy',\n                    'form' => 'App\\Form',\n                ],\n            ]));\n\n        $metadataCollection = $this->factory->create(DummyResourceWithDenormalizationContext::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n        $this->assertCount(4, $operations);\n        $this->assertTrue($operations->has('app_dummy_create'));\n        $this->assertTrue($operations->has('app_dummy_update'));\n        $this->assertTrue($operations->has('app_dummy_index'));\n        $this->assertTrue($operations->has('app_dummy_show'));\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_create');\n        $this->assertInstanceOf(Create::class, $operation);\n        $this->assertSame(['groups' => ['dummy:write']], $operation->getDenormalizationContext());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_update');\n        $this->assertInstanceOf(Update::class, $operation);\n        $this->assertSame(['groups' => ['dummy:write']], $operation->getDenormalizationContext());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_index');\n        $this->assertInstanceOf(Index::class, $operation);\n        $this->assertSame(['groups' => ['dummy:write']], $operation->getDenormalizationContext());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_show');\n        $this->assertInstanceOf(Show::class, $operation);\n        $this->assertSame(['groups' => ['dummy:write']], $operation->getDenormalizationContext());\n    }\n\n    public function testItCreatesResourceMetadataWithDefaultTwigContextFactory(): void\n    {\n        $this->resourceRegistry\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn(Metadata::fromAliasAndConfiguration('app.dummy', [\n                'driver' => 'dummy_driver',\n                'classes' => [\n                    'model' => 'App\\Dummy',\n                    'form' => 'App\\Form',\n                ],\n            ]));\n\n        $metadataCollection = $this->factory->create(DummyResourceWithOperations::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('app.dummy', $resource->getAlias());\n\n        $operations = $resource->getOperations();\n        $this->assertInstanceOf(Operations::class, $operations);\n        $this->assertCount(4, $operations);\n        $this->assertTrue($operations->has('app_dummy_create'));\n        $this->assertTrue($operations->has('app_dummy_update'));\n        $this->assertTrue($operations->has('app_dummy_index'));\n        $this->assertTrue($operations->has('app_dummy_show'));\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_create');\n        $this->assertInstanceOf(Create::class, $operation);\n        $this->assertSame('sylius.twig.context.factory.default', $operation->getTwigContextFactory());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_update');\n        $this->assertInstanceOf(Update::class, $operation);\n        $this->assertSame('sylius.twig.context.factory.default', $operation->getTwigContextFactory());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_index');\n        $this->assertInstanceOf(Index::class, $operation);\n        $this->assertSame('sylius.twig.context.factory.default', $operation->getTwigContextFactory());\n\n        $operation = $metadataCollection->getOperation('app.dummy', 'app_dummy_show');\n        $this->assertInstanceOf(Show::class, $operation);\n        $this->assertSame('sylius.twig.context.factory.default', $operation->getTwigContextFactory());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/Factory/CachedResourceMetadataCollectionFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Resource\\Factory;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Psr\\Cache\\CacheItemInterface;\nuse Psr\\Cache\\CacheItemPoolInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\CachedResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Symfony\\Component\\Cache\\Exception\\CacheException;\n\nfinal class CachedResourceMetadataCollectionFactoryTest extends TestCase\n{\n    private CacheItemPoolInterface|MockObject $cacheItemPool;\n\n    private ResourceMetadataCollectionFactoryInterface|MockObject $decorated;\n\n    protected function setUp(): void\n    {\n        $this->cacheItemPool = $this->createMock(CacheItemPoolInterface::class);\n        $this->decorated = $this->createMock(ResourceMetadataCollectionFactoryInterface::class);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $factory = new CachedResourceMetadataCollectionFactory(\n            $this->cacheItemPool,\n            $this->decorated,\n        );\n\n        $this->assertInstanceOf(CachedResourceMetadataCollectionFactory::class, $factory);\n    }\n\n    public function testItUsesDecoratedFactoryWhenCacheIsNotAvailable(): void\n    {\n        $cacheItem = $this->createMock(CacheItemInterface::class);\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n\n        $this->cacheItemPool->method('getItem')->willReturn($cacheItem);\n\n        $cacheItem->method('isHit')->willReturn(false);\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $cacheItem->expects($this->once())->method('set')->with((array) $resourceMetadataCollection)->willReturn($cacheItem);\n        $this->cacheItemPool->expects($this->once())->method('save')->with($cacheItem)->willReturn(true);\n\n        $factory = new CachedResourceMetadataCollectionFactory(\n            $this->cacheItemPool,\n            $this->decorated,\n        );\n\n        $this->assertSame($resourceMetadataCollection, $factory->create('App\\Resource'));\n    }\n\n    public function testItRetrievesCacheWhenItIsAvailable(): void\n    {\n        $cacheItem = $this->createMock(CacheItemInterface::class);\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n\n        $this->cacheItemPool->method('getItem')->willReturn($cacheItem);\n        $cacheItem->method('isHit')->willReturn(true);\n        $cacheItem->method('get')->willReturn($resourceMetadataCollection);\n\n        $factory = new CachedResourceMetadataCollectionFactory(\n            $this->cacheItemPool,\n            $this->decorated,\n        );\n\n        $result = $factory->create('App\\Resource');\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $result);\n    }\n\n    public function testItUsesLocalCacheWhenCachePoolIsNotAvailable(): void\n    {\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n\n        $this->cacheItemPool->method('getItem')->willThrowException(new CacheException());\n        $this->decorated->expects($this->once())->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $factory = new CachedResourceMetadataCollectionFactory(\n            $this->cacheItemPool,\n            $this->decorated,\n        );\n\n        $this->assertSame($resourceMetadataCollection, $factory->create('App\\Resource'));\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/Factory/EventShortNameResourceMetadataCollectionFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Resource\\Factory;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\ApplyStateMachineTransition;\nuse Sylius\\Resource\\Metadata\\BulkDelete;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\EventShortNameResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Show;\n\nfinal class EventShortNameResourceMetadataCollectionFactoryTest extends TestCase\n{\n    private ResourceMetadataCollectionFactoryInterface|MockObject $decorated;\n\n    private EventShortNameResourceMetadataCollectionFactory $factory;\n\n    protected function setUp(): void\n    {\n        $this->decorated = $this->createMock(ResourceMetadataCollectionFactoryInterface::class);\n        $this->factory = new EventShortNameResourceMetadataCollectionFactory($this->decorated);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(EventShortNameResourceMetadataCollectionFactory::class, $this->factory);\n    }\n\n    public function testItConfiguresDefaultEventShortNameOnOperations(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book', applicationName: 'app');\n\n        $create = (new Create(name: 'app_book_create'))->withResource($resource);\n        $show = (new Show(name: 'app_book_show'))->withResource($resource);\n        $applyStateMachineTransition = (new ApplyStateMachineTransition(name: 'app_book_publish', stateMachineTransition: 'publish'))->withResource($resource);\n        $bulkDelete = (new BulkDelete(name: 'app_book_bulk_delete'))->withResource($resource);\n\n        $resource = $resource->withOperations(new Operations([\n            $create->getName() => $create,\n            $show->getName() => $show,\n            $applyStateMachineTransition->getName() => $applyStateMachineTransition,\n            $bulkDelete->getName() => $bulkDelete,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $resourceMetadataCollection = $this->factory->create('App\\Resource');\n\n        $create = $resourceMetadataCollection->getOperation('app.book', 'app_book_create');\n        $this->assertSame('create', $create->getEventShortName());\n\n        $show = $resourceMetadataCollection->getOperation('app.book', 'app_book_show');\n        $this->assertSame('show', $show->getEventShortName());\n\n        $publish = $resourceMetadataCollection->getOperation('app.book', 'app_book_publish');\n        $this->assertSame('update', $publish->getEventShortName());\n\n        $bulkDelete = $resourceMetadataCollection->getOperation('app.book', 'app_book_bulk_delete');\n        $this->assertSame('delete', $bulkDelete->getEventShortName());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/Factory/FactoryResourceMetadataCollectionFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Resource\\Factory;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\FactoryResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nfinal class FactoryResourceMetadataCollectionFactoryTest extends TestCase\n{\n    private RegistryInterface|MockObject $resourceRegistry;\n\n    private ResourceMetadataCollectionFactoryInterface|MockObject $decorated;\n\n    private FactoryResourceMetadataCollectionFactory $factory;\n\n    protected function setUp(): void\n    {\n        $this->resourceRegistry = $this->createMock(RegistryInterface::class);\n        $this->decorated = $this->createMock(ResourceMetadataCollectionFactoryInterface::class);\n        $this->factory = new FactoryResourceMetadataCollectionFactory($this->resourceRegistry, $this->decorated);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(FactoryResourceMetadataCollectionFactory::class, $this->factory);\n    }\n\n    public function testItConfiguresFactoryIfOperationImplementsTheInterface(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book', applicationName: 'app');\n\n        $create = (new Create(name: 'app_book_create'))->withResource($resource);\n\n        $resource = $resource->withOperations(new Operations([\n            $create->getName() => $create,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $resourceConfiguration = $this->createMock(MetadataInterface::class);\n        $resourceConfiguration->method('getDriver')->willReturn('doctrine/orm');\n        $resourceConfiguration->method('getServiceId')->with('factory')->willReturn('app.factory.book');\n\n        $this->resourceRegistry->method('get')->with('app.book')->willReturn($resourceConfiguration);\n\n        $resourceMetadataCollection = $this->factory->create('App\\Resource');\n\n        $create = $resourceMetadataCollection->getOperation('app.book', 'app_book_create');\n        $this->assertSame('app.factory.book', $create->getFactory());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/Factory/MutatorResourceMetadataCollectionFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Resource\\Factory;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Mutator\\OperationMutatorCollection;\nuse Sylius\\Resource\\Metadata\\Mutator\\ResourceMutatorCollection;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\OperationMutatorInterface;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\MutatorResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\ResourceMutatorInterface;\n\nfinal class MutatorResourceMetadataCollectionFactoryTest extends TestCase\n{\n    public function testMutateResource(): void\n    {\n        $decorated = $this->createMock(ResourceMetadataCollectionFactoryInterface::class);\n        $resourceClass = \\stdClass::class;\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = (new ResourceMetadata())->withClass($resourceClass);\n\n        $resourceMutatorCollection = new ResourceMutatorCollection();\n        $resourceMutatorCollection->add($resourceClass, new DummyResourceMutator());\n\n        $customResourceMetadataCollectionFactory = new MutatorResourceMetadataCollectionFactory($resourceMutatorCollection, new OperationMutatorCollection(), $decorated);\n\n        $decorated->expects($this->once())->method('create')->with($resourceClass)->willReturn(\n            $resourceMetadataCollection,\n        );\n\n        $resourceMetadataCollection = $customResourceMetadataCollectionFactory->create($resourceClass);\n\n        $resource = $resourceMetadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame('custom_dummy', $resource->getName());\n    }\n\n    public function testMutateOperation(): void\n    {\n        $decorated = $this->createMock(ResourceMetadataCollectionFactoryInterface::class);\n        $resourceClass = \\stdClass::class;\n\n        $operations = new Operations();\n        $operations->add('app_dummy_index', new HttpOperation());\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = (new ResourceMetadata(alias: 'app.dummy'))->withClass($resourceClass)->withOperations($operations);\n\n        $operationMutatorCollection = new OperationMutatorCollection();\n        $operationMutatorCollection->add('app_dummy_index', new DummyOperationMutator());\n\n        $customResourceMetadataCollectionFactory = new MutatorResourceMetadataCollectionFactory(new ResourceMutatorCollection(), $operationMutatorCollection, $decorated);\n\n        $decorated->expects($this->once())->method('create')->with($resourceClass)->willReturn(\n            $resourceMetadataCollection,\n        );\n\n        $resourceMetadataCollection = $customResourceMetadataCollectionFactory->create($resourceClass);\n\n        $resource = $resourceMetadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertEquals('custom_dummy', $resourceMetadataCollection->getOperation('app.dummy', 'app_dummy_index')->getShortName());\n    }\n}\n\nfinal class DummyResourceMutator implements ResourceMutatorInterface\n{\n    public function __invoke(ResourceMetadata $resource): ResourceMetadata\n    {\n        return $resource->withName('custom_dummy');\n    }\n}\n\nfinal class DummyOperationMutator implements OperationMutatorInterface\n{\n    public function __invoke(Operation $operation): Operation\n    {\n        return $operation->withShortName('custom_dummy');\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/Factory/PhpFileResourceClassListFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Resource\\Factory;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Extractor\\PhpFileResourceExtractor;\nuse Sylius\\Resource\\Metadata\\Extractor\\ResourceExtractorInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\PhpFileResourceClassListFactory;\n\nfinal class PhpFileResourceClassListFactoryTest extends TestCase\n{\n    public function testCreateAResourceClassListForPhpConfigurationFiles(): void\n    {\n        $attributesResourceClassListFactory = new PhpFileResourceClassListFactory(\n            $this->getExtractor(),\n        );\n\n        $list = $attributesResourceClassListFactory->create();\n\n        $this->assertCount(1, $list->getIterator());\n        $this->assertContains(\\stdClass::class, $list->getIterator());\n    }\n\n    private function getExtractor(): ResourceExtractorInterface\n    {\n        return new PhpFileResourceExtractor([\n            __DIR__ . '/php/php_file_with_resource_class.php',\n            __DIR__ . '/php/php_file_without_resource_class.php',\n        ]);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/Factory/PhpFileResourceMetadataCollectionFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Resource\\Factory;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Extractor\\PhpFileResourceExtractor;\nuse Sylius\\Resource\\Metadata\\Metadata;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\PhpFileResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RouteName\\OperationRouteNameFactory;\n\nfinal class PhpFileResourceMetadataCollectionFactoryTest extends TestCase\n{\n    private PhpFileResourceMetadataCollectionFactory $factory;\n\n    private RegistryInterface $resourceRegistry;\n\n    protected function setUp(): void\n    {\n        $this->resourceRegistry = $this->createMock(RegistryInterface::class);\n        $this->factory = new PhpFileResourceMetadataCollectionFactory($this->resourceRegistry, new OperationRouteNameFactory(), new PhpFileResourceExtractor([__DIR__ . '/php/php_file_with_resource_class.php']));\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(PhpFileResourceMetadataCollectionFactory::class, $this->factory);\n    }\n\n    public function testItCreatesResourceMetadata(): void\n    {\n        $metadata = Metadata::fromAliasAndConfiguration('app.dummy', ['driver' => 'dummy_driver']);\n        $this->resourceRegistry->method('get')->willReturn($metadata);\n\n        $metadataCollection = $this->factory->create(\\stdClass::class);\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $metadataCollection);\n        $this->assertCount(1, $metadataCollection);\n\n        $resource = $metadataCollection->getIterator()->current();\n        $this->assertInstanceOf(ResourceMetadata::class, $resource);\n        $this->assertSame(\\stdClass::class, $resource->getClass());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/Factory/PluralNameResourceMetadataCollectionFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Resource\\Factory;\n\nuse PHPUnit\\Framework\\Attributes\\CoversClass;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Exception\\LogicException;\nuse Sylius\\Resource\\Metadata\\Inflector\\Inflector;\nuse Sylius\\Resource\\Metadata\\Metadata;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\PluralNameResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\n#[CoversClass(PluralNameResourceMetadataCollectionFactory::class)]\nfinal class PluralNameResourceMetadataCollectionFactoryTest extends TestCase\n{\n    private ResourceMetadataCollectionFactoryInterface&MockObject $decorated;\n\n    private RegistryInterface&MockObject $registry;\n\n    protected function setUp(): void\n    {\n        $this->decorated = $this->createMock(ResourceMetadataCollectionFactoryInterface::class);\n        $this->registry = $this->createMock(RegistryInterface::class);\n    }\n\n    public function testItConfiguresDefaultPluralNameOnResourcesWithRoutingBcLayerEnabled(): void\n    {\n        $factory = new PluralNameResourceMetadataCollectionFactory(decorated: $this->decorated, inflector: new Inflector(), resourceRegistry: $this->registry, routingBcLayerEnabled: true);\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book');\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n        $this->registry->method('get')->with('app.book')->willReturn(Metadata::fromAliasAndConfiguration('app.book', ['driver' => 'doctrine/orm']));\n\n        $resourceMetadataCollection = $factory->create('App\\Resource');\n        $resourceOutput = $resourceMetadataCollection[0];\n\n        $this->assertInstanceOf(ResourceMetadata::class, $resourceOutput);\n        $this->assertSame('books', $resourceOutput->getPluralName());\n    }\n\n    public function testItConfiguresDefaultPluralNameOnResourcesWithRoutingBcLayerDisabled(): void\n    {\n        $factory = new PluralNameResourceMetadataCollectionFactory(decorated: $this->decorated, inflector: new Inflector(), routingBcLayerEnabled: false);\n        $resource = new ResourceMetadata(name: 'book');\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $resourceMetadataCollection = $factory->create('App\\Resource');\n        $resourceOutput = $resourceMetadataCollection[0];\n\n        $this->assertInstanceOf(ResourceMetadata::class, $resourceOutput);\n        $this->assertSame('books', $resourceOutput->getPluralName());\n    }\n\n    public function testItThrowAnExceptionWithRoutingBcLayerEnabledWhenResourceRegistryIsNotPassedAsConstructorArguments(): void\n    {\n        $factory = new PluralNameResourceMetadataCollectionFactory(decorated: $this->decorated, inflector: new Inflector(), routingBcLayerEnabled: true);\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book');\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $this->expectException(LogicException::class);\n        $this->expectExceptionMessage(sprintf(\n            'Routing Bc-Layer is enabled, but the resource registry is not passed as constructor arguments of \"%s\" class.',\n            PluralNameResourceMetadataCollectionFactory::class,\n        ));\n\n        $factory->create('App\\Resource');\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/Factory/ProviderResourceMetadataCollectionFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Resource\\Factory;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Grid\\State\\RequestGridProvider;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ProviderResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Symfony\\Request\\State\\Provider;\n\nfinal class ProviderResourceMetadataCollectionFactoryTest extends TestCase\n{\n    private ResourceMetadataCollectionFactoryInterface|MockObject $decorated;\n\n    private ProviderResourceMetadataCollectionFactory $factory;\n\n    protected function setUp(): void\n    {\n        $this->decorated = $this->createMock(ResourceMetadataCollectionFactoryInterface::class);\n        $this->factory = new ProviderResourceMetadataCollectionFactory($this->decorated);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(ProviderResourceMetadataCollectionFactory::class, $this->factory);\n    }\n\n    public function testItCreatesResourceMetadataWithDefaultProviderOnHttpOperations(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book', applicationName: 'app');\n\n        $index = (new Index(name: 'app_book_index'))->withResource($resource);\n\n        $resource = $resource->withOperations(new Operations([\n            $index->getName() => $index,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $resourceMetadataCollection = $this->factory->create('App\\Resource');\n\n        $index = $resourceMetadataCollection->getOperation('app.book', 'app_book_index');\n        $this->assertSame(Provider::class, $index->getProvider());\n    }\n\n    public function testItConfiguresRequestGridProviderIfOperationHasAGrid(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book', applicationName: 'app');\n\n        $index = (new Index(name: 'app_book_index', grid: 'app_book'))->withResource($resource);\n\n        $resource = $resource->withOperations(new Operations([\n            $index->getName() => $index,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $resourceMetadataCollection = $this->factory->create('App\\Resource');\n\n        $index = $resourceMetadataCollection->getOperation('app.book', 'app_book_index');\n        $this->assertSame(RequestGridProvider::class, $index->getProvider());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/Factory/RedirectResourceMetadataCollectionFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Resource\\Factory;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Delete;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\RedirectResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RouteName\\OperationRouteNameFactory;\n\nfinal class RedirectResourceMetadataCollectionFactoryTest extends TestCase\n{\n    private ResourceMetadataCollectionFactoryInterface|MockObject $decorated;\n\n    private RedirectResourceMetadataCollectionFactory $factory;\n\n    protected function setUp(): void\n    {\n        $this->decorated = $this->createMock(ResourceMetadataCollectionFactoryInterface::class);\n        $this->factory = new RedirectResourceMetadataCollectionFactory(\n            new OperationRouteNameFactory(),\n            $this->decorated,\n        );\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(RedirectResourceMetadataCollectionFactory::class, $this->factory);\n    }\n\n    public function testItRedirectsCreateToShowIfRouteExists(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book', applicationName: 'app');\n\n        $create = (new Create(name: 'app_book_create'))->withResource($resource);\n        $show = (new Show(name: 'app_book_show'))->withResource($resource);\n\n        $resource = $resource->withOperations(new Operations([\n            $create->getName() => $create,\n            $show->getName() => $show,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $resourceMetadataCollection = $this->factory->create('App\\Resource');\n\n        $create = $resourceMetadataCollection->getOperation('app.book', 'app_book_create');\n        $this->assertSame('app_book_show', $create->getRedirectToRoute());\n    }\n\n    public function testItRedirectsCreateToIndexIfRouteExists(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book', applicationName: 'app');\n\n        $create = (new Create(name: 'app_book_create'))->withResource($resource);\n        $index = (new Index(name: 'app_book_index'))->withResource($resource);\n\n        $resource = $resource->withOperations(new Operations([\n            $create->getName() => $create,\n            $index->getName() => $index,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $resourceMetadataCollection = $this->factory->create('App\\Resource');\n\n        $create = $resourceMetadataCollection->getOperation('app.book', 'app_book_create');\n        $this->assertSame('app_book_index', $create->getRedirectToRoute());\n    }\n\n    public function testItRedirectsUpdateToShowIfRouteExists(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book', applicationName: 'app');\n\n        $update = (new Update(name: 'app_book_update'))->withResource($resource);\n        $show = (new Show(name: 'app_book_show'))->withResource($resource);\n\n        $resource = $resource->withOperations(new Operations([\n            $update->getName() => $update,\n            $show->getName() => $show,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $resourceMetadataCollection = $this->factory->create('App\\Resource');\n\n        $update = $resourceMetadataCollection->getOperation('app.book', 'app_book_update');\n        $this->assertSame('app_book_show', $update->getRedirectToRoute());\n    }\n\n    public function testItRedirectsUpdateToIndexIfRouteExists(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book', applicationName: 'app');\n\n        $update = (new Update(name: 'app_book_update'))->withResource($resource);\n        $index = (new Index(name: 'app_book_index'))->withResource($resource);\n\n        $resource = $resource->withOperations(new Operations([\n            $update->getName() => $update,\n            $index->getName() => $index,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $resourceMetadataCollection = $this->factory->create('App\\Resource');\n\n        $update = $resourceMetadataCollection->getOperation('app.book', 'app_book_update');\n        $this->assertSame('app_book_index', $update->getRedirectToRoute());\n    }\n\n    public function testItRedirectsDeleteToIndexIfRouteExists(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book', applicationName: 'app');\n\n        $delete = (new Delete(name: 'app_book_delete'))->withResource($resource);\n        $index = (new Show(name: 'app_book_index'))->withResource($resource);\n\n        $resource = $resource->withOperations(new Operations([\n            $delete->getName() => $delete,\n            $index->getName() => $index,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $resourceMetadataCollection = $this->factory->create('App\\Resource');\n\n        $delete = $resourceMetadataCollection->getOperation('app.book', 'app_book_delete');\n        $this->assertSame('app_book_index', $delete->getRedirectToRoute());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/Factory/StateMachineResourceMetadataCollectionFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Resource\\Factory;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\StateMachineResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\StateMachine\\State\\ApplyStateMachineTransitionProcessor;\n\ninterface MetadataWithStateMachineInterface extends MetadataInterface\n{\n    public function getStateMachineComponent(): ?string;\n}\n\nfinal class StateMachineResourceMetadataCollectionFactoryTest extends TestCase\n{\n    private RegistryInterface|MockObject $resourceRegistry;\n\n    private ResourceMetadataCollectionFactoryInterface|MockObject $decorated;\n\n    private StateMachineResourceMetadataCollectionFactory $factory;\n\n    protected function setUp(): void\n    {\n        $this->resourceRegistry = $this->createMock(RegistryInterface::class);\n        $this->decorated = $this->createMock(ResourceMetadataCollectionFactoryInterface::class);\n        $this->factory = new StateMachineResourceMetadataCollectionFactory($this->resourceRegistry, $this->decorated, null);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(StateMachineResourceMetadataCollectionFactory::class, $this->factory);\n    }\n\n    public function testItSetsTheDefaultStateMachineComponentFromSettings(): void\n    {\n        $this->factory = new StateMachineResourceMetadataCollectionFactory($this->resourceRegistry, $this->decorated, 'symfony');\n\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book', applicationName: 'app');\n        $create = (new Create(name: 'app_book_create'))->withResource($resource);\n        $resource = $resource->withOperations(new Operations([\n            $create->getName() => $create,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $resourceConfiguration = $this->createMock(MetadataWithStateMachineInterface::class);\n        $resourceConfiguration->method('getStateMachineComponent')->willReturn(null);\n        $this->resourceRegistry->method('get')->with('app.book')->willReturn($resourceConfiguration);\n\n        $resourceMetadataCollection = $this->factory->create('App\\Resource');\n\n        $create = $resourceMetadataCollection->getOperation('app.book', 'app_book_create');\n        $this->assertEquals('symfony', $create->getStateMachineComponent());\n    }\n\n    public function testItSetsTheDefaultStateMachineComponentFromResourceConfiguration(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book', applicationName: 'app');\n        $create = (new Create(name: 'app_book_create'))->withResource($resource);\n        $resource = $resource->withOperations(new Operations([\n            $create->getName() => $create,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $resourceConfiguration = $this->createMock(MetadataWithStateMachineInterface::class);\n        $resourceConfiguration->method('getStateMachineComponent')->willReturn('symfony');\n        $this->resourceRegistry->method('get')->with('app.book')->willReturn($resourceConfiguration);\n\n        $resourceMetadataCollection = $this->factory->create('App\\Resource');\n\n        $create = $resourceMetadataCollection->getOperation('app.book', 'app_book_create');\n        $this->assertEquals('symfony', $create->getStateMachineComponent());\n    }\n\n    public function testItSetsTheConfiguredStateMachineComponentFromOperation(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book', applicationName: 'app');\n        $create = (new Create(name: 'app_book_create', stateMachineComponent: 'winzou'))->withResource($resource);\n        $resource = $resource->withOperations(new Operations([\n            $create->getName() => $create,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $resourceConfiguration = $this->createMock(MetadataWithStateMachineInterface::class);\n        $resourceConfiguration->method('getStateMachineComponent')->willReturn('symfony');\n        $this->resourceRegistry->method('get')->with('app.book')->willReturn($resourceConfiguration);\n\n        $resourceMetadataCollection = $this->factory->create('App\\Resource');\n\n        $create = $resourceMetadataCollection->getOperation('app.book', 'app_book_create');\n        $this->assertEquals('winzou', $create->getStateMachineComponent());\n    }\n\n    public function testItConfiguresApplyStateMachineTransitionProcessorIfOperationHasATransition(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book', applicationName: 'app');\n        $create = (new Create(name: 'app_book_create', stateMachineTransition: 'publish'))->withResource($resource);\n        $resource = $resource->withOperations(new Operations([\n            $create->getName() => $create,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $resourceConfiguration = $this->createMock(MetadataWithStateMachineInterface::class);\n        $resourceConfiguration->method('getStateMachineComponent')->willReturn('symfony');\n        $this->resourceRegistry->method('get')->with('app.book')->willReturn($resourceConfiguration);\n\n        $resourceMetadataCollection = $this->factory->create('App\\Resource');\n\n        $create = $resourceMetadataCollection->getOperation('app.book', 'app_book_create');\n        $this->assertEquals(ApplyStateMachineTransitionProcessor::class, $create->getProcessor());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/Factory/TemplatesDirResourceMetadataCollectionFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Resource\\Factory;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\TemplatesDirResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Show;\n\nfinal class TemplatesDirResourceMetadataCollectionFactoryTest extends TestCase\n{\n    private ResourceMetadataCollectionFactoryInterface|MockObject $decorated;\n\n    private TemplatesDirResourceMetadataCollectionFactory $factory;\n\n    protected function setUp(): void\n    {\n        $this->decorated = $this->createMock(ResourceMetadataCollectionFactoryInterface::class);\n        $this->factory = new TemplatesDirResourceMetadataCollectionFactory($this->decorated);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(TemplatesDirResourceMetadataCollectionFactory::class, $this->factory);\n    }\n\n    public function testItUsesDefaultTemplatesDir(): void\n    {\n        $this->factory = new TemplatesDirResourceMetadataCollectionFactory($this->decorated, ['default_templates_dir' => 'crud']);\n\n        $resource = new ResourceMetadata(alias: 'app.book');\n\n        $create = (new Create(name: 'app_book_create'))->withResource($resource);\n        $show = (new Show(name: 'app_book_show'))->withResource($resource);\n\n        $resource = $resource->withOperations(new Operations([\n            $create->getName() => $create,\n            $show->getName() => $show,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $result = $this->factory->create('App\\Resource');\n\n        $create = $result->getOperation('app.book', 'app_book_create');\n        $this->assertSame('crud/create.html.twig', $create->getTemplate());\n\n        $show = $result->getOperation('app.book', 'app_book_show');\n        $this->assertSame('crud/show.html.twig', $show->getTemplate());\n    }\n\n    public function testItUsesResourceTemplatesDir(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book', templatesDir: 'book');\n\n        $create = (new Create(name: 'app_book_create'))->withResource($resource);\n        $show = (new Show(name: 'app_book_show'))->withResource($resource);\n\n        $resource = $resource->withOperations(new Operations([\n            $create->getName() => $create,\n            $show->getName() => $show,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $result = $this->factory->create('App\\Resource');\n\n        $create = $result->getOperation('app.book', 'app_book_create');\n        $this->assertSame('book/create.html.twig', $create->getTemplate());\n\n        $show = $result->getOperation('app.book', 'app_book_show');\n        $this->assertSame('book/show.html.twig', $show->getTemplate());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/Factory/VarsResourceMetadataCollectionFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Resource\\Factory;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\VarsResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\ArgumentParserInterface;\n\nfinal class VarsResourceMetadataCollectionFactoryTest extends TestCase\n{\n    private ResourceMetadataCollectionFactoryInterface|MockObject $decorated;\n\n    private VarsResourceMetadataCollectionFactory $factory;\n\n    private ArgumentParserInterface|MockObject $argumentParser;\n\n    protected function setUp(): void\n    {\n        $this->decorated = $this->createMock(ResourceMetadataCollectionFactoryInterface::class);\n        $this->argumentParser = $this->createMock(ArgumentParserInterface::class);\n        $this->factory = new VarsResourceMetadataCollectionFactory($this->decorated, $this->argumentParser);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(VarsResourceMetadataCollectionFactory::class, $this->factory);\n    }\n\n    public function testItMergesResourceVarsWithOperationVars(): void\n    {\n        $resource = new ResourceMetadata(\n            alias: 'app.book',\n            name: 'book',\n            applicationName: 'app',\n            vars: ['header' => 'Library', 'subheader' => 'Managing your library'],\n        );\n\n        $create = (new Create(name: 'app_book_create', vars: ['subheader' => 'Adding a new book']))->withResource($resource);\n        $show = (new Show(name: 'app_book_show'))->withResource($resource);\n\n        $resource = $resource->withOperations(new Operations([\n            $create->getName() => $create,\n            $show->getName() => $show,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $resourceMetadataCollection = $this->factory->create('App\\Resource');\n\n        $create = $resourceMetadataCollection->getOperation('app.book', 'app_book_create');\n        $this->assertSame([\n            'header' => 'Library',\n            'subheader' => 'Adding a new book',\n        ], $create->getVars());\n    }\n\n    public function testItDoesNothingWhenResourceHasNoVars(): void\n    {\n        $resource = new ResourceMetadata(\n            alias: 'app.book',\n            name: 'book',\n            applicationName: 'app',\n        );\n\n        $create = (new Create(name: 'app_book_create'))->withResource($resource);\n        $show = (new Show(name: 'app_book_show'))->withResource($resource);\n\n        $resource = $resource->withOperations(new Operations([\n            $create->getName() => $create,\n            $show->getName() => $show,\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n        $resourceMetadataCollection[] = $resource;\n\n        $this->decorated->method('create')->with('App\\Resource')->willReturn($resourceMetadataCollection);\n\n        $resourceMetadataCollection = $this->factory->create('App\\Resource');\n\n        $create = $resourceMetadataCollection->getOperation('app.book', 'app_book_create');\n        $this->assertNull($create->getVars());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/Factory/php/php_file_with_resource_class.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nreturn (new ResourceMetadata(class: \\stdClass::class))\n    ->withOperations(new Operations([\n        new Create(),\n    ]));\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/Factory/php/php_file_without_resource_class.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nreturn new ResourceMetadata();\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/ResourceClassListTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Resource;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceClassList;\n\nfinal class ResourceClassListTest extends TestCase\n{\n    public function testItIsAnIteratorAggregate(): void\n    {\n        $list = new ResourceClassList();\n\n        $this->assertInstanceOf(\\IteratorAggregate::class, $list);\n    }\n\n    public function testItIsCountable(): void\n    {\n        $list = new ResourceClassList();\n\n        $this->assertInstanceOf(\\Countable::class, $list);\n    }\n\n    public function testItIsAListOfResourceClassNames(): void\n    {\n        $list = new ResourceClassList(['first_resource', 'second_resource']);\n\n        $this->assertCount(2, $list);\n        $this->assertEquals('first_resource', $list->getIterator()[0]);\n        $this->assertEquals('second_resource', $list->getIterator()[1]);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/Resource/ResourceMetadataCollectionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata\\Resource;\n\nuse PHPUnit\\Framework\\TestCase;\nuse RuntimeException;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\n\nfinal class ResourceMetadataCollectionTest extends TestCase\n{\n    private ResourceMetadataCollection $collection;\n\n    protected function setUp(): void\n    {\n        $resourceMetadata = (new ResourceMetadata('app.dummy'))->withOperations(\n            new Operations([\n                'app_dummy_index' => new Index(),\n                'app_dummy_create' => new Create(),\n            ]),\n        );\n\n        $this->collection = new ResourceMetadataCollection([$resourceMetadata]);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(ResourceMetadataCollection::class, $this->collection);\n    }\n\n    public function testItCanGetAResourceOperation(): void\n    {\n        $operation = $this->collection->getOperation('app.dummy', 'app_dummy_index');\n        $this->assertInstanceOf(Index::class, $operation);\n    }\n\n    public function testItThrowsAnExceptionWhenOperationWasNotFound(): void\n    {\n        $this->expectException(RuntimeException::class);\n        $this->expectExceptionMessage('Operation \"app_dummy_not_found\" for \"app.dummy\" resource was not found.');\n\n        $this->collection->getOperation('app.dummy', 'app_dummy_not_found');\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/ResourceMetadataTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Update;\n\nfinal class ResourceMetadataTest extends TestCase\n{\n    private ResourceMetadata $resourceMetadata;\n\n    protected function setUp(): void\n    {\n        $this->resourceMetadata = new ResourceMetadata();\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(ResourceMetadata::class, $this->resourceMetadata);\n    }\n\n    public function testItHasNoAliasByDefault(): void\n    {\n        $this->assertNull($this->resourceMetadata->getAlias());\n    }\n\n    public function testItCouldHaveAnAlias(): void\n    {\n        $this->resourceMetadata = $this->resourceMetadata->withAlias('app.book');\n        $this->assertSame('app.book', $this->resourceMetadata->getAlias());\n    }\n\n    public function testItHasNoSectionByDefault(): void\n    {\n        $this->assertNull($this->resourceMetadata->getSection());\n    }\n\n    public function testItCouldHaveASection(): void\n    {\n        $this->resourceMetadata = $this->resourceMetadata->withSection('admin');\n        $this->assertSame('admin', $this->resourceMetadata->getSection());\n    }\n\n    public function testItHasNoNameByDefault(): void\n    {\n        $this->assertNull($this->resourceMetadata->getName());\n    }\n\n    public function testItCouldHaveAName(): void\n    {\n        $this->resourceMetadata = $this->resourceMetadata->withName('book');\n        $this->assertSame('book', $this->resourceMetadata->getName());\n    }\n\n    public function testItHasNoApplicationNameByDefault(): void\n    {\n        $this->assertNull($this->resourceMetadata->getApplicationName());\n    }\n\n    public function testItCouldHaveAnApplicationName(): void\n    {\n        $this->resourceMetadata = $this->resourceMetadata->withApplicationName('app');\n        $this->assertSame('app', $this->resourceMetadata->getApplicationName());\n    }\n\n    public function testItHasNoOperationsByDefault(): void\n    {\n        $this->assertNull($this->resourceMetadata->getOperations());\n    }\n\n    public function testItCouldHaveOperations(): void\n    {\n        $operations = new Operations();\n        $this->resourceMetadata = $this->resourceMetadata->withOperations($operations);\n        $this->assertSame($operations, $this->resourceMetadata->getOperations());\n    }\n\n    public function testItCanBeConstructedWithAnAlias(): void\n    {\n        $this->resourceMetadata = new ResourceMetadata('app.book');\n        $this->assertSame('app.book', $this->resourceMetadata->getAlias());\n    }\n\n    public function testItCanBeConstructedWithASection(): void\n    {\n        $this->resourceMetadata = new ResourceMetadata(null, 'admin');\n        $this->assertSame('admin', $this->resourceMetadata->getSection());\n    }\n\n    public function testItCanBeConstructedWithAName(): void\n    {\n        $this->resourceMetadata = new ResourceMetadata(name: 'book');\n        $this->assertSame('book', $this->resourceMetadata->getName());\n    }\n\n    public function testItCanBeConstructedWithAnApplicationName(): void\n    {\n        $this->resourceMetadata = new ResourceMetadata(applicationName: 'app');\n        $this->assertSame('app', $this->resourceMetadata->getApplicationName());\n    }\n\n    public function testItCanBeConstructedWithAFormType(): void\n    {\n        $this->resourceMetadata = new ResourceMetadata(formType: 'App\\Form\\DummyType');\n        $this->assertSame('App\\Form\\DummyType', $this->resourceMetadata->getFormType());\n    }\n\n    public function testItCanBeConstructedWithATemplatesDir(): void\n    {\n        $this->resourceMetadata = new ResourceMetadata(templatesDir: 'book');\n        $this->assertSame('book', $this->resourceMetadata->getTemplatesDir());\n    }\n\n    public function testItCanBeConstructedWithARoutePrefix(): void\n    {\n        $this->resourceMetadata = new ResourceMetadata(routePrefix: '/admin');\n        $this->assertSame('/admin', $this->resourceMetadata->getRoutePrefix());\n    }\n\n    public function testItCanBeConstructedWithAPluralName(): void\n    {\n        $this->resourceMetadata = new ResourceMetadata(pluralName: 'books');\n        $this->assertSame('books', $this->resourceMetadata->getPluralName());\n    }\n\n    public function testItCanBeConstructedWithAnIdentifier(): void\n    {\n        $this->resourceMetadata = new ResourceMetadata(identifier: 'code');\n        $this->assertSame('code', $this->resourceMetadata->getIdentifier());\n    }\n\n    public function testItCanBeConstructedWithANormalizationContext(): void\n    {\n        $this->resourceMetadata = new ResourceMetadata(\n            normalizationContext: ['groups' => ['dummy:read']],\n        );\n        $this->assertSame(['groups' => ['dummy:read']], $this->resourceMetadata->getNormalizationContext());\n    }\n\n    public function testItCanBeConstructedWithADenormalizationContext(): void\n    {\n        $this->resourceMetadata = new ResourceMetadata(\n            denormalizationContext: ['groups' => ['dummy:write']],\n        );\n        $this->assertSame(['groups' => ['dummy:write']], $this->resourceMetadata->getDenormalizationContext());\n    }\n\n    public function testItCanBeConstructedWithAValidationContext(): void\n    {\n        $this->resourceMetadata = new ResourceMetadata(\n            validationContext: ['groups' => ['sylius']],\n        );\n        $this->assertSame(['groups' => ['sylius']], $this->resourceMetadata->getValidationContext());\n    }\n\n    public function testItCanBeConstructedWithAClass(): void\n    {\n        $this->resourceMetadata = new ResourceMetadata(\n            class: 'App\\Resource',\n        );\n        $this->assertSame('App\\Resource', $this->resourceMetadata->getClass());\n    }\n\n    public function testItCanBeConstructedWithADriver(): void\n    {\n        $this->resourceMetadata = new ResourceMetadata(\n            driver: 'doctrine/orm',\n        );\n        $this->assertSame('doctrine/orm', $this->resourceMetadata->getDriver());\n    }\n\n    public function testItCanBeConstructedWithVars(): void\n    {\n        $this->resourceMetadata = new ResourceMetadata(\n            vars: ['subheader' => 'Managing your library'],\n        );\n        $this->assertSame(['subheader' => 'Managing your library'], $this->resourceMetadata->getVars());\n    }\n\n    public function testItCanBeConstructedWithOperations(): void\n    {\n        $operations = [new Create(), new Update()];\n        $this->resourceMetadata = new ResourceMetadata(\n            operations: $operations,\n        );\n        $this->assertCount(2, $this->resourceMetadata->getOperations());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/ShowTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\ShowOperationInterface;\n\nfinal class ShowTest extends TestCase\n{\n    private Show $show;\n\n    protected function setUp(): void\n    {\n        $this->show = new Show();\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(Show::class, $this->show);\n    }\n\n    public function testItIsAnOperation(): void\n    {\n        $this->assertInstanceOf(Operation::class, $this->show);\n    }\n\n    public function testItImplementsShowOperationInterface(): void\n    {\n        $this->assertInstanceOf(ShowOperationInterface::class, $this->show);\n    }\n\n    public function testItHasNoResourceByDefault(): void\n    {\n        $this->assertNull($this->show->getResource());\n    }\n\n    public function testItCouldHaveAResource(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book');\n\n        $this->show = $this->show->withResource($resource);\n        $this->assertSame($resource, $this->show->getResource());\n    }\n\n    public function testItHasShowShortNameByDefault(): void\n    {\n        $this->assertSame('show', $this->show->getShortName());\n    }\n\n    public function testItHasGetMethodsByDefault(): void\n    {\n        $this->assertSame(['GET'], $this->show->getMethods());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Metadata/UpdateTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Metadata;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Update;\nuse Sylius\\Resource\\Metadata\\UpdateOperationInterface;\n\nfinal class UpdateTest extends TestCase\n{\n    private Update $update;\n\n    protected function setUp(): void\n    {\n        $this->update = new Update();\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(Update::class, $this->update);\n    }\n\n    public function testItIsAnOperation(): void\n    {\n        $this->assertInstanceOf(Operation::class, $this->update);\n    }\n\n    public function testItImplementsUpdateOperationInterface(): void\n    {\n        $this->assertInstanceOf(UpdateOperationInterface::class, $this->update);\n    }\n\n    public function testItHasNoResourceByDefault(): void\n    {\n        $this->assertNull($this->update->getResource());\n    }\n\n    public function testItCouldHaveAResource(): void\n    {\n        $resource = new ResourceMetadata(alias: 'app.book');\n\n        $this->update = $this->update->withResource($resource);\n        $this->assertSame($resource, $this->update->getResource());\n    }\n\n    public function testItHasUpdateNameByDefault(): void\n    {\n        $this->assertSame('update', $this->update->getShortName());\n    }\n\n    public function testItHasGetAndPutMethodsByDefault(): void\n    {\n        $this->assertSame(['GET', 'PUT', 'POST'], $this->update->getMethods());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Model/AbstractTranslationTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Model;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Model\\AbstractTranslation;\nuse Sylius\\Resource\\Model\\TranslatableInterface;\nuse Sylius\\Resource\\Model\\TranslationInterface;\n\nfinal class AbstractTranslationTest extends TestCase\n{\n    private AbstractTranslation $translation;\n\n    protected function setUp(): void\n    {\n        $this->translation = new ConcreteTranslation();\n    }\n\n    public function testItIsATranslation(): void\n    {\n        $this->assertInstanceOf(TranslationInterface::class, $this->translation);\n    }\n\n    public function testItsTranslatableIsMutable(): void\n    {\n        $translatable = $this->createMock(TranslatableInterface::class);\n\n        $this->translation->setTranslatable($translatable);\n        $this->assertSame($translatable, $this->translation->getTranslatable());\n    }\n\n    public function testItsDetachesFromItsTranslatableCorrectly(): void\n    {\n        $translatable1 = $this->createMock(TranslatableInterface::class);\n        $translatable2 = $this->createMock(TranslatableInterface::class);\n\n        $translatable1->expects($this->once())->method('addTranslation')->with($this->isInstanceOf(AbstractTranslation::class));\n        $this->translation->setTranslatable($translatable1);\n\n        $translatable1->expects($this->once())->method('removeTranslation')->with($this->isInstanceOf(AbstractTranslation::class));\n        $translatable2->expects($this->once())->method('addTranslation')->with($this->isInstanceOf(AbstractTranslation::class));\n        $this->translation->setTranslatable($translatable2);\n    }\n\n    public function testItsLocaleIsMutable(): void\n    {\n        $this->translation->setLocale('en');\n        $this->assertSame('en', $this->translation->getLocale());\n    }\n}\n\nclass ConcreteTranslation extends AbstractTranslation\n{\n}\n"
  },
  {
    "path": "src/Component/tests/Reflection/CallableReflectionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Reflection;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\RepositoryWithCallables;\nuse Sylius\\Resource\\Reflection\\CallableReflection;\n\nfinal class CallableReflectionTest extends TestCase\n{\n    public function testItIsInitializable(): void\n    {\n        $callableReflection = new CallableReflection();\n        $this->assertInstanceOf(CallableReflection::class, $callableReflection);\n    }\n\n    public function testItReflectsAnArrayCallable(): void\n    {\n        $reflection = CallableReflection::from([RepositoryWithCallables::class, 'find']);\n        $this->assertInstanceOf(\\ReflectionFunctionAbstract::class, $reflection);\n    }\n\n    public function testItReflectsAClosureCallable(): void\n    {\n        $reflection = CallableReflection::from(fn (): array => []);\n        $this->assertInstanceOf(\\ReflectionFunctionAbstract::class, $reflection);\n    }\n\n    public function testItReflectsAStringCallable(): void\n    {\n        $reflection = CallableReflection::from('Sylius\\Component\\Resource\\Tests\\Dummy\\RepositoryWithCallables::find');\n        $this->assertInstanceOf(\\ReflectionFunctionAbstract::class, $reflection);\n    }\n\n    public function testItReflectsAnInvokableCallable(): void\n    {\n        $reflection = CallableReflection::from(new RepositoryWithCallables());\n        $this->assertInstanceOf(\\ReflectionFunctionAbstract::class, $reflection);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Reflection/Filter/FunctionArgumentsFilterTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Reflection\\Filter;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\RepositoryWithCallables;\nuse Sylius\\Resource\\Reflection\\CallableReflection;\nuse Sylius\\Resource\\Reflection\\Filter\\FunctionArgumentsFilter;\n\nfinal class FunctionArgumentsFilterTest extends TestCase\n{\n    private FunctionArgumentsFilter $functionArgumentsFilter;\n\n    protected function setUp(): void\n    {\n        $this->functionArgumentsFilter = new FunctionArgumentsFilter();\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(FunctionArgumentsFilter::class, $this->functionArgumentsFilter);\n    }\n\n    public function testItFiltersMatchingArguments(): void\n    {\n        $callable = [RepositoryWithCallables::class, 'find'];\n        $reflector = CallableReflection::from($callable);\n\n        $result = $this->functionArgumentsFilter->filter(\n            $reflector,\n            [\n                'id' => 'my_id',\n                'foo' => 'fighters',\n            ],\n        );\n\n        $this->assertSame(['id' => 'my_id'], $result);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Reflection/ReflectionClassRecursiveIteratorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Reflection;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Reflection\\ReflectionClassRecursiveIterator;\n\nfinal class ReflectionClassRecursiveIteratorTest extends TestCase\n{\n    private string $tmpDir;\n\n    protected function setUp(): void\n    {\n        parent::setUp();\n\n        // Create a temporary directory for test PHP files\n        $this->tmpDir = sys_get_temp_dir() . '/reflection_iterator_' . uniqid('', true);\n        mkdir($this->tmpDir, 0777, true);\n    }\n\n    protected function tearDown(): void\n    {\n        $this->removeDirectory($this->tmpDir);\n\n        parent::tearDown();\n    }\n\n    public function testItReturnsReflectionClassesFromGivenDirectories(): void\n    {\n        $this->createPhpFile(\n            $this->tmpDir . '/Foo.php',\n            <<<'PHP'\n            <?php\n\n            namespace Test\\Fixtures;\n\n            final class Foo\n            {\n            }\n            PHP\n        );\n\n        $this->createPhpFile(\n            $this->tmpDir . '/Bar.php',\n            <<<'PHP'\n            <?php\n\n            namespace Test\\Fixtures;\n\n            interface Bar\n            {\n            }\n            PHP\n        );\n\n        $reflections = ReflectionClassRecursiveIterator::getReflectionClassesFromDirectories([\n            $this->tmpDir,\n        ]);\n\n        self::assertArrayHasKey('Test\\\\Fixtures\\\\Foo', $reflections);\n        self::assertArrayHasKey('Test\\\\Fixtures\\\\Bar', $reflections);\n\n        self::assertInstanceOf(\\ReflectionClass::class, $reflections['Test\\\\Fixtures\\\\Foo']);\n        self::assertInstanceOf(\\ReflectionClass::class, $reflections['Test\\\\Fixtures\\\\Bar']);\n\n        self::assertSame(\n            realpath($this->tmpDir . '/Foo.php'),\n            $reflections['Test\\\\Fixtures\\\\Foo']->getFileName(),\n        );\n    }\n\n    public function testItUsesLocalCacheForSameDirectories(): void\n    {\n        $this->createPhpFile(\n            $this->tmpDir . '/Cached.php',\n            <<<'PHP'\n            <?php\n\n            namespace Test\\Fixtures;\n\n            final class Cached\n            {\n            }\n            PHP\n        );\n\n        $firstCall = ReflectionClassRecursiveIterator::getReflectionClassesFromDirectories([\n            $this->tmpDir,\n        ]);\n\n        $secondCall = ReflectionClassRecursiveIterator::getReflectionClassesFromDirectories([\n            $this->tmpDir,\n        ]);\n\n        // Same array instance returned from cache\n        self::assertSame($firstCall, $secondCall);\n        self::assertArrayHasKey('Test\\\\Fixtures\\\\Cached', $secondCall);\n    }\n\n    public function testItIgnoresInvalidPhpFiles(): void\n    {\n        $this->createPhpFile(\n            $this->tmpDir . '/Invalid.php',\n            <<<'PHP'\n            <?php\n\n            // This file is intentionally invalid\n            class Invalid extends UnknownParent\n            {\n            }\n            PHP\n        );\n\n        $reflections = ReflectionClassRecursiveIterator::getReflectionClassesFromDirectories([\n            $this->tmpDir,\n        ]);\n\n        self::assertSame([], $reflections);\n    }\n\n    public function testItOnlyIncludesFilesMatchingIgnoreRegex(): void\n    {\n        $this->createPhpFile(\n            $this->tmpDir . '/IncludedOne.php',\n            <<<'PHP'\n        <?php\n\n        namespace Test\\Fixtures;\n\n        final class IncludedOne\n        {\n        }\n        PHP\n        );\n\n        $this->createPhpFile(\n            $this->tmpDir . '/Excluded.php',\n            <<<'PHP'\n        <?php\n\n        namespace Test\\Fixtures;\n\n        final class Excluded\n        {\n        }\n        PHP\n        );\n\n        $reflections = ReflectionClassRecursiveIterator::getReflectionClassesFromDirectories(\n            [$this->tmpDir],\n            '.*Included',\n        );\n\n        self::assertArrayHasKey('Test\\\\Fixtures\\\\IncludedOne', $reflections);\n        self::assertArrayNotHasKey('Test\\\\Fixtures\\\\Excluded', $reflections);\n    }\n\n    private function createPhpFile(string $path, string $contents): void\n    {\n        file_put_contents($path, $contents);\n    }\n\n    private function removeDirectory(string $directory): void\n    {\n        if (!is_dir($directory)) {\n            return;\n        }\n\n        $files = new \\RecursiveIteratorIterator(\n            new \\RecursiveDirectoryIterator($directory, \\FilesystemIterator::SKIP_DOTS),\n            \\RecursiveIteratorIterator::CHILD_FIRST,\n        );\n\n        foreach ($files as $file) {\n            $file->isDir() ? rmdir($file->getRealPath()) : unlink($file->getRealPath());\n        }\n\n        rmdir($directory);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/State/FactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\State;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Factory\\FactoryInterface;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\State\\Factory;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\ArgumentParserInterface;\n\nfinal class FactoryTest extends TestCase\n{\n    private Factory $factory;\n\n    private ContainerInterface|MockObject $locator;\n\n    private ArgumentParserInterface|MockObject $argumentParser;\n\n    protected function setUp(): void\n    {\n        $this->locator = $this->createMock(ContainerInterface::class);\n        $this->argumentParser = $this->createMock(ArgumentParserInterface::class);\n        $this->factory = new Factory($this->locator, $this->argumentParser);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(Factory::class, $this->factory);\n    }\n\n    public function testItCallsFactoryFromOperationAsCallable(): void\n    {\n        $operation = new Create(factory: [FactoryCallable::class, 'create']);\n        $result = $this->factory->create($operation, new Context());\n\n        $this->assertInstanceOf(\\stdClass::class, $result);\n    }\n\n    public function testItCallsFactoryWithArgumentsFromOperationAsCallable(): void\n    {\n        $operation = new Create(factory: [FactoryCallable::class, 'create'], factoryArguments: ['userId' => 'user.getUserIdentifier()']);\n        $this->argumentParser->expects($this->once())\n            ->method('parseExpression')\n            ->with('user.getUserIdentifier()')\n            ->willReturn('51353e91-5295-4876-a994-cae4b3ff3a7c');\n\n        $result = $this->factory->create($operation, new Context());\n\n        $this->assertInstanceOf(\\stdClass::class, $result);\n        $this->assertEquals('51353e91-5295-4876-a994-cae4b3ff3a7c', $result->userId);\n    }\n\n    public function testItCallsFactoryWithExpressionLanguagePrefixedArgumentsFromOperationAsCallable(): void\n    {\n        $operation = new Create(factory: [FactoryCallable::class, 'create'], factoryArguments: ['userId' => '@=user.getUserIdentifier()']);\n        $this->argumentParser->expects($this->once())\n            ->method('parseExpression')\n            ->with('user.getUserIdentifier()')\n            ->willReturn('51353e91-5295-4876-a994-cae4b3ff3a7c');\n\n        $result = $this->factory->create($operation, new Context());\n\n        $this->assertInstanceOf(\\stdClass::class, $result);\n        $this->assertEquals('51353e91-5295-4876-a994-cae4b3ff3a7c', $result->userId);\n    }\n\n    public function testItCallsFactoryFromOperationAsString(): void\n    {\n        $factory = $this->createMock(FactoryInterface::class);\n        $operation = new Create(name: 'app_dummy_create', factory: get_class($factory), factoryMethod: 'createNew');\n        $data = new \\stdClass();\n\n        $this->locator->expects($this->once())\n            ->method('has')\n            ->with(get_class($factory))\n            ->willReturn(true);\n        $this->locator->expects($this->once())\n            ->method('get')\n            ->with(get_class($factory))\n            ->willReturn($factory);\n        $factory->expects($this->once())\n            ->method('createNew')\n            ->willReturn($data);\n\n        $result = $this->factory->create($operation, new Context());\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItThrowsExceptionWhenFactoryIsNotFoundOnLocator(): void\n    {\n        $factory = $this->createMock(FactoryInterface::class);\n        $operation = new Create(name: 'app_dummy_create', factory: get_class($factory), factoryMethod: 'createNew');\n\n        $this->locator->expects($this->once())\n            ->method('has')\n            ->with(get_class($factory))\n            ->willReturn(false);\n\n        $this->expectException(\\RuntimeException::class);\n        $this->expectExceptionMessage(sprintf('Factory \"%s\" not found on operation \"app_dummy_create\"', get_class($factory)));\n\n        $this->factory->create($operation, new Context());\n    }\n\n    public function testItThrowsExceptionWhenFactoryMethodIsNull(): void\n    {\n        $factory = $this->createMock(FactoryInterface::class);\n        $operation = new Create(name: 'app_dummy_create', factory: get_class($factory));\n\n        $this->locator->expects($this->once())\n            ->method('has')\n            ->with(get_class($factory))\n            ->willReturn(true);\n        $this->locator->expects($this->once())\n            ->method('get')\n            ->with(get_class($factory))\n            ->willReturn($factory);\n\n        $this->expectException(\\RuntimeException::class);\n        $this->expectExceptionMessage('No Factory method was configured on operation \"app_dummy_create\"');\n\n        $this->factory->create($operation, new Context());\n    }\n}\n\nfinal class FactoryCallable\n{\n    public static function create(?string $userId = null): object\n    {\n        $object = new \\stdClass();\n        $object->userId = $userId;\n\n        return $object;\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/State/Processor/BulkAwareProcessorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\State\\Processor;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Api\\Delete;\nuse Sylius\\Resource\\Metadata\\BulkDelete;\nuse Sylius\\Resource\\State\\Processor\\BulkAwareProcessor;\nuse Sylius\\Resource\\State\\ProcessorInterface;\n\nfinal class BulkAwareProcessorTest extends TestCase\n{\n    private BulkAwareProcessor $bulkAwareProcessor;\n\n    private ProcessorInterface|MockObject $processor;\n\n    protected function setUp(): void\n    {\n        $this->processor = $this->createMock(ProcessorInterface::class);\n        $this->bulkAwareProcessor = new BulkAwareProcessor($this->processor);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(BulkAwareProcessor::class, $this->bulkAwareProcessor);\n    }\n\n    public function testItCallsDecoratedProcessorForEachDataForBulkOperation(): void\n    {\n        $firstItem = new \\stdClass();\n        $secondItem = new \\stdClass();\n        $operation = new BulkDelete();\n        $context = new Context();\n\n        $this->processor->expects($this->exactly(2))\n            ->method('process')\n            ->willReturnCallback(function () {\n                return null;\n            });\n\n        $data = [$firstItem, $secondItem];\n\n        $this->bulkAwareProcessor->process($data, $operation, $context);\n    }\n\n    public function testItCallsDecoratedProcessorForDataForOtherOperationThanBulkOne(): void\n    {\n        $data = new \\stdClass();\n        $result = new \\stdClass();\n        $operation = new Delete();\n        $context = new Context();\n\n        $this->processor->expects($this->once())\n            ->method('process')\n            ->with($data, $operation, $context)\n            ->willReturn($result);\n\n        $this->assertSame($result, $this->bulkAwareProcessor->process($data, $operation, $context));\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/State/Processor/EventDispatcherBulkAwareProcessorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\State\\Processor;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\ProcessorWithCallable;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\BulkDelete;\nuse Sylius\\Resource\\State\\Processor\\EventDispatcherBulkAwareProcessor;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEvent;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventDispatcherInterface;\n\nfinal class EventDispatcherBulkAwareProcessorTest extends TestCase\n{\n    private EventDispatcherBulkAwareProcessor $processor;\n\n    private ProcessorInterface|MockObject $decorated;\n\n    private OperationEventDispatcherInterface|MockObject $operationEventDispatcher;\n\n    protected function setUp(): void\n    {\n        $this->decorated = $this->createMock(ProcessorInterface::class);\n        $this->operationEventDispatcher = $this->createMock(OperationEventDispatcherInterface::class);\n        $this->processor = new EventDispatcherBulkAwareProcessor(\n            $this->decorated,\n            $this->operationEventDispatcher,\n        );\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(EventDispatcherBulkAwareProcessor::class, $this->processor);\n    }\n\n    public function testItDispatchesEventsForBulkOperation(): void\n    {\n        $operation = new BulkDelete(processor: [ProcessorWithCallable::class, 'process']);\n        $context = new Context();\n        $operationEvent = new OperationEvent();\n        $data = [];\n\n        $this->operationEventDispatcher->expects($this->once())\n            ->method('dispatchBulkEvent')\n            ->with($data, $operation, $context)\n            ->willReturn($operationEvent);\n\n        $this->decorated->expects($this->once())\n            ->method('process')\n            ->with($data, $operation, $context)\n            ->willReturn(null);\n\n        $this->processor->process($data, $operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/State/Processor/FlashProcessorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\State\\Processor;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\State\\Processor\\FlashProcessor;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Sylius\\Resource\\Symfony\\Session\\Flash\\FlashHelperInterface;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nfinal class FlashProcessorTest extends TestCase\n{\n    private ProcessorInterface|MockObject $decorated;\n\n    private FlashHelperInterface|MockObject $flashHelper;\n\n    private FlashProcessor $flashProcessor;\n\n    protected function setUp(): void\n    {\n        $this->decorated = $this->createMock(ProcessorInterface::class);\n        $this->flashHelper = $this->createMock(FlashHelperInterface::class);\n\n        $this->flashProcessor = new FlashProcessor(\n            $this->decorated,\n            $this->flashHelper,\n        );\n    }\n\n    /** @test */\n    public function it_adds_success_flash(): void\n    {\n        $request = $this->createMock(Request::class);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $request->attributes = new ParameterBag();\n        $request->method('getRequestFormat')->willReturn('html');\n        $request->method('isMethodSafe')->willReturn(false);\n\n        $operation->method('canWrite')->willReturn(null);\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated->expects($this->once())\n            ->method('process')\n            ->with(['foo' => 'fighters'], $operation, $context)\n            ->willReturn(['foo' => 'fighters'])\n        ;\n\n        $this->flashHelper->expects($this->once())\n            ->method('addSuccessFlash')\n            ->with($operation, $context)\n        ;\n\n        $this->flashProcessor->process(['foo' => 'fighters'], $operation, $context);\n    }\n\n    /** @test */\n    public function it_adds_error_flash(): void\n    {\n        $request = $this->createMock(Request::class);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $request->attributes = new ParameterBag(['error' => 'Cannot delete, the resource is in use.']);\n        $request->method('getRequestFormat')->willReturn('html');\n        $request->method('isMethodSafe')->willReturn(false);\n\n        $operation->method('canWrite')->willReturn(null);\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated->expects($this->once())\n            ->method('process')\n            ->with(['foo' => 'fighters'], $operation, $context)\n            ->willReturn(['foo' => 'fighters'])\n        ;\n\n        $this->flashHelper->expects($this->once())\n            ->method('addErrorFlash')\n            ->with($operation, $context)\n        ;\n\n        $this->flashProcessor->process(['foo' => 'fighters'], $operation, $context);\n    }\n\n    /** @test */\n    public function it_does_nothing_when_controller_result_is_a_response(): void\n    {\n        $request = $this->createMock(Request::class);\n        $operation = $this->createMock(HttpOperation::class);\n        $response = $this->createMock(Response::class);\n\n        $request->method('getRequestFormat')->willReturn('html');\n        $request->expects($this->never())->method('isMethodSafe');\n\n        $operation->expects($this->never())->method('canWrite');\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated->expects($this->once())\n            ->method('process')\n            ->with($response, $operation, $context)\n            ->willReturn($response)\n        ;\n\n        $this->flashHelper->expects($this->never())->method('addSuccessFlash');\n\n        $this->flashProcessor->process($response, $operation, $context);\n    }\n\n    /** @test */\n    public function it_does_nothing_when_method_is_safe(): void\n    {\n        $request = $this->createMock(Request::class);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $request->method('getRequestFormat')->willReturn('html');\n        $request->method('isMethodSafe')->willReturn(true);\n\n        $operation->expects($this->never())->method('canWrite');\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated->expects($this->once())\n            ->method('process')\n            ->with(['foo' => 'fighters'], $operation, $context)\n            ->willReturn(['foo' => 'fighters'])\n        ;\n\n        $this->flashHelper->expects($this->never())->method('addSuccessFlash');\n\n        $this->flashProcessor->process(['foo' => 'fighters'], $operation, $context);\n    }\n\n    /** @test */\n    public function it_does_nothing_when_operation_cannot_be_written(): void\n    {\n        $request = $this->createMock(Request::class);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $request->method('getRequestFormat')->willReturn('html');\n        $request->method('isMethodSafe')->willReturn(false);\n\n        $operation->method('canWrite')->willReturn(false);\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated->expects($this->once())\n            ->method('process')\n            ->with(['foo' => 'fighters'], $operation, $context)\n            ->willReturn(['foo' => 'fighters'])\n        ;\n\n        $this->flashHelper->expects($this->never())->method('addSuccessFlash');\n\n        $this->flashProcessor->process(['foo' => 'fighters'], $operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/State/Processor/RespondProcessorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\State\\Processor;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Initiator\\RequestContextInitiatorInterface;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\State\\Processor\\RespondProcessor;\nuse Sylius\\Resource\\State\\ResponderInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Webmozart\\Assert\\Assert;\n\nfinal class RespondProcessorTest extends TestCase\n{\n    private RequestContextInitiatorInterface|MockObject $contextInitiator;\n\n    private ResponderInterface|MockObject $responder;\n\n    private RespondProcessor $respondProcessor;\n\n    protected function setUp(): void\n    {\n        $this->responder = $this->createMock(ResponderInterface::class);\n\n        $this->respondProcessor = new RespondProcessor(\n            $this->responder,\n        );\n    }\n\n    /** @test */\n    public function it_returns_a_response(): void\n    {\n        $response = $this->createMock(Response::class);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $context = new Context();\n\n        $this->responder->expects($this->once())\n            ->method('respond')\n            ->with(['foo' => 'fighters'], $operation, $context)\n            ->willReturn($response);\n\n        $data = $this->respondProcessor->process(['foo' => 'fighters'], $operation, $context);\n        Assert::eq($data, $response);\n    }\n\n    /** @test */\n    public function it_does_nothing_when_data_is_a_response(): void\n    {\n        $response = $this->createMock(Response::class);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $context = new Context();\n\n        $this->responder->expects($this->never())\n            ->method('respond');\n\n        $data = $this->respondProcessor->process($response, $operation, $context);\n        Assert::eq($data, $response);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/State/Processor/WriteProcessorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\tests\\State\\Processor;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\State\\Processor\\WriteProcessor;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nfinal class WriteProcessorTest extends TestCase\n{\n    private MockObject|ProcessorInterface $processor;\n\n    private MockObject|ProcessorInterface $locatorProcessor;\n\n    private WriteProcessor $writeProcessor;\n\n    protected function setUp(): void\n    {\n        $this->processor = $this->createMock(ProcessorInterface::class);\n        $this->locatorProcessor = $this->createMock(ProcessorInterface::class);\n\n        $this->writeProcessor = new WriteProcessor(\n            $this->processor,\n            $this->locatorProcessor,\n        );\n    }\n\n    /** @test */\n    public function it_calls_locator_processor_to_write_data(): void\n    {\n        $data = ['foo' => 'fighters'];\n        $operation = new Create(processor: 'App\\Processor');\n        $context = new Context();\n        $processedData = new \\stdClass();\n        $response = new Response();\n\n        $this->locatorProcessor->expects($this->once())->method('process')->with($data, $operation, $context)->willReturn($processedData);\n\n        $this->processor->expects($this->once())->method('process')->with($processedData, $operation, $context)->willReturn($response);\n\n        $result = $this->writeProcessor->process($data, $operation, $context);\n        $this->assertEquals($response, $result);\n    }\n\n    /** @test */\n    public function it_does_not_call_locator_processor_when_data_is_a_response(): void\n    {\n        $data = new Response();\n        $operation = new Create(processor: 'App\\Processor');\n        $context = new Context();\n\n        $this->locatorProcessor->expects($this->never())->method('process');\n\n        $this->processor->expects($this->once())->method('process')->willReturn($data);\n\n        $this->writeProcessor->process($data, $operation, $context);\n    }\n\n    /** @test */\n    public function it_does_not_call_locator_processor_when_operation_cannot_be_written(): void\n    {\n        $data = ['foo' => 'fighters'];\n        $operation = new Create(processor: 'App\\Processor', write: false);\n        $context = new Context();\n\n        $this->locatorProcessor->expects($this->never())->method('process');\n\n        $this->processor->expects($this->once())->method('process')->willReturn($data);\n\n        $this->writeProcessor->process($data, $operation, $context);\n    }\n\n    /** @test */\n    public function it_does_not_call_locator_processor_when_operation_has_no_processor(): void\n    {\n        $data = ['foo' => 'fighters'];\n        $operation = new Create(processor: null);\n        $context = new Context();\n\n        $this->locatorProcessor->expects($this->never())->method('process');\n\n        $this->processor->expects($this->once())->method('process')->willReturn($data);\n\n        $this->writeProcessor->process($data, $operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/State/ProcessorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\State;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\ProcessorWithCallable;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\State\\Processor;\nuse Sylius\\Resource\\State\\ProcessorInterface;\n\nfinal class ProcessorTest extends TestCase\n{\n    private Processor $processor;\n\n    private ContainerInterface|MockObject $locator;\n\n    protected function setUp(): void\n    {\n        $this->locator = $this->createMock(ContainerInterface::class);\n        $this->processor = new Processor($this->locator);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(Processor::class, $this->processor);\n    }\n\n    public function testItCallsProcessMethodFromOperationProcessorAsString(): void\n    {\n        $operation = new Create(processor: '\\App\\Processor');\n        $context = new Context();\n        $processor = $this->createMock(ProcessorInterface::class);\n\n        $this->locator->expects($this->once())\n            ->method('has')\n            ->with('\\App\\Processor')\n            ->willReturn(true);\n        $this->locator->expects($this->once())\n            ->method('get')\n            ->with('\\App\\Processor')\n            ->willReturn($processor);\n\n        $processor->expects($this->once())\n            ->method('process')\n            ->with([], $operation, $context)\n            ->willReturn(null);\n\n        $this->processor->process([], $operation, $context);\n    }\n\n    public function testItCallsProcessMethodFromOperationProcessorAsCallable(): void\n    {\n        $operation = new Create(processor: [ProcessorWithCallable::class, 'process']);\n        $context = new Context();\n\n        $result = $this->processor->process([], $operation, $context);\n\n        $this->assertInstanceOf(\\stdClass::class, $result);\n    }\n\n    public function testItReturnsNullIfOperationHasNoProcessor(): void\n    {\n        $operation = new Create();\n        $context = new Context();\n\n        $result = $this->processor->process([], $operation, $context);\n\n        $this->assertNull($result);\n    }\n\n    public function testItThrowsExceptionWhenConfiguredProcessorIsNotAProcessorInstance(): void\n    {\n        $operation = new Create(processor: '\\stdClass');\n        $context = new Context();\n\n        $this->locator->expects($this->once())\n            ->method('has')\n            ->with('\\stdClass')\n            ->willReturn(true);\n        $this->locator->expects($this->once())\n            ->method('get')\n            ->with('\\stdClass')\n            ->willReturn(new \\stdClass());\n\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage('Expected an instance of Sylius\\Resource\\State\\ProcessorInterface. Got: stdClass');\n\n        $this->processor->process([], $operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/State/Provider/FactoryProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\State\\Provider;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Update;\nuse Sylius\\Resource\\State\\FactoryInterface;\nuse Sylius\\Resource\\State\\Provider\\FactoryProvider;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class FactoryProviderTest extends TestCase\n{\n    private ProviderInterface|MockObject $decorated;\n\n    private FactoryInterface|MockObject $factory;\n\n    private FactoryProvider $factoryProvider;\n\n    protected function setUp(): void\n    {\n        $this->decorated = $this->createMock(ProviderInterface::class);\n        $this->factory = $this->createMock(FactoryInterface::class);\n\n        $this->factoryProvider = new FactoryProvider(\n            $this->decorated,\n            $this->factory,\n        );\n    }\n\n    /** @test */\n    public function it_uses_factory_from_operation(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $data = $this->createMock(\\stdClass::class);\n\n        $operation = new Create();\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn(['foo' => 'fighters'])\n        ;\n\n        $request->attributes = $attributes;\n\n        $this->factory->expects($this->once())\n            ->method('create')\n            ->with($operation, $context)\n            ->willReturn($data)\n        ;\n\n        $attributes->expects($this->once())\n            ->method('set')\n            ->with('data', $data)\n        ;\n\n        $this->factoryProvider->provide($operation, $context);\n    }\n\n    /** @test */\n    public function it_does_not_store_data_on_request_when_it_does_not_exist(): void\n    {\n        $attributes = $this->createMock(ParameterBag::class);\n        $data = $this->createMock(\\stdClass::class);\n\n        $operation = new Create();\n\n        $context = new Context();\n\n        $this->decorated->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn(['foo' => 'fighters'])\n        ;\n\n        $this->factory->expects($this->once())\n            ->method('create')\n            ->with($operation, $context)\n            ->willReturn($data)\n        ;\n\n        $attributes->expects($this->never())->method('set');\n\n        $this->factoryProvider->provide($operation, $context);\n    }\n\n    /** @test */\n    public function it_does_nothing_when_operation_is_not_a_factory_aware_operation(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $data = $this->createMock(\\stdClass::class);\n\n        $operation = new Update();\n\n        $context = new Context();\n\n        $this->decorated->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn(['foo' => 'fighters'])\n        ;\n\n        $request->attributes = $attributes;\n\n        $this->factory->expects($this->never())->method('create');\n        $attributes->expects($this->never())->method('set');\n\n        $this->factoryProvider->provide($operation, $context);\n    }\n\n    /** @test */\n    public function it_does_nothing_when_factory_is_disabled(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $data = $this->createMock(\\stdClass::class);\n\n        $operation = new Create(factory: false);\n\n        $context = new Context();\n\n        $this->decorated->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn(['foo' => 'fighters'])\n        ;\n\n        $request->attributes = $attributes;\n\n        $this->factory->expects($this->never())->method('create');\n        $attributes->expects($this->never())->method('set');\n\n        $this->factoryProvider->provide($operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/State/Provider/ReadProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\State\\Provider;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\State\\Provider\\ReadProvider;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException;\n\nfinal class ReadProviderTest extends TestCase\n{\n    private ProviderInterface|MockObject $provider;\n\n    private ReadProvider $readProvider;\n\n    protected function setUp(): void\n    {\n        $this->provider = $this->createMock(ProviderInterface::class);\n\n        $this->readProvider = new ReadProvider(\n            $this->provider,\n        );\n    }\n\n    /** @test */\n    public function it_retrieves_data(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $context = new Context();\n\n        $request->attributes = $attributes;\n\n        $this->provider->expects($this->once())->method('provide')->with($operation, $this->isInstanceOf(Context::class))->willReturn(['foo' => 'fighters']);\n\n        $attributes->expects($this->never())->method('set');\n\n        $this->readProvider->provide($operation, $context);\n    }\n\n    /** @test */\n    public function it_retrieves_data_and_store_them_to_request(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->attributes = $attributes;\n\n        $this->provider->expects($this->once())->method('provide')->with($operation, $this->isInstanceOf(Context::class))->willReturn(['foo' => 'fighters']);\n\n        $attributes->expects($this->once())->method('set')->with('data', ['foo' => 'fighters']);\n\n        $this->readProvider->provide($operation, $context);\n    }\n\n    /** @test */\n    public function it_does_nothing_when_operation_is_a_create_operation(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $operation = new Create();\n\n        $context = new Context(new RequestOption($request));\n\n        $request->attributes = $attributes;\n\n        $this->provider->expects($this->never())->method('provide');\n\n        $attributes->expects($this->never())->method('set');\n\n        $this->readProvider->provide($operation, $context);\n    }\n\n    /** @test */\n    public function it_does_nothing_when_operation_cannot_be_read(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->attributes = $attributes;\n\n        $operation->method('canRead')->willReturn(false);\n\n        $this->provider->expects($this->never())->method('provide');\n\n        $attributes->expects($this->never())->method('set');\n\n        $this->readProvider->provide($operation, $context);\n    }\n\n    /** @test */\n    public function it_throws_an_exception_when_no_data_was_found(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->attributes = $attributes;\n\n        $operation->method('canRead')->willReturn(true);\n\n        $this->provider->expects($this->once())->method('provide')->with($operation, $this->isInstanceOf(Context::class))->willReturn(null);\n\n        $attributes->expects($this->never())->method('set');\n\n        $this->expectException(NotFoundHttpException::class);\n        $this->expectExceptionMessage('Resource has not been found.');\n\n        $this->readProvider->provide($operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/State/ProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\State;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\ProviderWithCallable;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\State\\Provider;\nuse Sylius\\Resource\\State\\ProviderInterface;\n\nfinal class ProviderTest extends TestCase\n{\n    private Provider $provider;\n\n    private ContainerInterface|MockObject $locator;\n\n    protected function setUp(): void\n    {\n        $this->locator = $this->createMock(ContainerInterface::class);\n        $this->provider = new Provider($this->locator);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(Provider::class, $this->provider);\n    }\n\n    public function testItCallsProvideMethodFromOperationProviderAsString(): void\n    {\n        $operation = new Create(provider: '\\App\\Provider');\n        $context = new Context();\n        $provider = $this->createMock(ProviderInterface::class);\n\n        $this->locator->expects($this->once())\n            ->method('has')\n            ->with('\\App\\Provider')\n            ->willReturn(true);\n        $this->locator->expects($this->once())\n            ->method('get')\n            ->with('\\App\\Provider')\n            ->willReturn($provider);\n\n        $provider->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context);\n\n        $this->provider->provide($operation, $context);\n    }\n\n    public function testItCallsProvideMethodFromOperationProviderAsCallable(): void\n    {\n        $operation = new Create(provider: [ProviderWithCallable::class, 'provide']);\n        $context = new Context();\n\n        $result = $this->provider->provide($operation, $context);\n\n        $this->assertInstanceOf(\\stdClass::class, $result);\n    }\n\n    public function testItReturnsNullIfOperationHasNoProvider(): void\n    {\n        $operation = new Create();\n        $context = new Context();\n\n        $result = $this->provider->provide($operation, $context);\n\n        $this->assertNull($result);\n    }\n\n    public function testItThrowsExceptionWhenConfiguredProviderIsNotAProviderInstance(): void\n    {\n        $operation = new Create(provider: '\\stdClass');\n        $context = new Context();\n\n        $this->locator->expects($this->once())\n            ->method('has')\n            ->with('\\stdClass')\n            ->willReturn(true);\n        $this->locator->expects($this->once())\n            ->method('get')\n            ->with('\\stdClass')\n            ->willReturn(new \\stdClass());\n\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage('Expected an instance of Sylius\\Resource\\State\\ProviderInterface. Got: stdClass');\n\n        $this->provider->provide($operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/State/ResponderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\State;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\ResponderWithCallable;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\State\\Responder;\nuse Sylius\\Resource\\State\\ResponderInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nfinal class ResponderTest extends TestCase\n{\n    private Responder $responder;\n\n    private ContainerInterface|MockObject $locator;\n\n    protected function setUp(): void\n    {\n        $this->locator = $this->createMock(ContainerInterface::class);\n        $this->responder = new Responder($this->locator);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(Responder::class, $this->responder);\n    }\n\n    public function testItCallsRespondMethodFromOperationResponderAsString(): void\n    {\n        $operation = new Create(responder: '\\App\\Responder');\n        $context = new Context();\n        $responder = $this->createMock(ResponderInterface::class);\n\n        $this->locator->expects($this->once())\n            ->method('has')\n            ->with('\\App\\Responder')\n            ->willReturn(true);\n        $this->locator->expects($this->once())\n            ->method('get')\n            ->with('\\App\\Responder')\n            ->willReturn($responder);\n\n        $responder->expects($this->once())\n            ->method('respond')\n            ->with([], $operation, $context)\n            ->willReturn('response_data');\n\n        $result = $this->responder->respond([], $operation, $context);\n        $this->assertEquals('response_data', $result);\n    }\n\n    public function testItCallsRespondMethodFromOperationResponderAsCallable(): void\n    {\n        $operation = new Create(responder: [ResponderWithCallable::class, 'respond']);\n        $context = new Context();\n\n        $result = $this->responder->respond([], $operation, $context);\n\n        $this->assertInstanceOf(Response::class, $result);\n    }\n\n    public function testItReturnsNullIfOperationHasNoResponder(): void\n    {\n        $operation = new Create();\n        $context = new Context();\n\n        $result = $this->responder->respond([], $operation, $context);\n\n        $this->assertNull($result);\n    }\n\n    public function testItThrowsExceptionWhenConfiguredResponderIsNotAResponderInstance(): void\n    {\n        $operation = new Create(responder: '\\stdClass');\n        $context = new Context();\n\n        $this->locator->expects($this->once())\n            ->method('has')\n            ->with('\\stdClass')\n            ->willReturn(true);\n        $this->locator->expects($this->once())\n            ->method('get')\n            ->with('\\stdClass')\n            ->willReturn(new \\stdClass());\n\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage('Expected an instance of Sylius\\Resource\\State\\ResponderInterface. Got: stdClass');\n\n        $this->responder->respond([], $operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/StateMachine/OperationStateMachineTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\StateMachine;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\StateMachineAwareOperationInterface;\nuse Sylius\\Resource\\StateMachine\\OperationStateMachine;\nuse Sylius\\Resource\\StateMachine\\OperationStateMachineInterface;\n\nfinal class OperationStateMachineTest extends TestCase\n{\n    private ContainerInterface $locator;\n\n    private OperationStateMachine $operationStateMachine;\n\n    protected function setUp(): void\n    {\n        $this->locator = $this->createMock(ContainerInterface::class);\n        $this->operationStateMachine = new OperationStateMachine($this->locator);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(OperationStateMachine::class, $this->operationStateMachine);\n    }\n\n    public function testItCallsCanMethodFromOperationStateMachineAsString(): void\n    {\n        $stateMachine = $this->createMock(OperationStateMachineInterface::class);\n        $data = new \\stdClass();\n        $operation = (new Create())->withStateMachineComponent('symfony');\n        $context = new Context();\n\n        $this->locator->expects($this->once())\n            ->method('has')\n            ->with('symfony')\n            ->willReturn(true);\n\n        $this->locator->expects($this->once())\n            ->method('get')\n            ->with('symfony')\n            ->willReturn($stateMachine);\n\n        $stateMachine->expects($this->once())\n            ->method('can')\n            ->with($data, $operation, $context)\n            ->willReturn(true);\n\n        $this->assertTrue($this->operationStateMachine->can($data, $operation, $context));\n    }\n\n    public function testItReturnsFalseIfNoOperationStateMachineHasBeenConfiguredOnOperation(): void\n    {\n        $data = new \\stdClass();\n        $operation = new Create();\n        $context = new Context();\n\n        $this->assertFalse($this->operationStateMachine->can($data, $operation, $context));\n    }\n\n    public function testItCallsApplyMethodFromOperationStateMachineAsString(): void\n    {\n        $stateMachine = $this->createMock(OperationStateMachineInterface::class);\n        $data = new \\stdClass();\n        $operation = (new Create())->withStateMachineComponent('symfony');\n        $context = new Context();\n\n        $this->locator->expects($this->once())\n            ->method('has')\n            ->with('symfony')\n            ->willReturn(true);\n\n        $this->locator->expects($this->once())\n            ->method('get')\n            ->with('symfony')\n            ->willReturn($stateMachine);\n\n        $stateMachine->expects($this->once())\n            ->method('apply')\n            ->with($data, $operation, $context);\n\n        $this->operationStateMachine->apply($data, $operation, $context);\n    }\n\n    public function testItDoesNothingIfNoOperationStateMachineHasBeenConfiguredOnOperation(): void\n    {\n        $data = new \\stdClass();\n        $operation = new Create();\n        $context = new Context();\n\n        $this->operationStateMachine->apply($data, $operation, $context);\n        $this->expectNotToPerformAssertions();\n    }\n\n    public function testItThrowsAnExceptionWhenOperationDoesNotImplementAStateMachine(): void\n    {\n        $data = new \\stdClass();\n        $operation = new Index();\n\n        $this->expectException(\\LogicException::class);\n        $this->expectExceptionMessage(sprintf('Expected an instance of %s. Got: %s', StateMachineAwareOperationInterface::class, Index::class));\n\n        $this->operationStateMachine->can($data, $operation, new Context());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/StateMachine/State/ApplyStateMachineTransitionProcessorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\StateMachine\\State;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Sylius\\Resource\\StateMachine\\OperationStateMachineInterface;\nuse Sylius\\Resource\\StateMachine\\State\\ApplyStateMachineTransitionProcessor;\n\nfinal class ApplyStateMachineTransitionProcessorTest extends TestCase\n{\n    private OperationStateMachineInterface $operationStateMachine;\n\n    private ProcessorInterface $writeProcessor;\n\n    private ApplyStateMachineTransitionProcessor $processor;\n\n    protected function setUp(): void\n    {\n        $this->operationStateMachine = $this->createMock(OperationStateMachineInterface::class);\n        $this->writeProcessor = $this->createMock(ProcessorInterface::class);\n        $this->processor = new ApplyStateMachineTransitionProcessor(\n            $this->operationStateMachine,\n            $this->writeProcessor,\n        );\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(ApplyStateMachineTransitionProcessor::class, $this->processor);\n    }\n\n    public function testItAppliesStateMachineTransitionIfPossible(): void\n    {\n        $data = new \\stdClass();\n        $operation = new Create();\n        $context = new Context();\n\n        $this->operationStateMachine->expects($this->once())\n            ->method('can')\n            ->with($data, $operation, $context)\n            ->willReturn(true);\n\n        $this->operationStateMachine->expects($this->once())\n            ->method('apply')\n            ->with($data, $operation, $context);\n\n        $this->writeProcessor->expects($this->once())\n            ->method('process')\n            ->with($data, $operation, $context)\n            ->willReturn(null);\n\n        $this->processor->process($data, $operation, $context);\n    }\n\n    public function testItDoesNothingWhenTransitionIsNotPossible(): void\n    {\n        $data = new \\stdClass();\n        $operation = new Create();\n        $context = new Context();\n\n        $this->operationStateMachine->expects($this->once())\n            ->method('can')\n            ->with($data, $operation, $context)\n            ->willReturn(false);\n\n        $this->operationStateMachine->expects($this->never())\n            ->method('apply');\n\n        $this->writeProcessor->expects($this->once())\n            ->method('process')\n            ->with($data, $operation, $context)\n            ->willReturn(null);\n\n        $this->assertNull($this->processor->process($data, $operation, $context));\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/StateMachine/StateMachineTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\StateMachine;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\StateMachine\\StateMachine;\nuse Sylius\\Resource\\Tests\\Dummy\\PullRequest;\nuse winzou\\Bundle\\StateMachineBundle\\winzouStateMachineBundle;\n\nfinal class StateMachineTest extends TestCase\n{\n    private StateMachine $stateMachine;\n\n    protected function setUp(): void\n    {\n        $this->markAsSkippedIfWinzouStateMachineIsNotAvailable();\n\n        $this->stateMachine = new StateMachine(new PullRequest(), [\n            'graph' => 'pull_request',\n            'property_path' => 'currentPlace',\n            'places' => [\n                'start',\n                'test',\n            ],\n            'transitions' => [\n                'submit' => [\n                    'from' => ['start'],\n                    'to' => 'test',\n                ],\n            ],\n        ]);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(StateMachine::class, $this->stateMachine);\n    }\n\n    public function testItGetsTransitionFromAState(): void\n    {\n        $this->assertSame('submit', $this->stateMachine->getTransitionFromState('start'));\n    }\n\n    public function testItGetsTransitionToAState(): void\n    {\n        $this->assertSame('submit', $this->stateMachine->getTransitionToState('test'));\n    }\n\n    private function markAsSkippedIfWinzouStateMachineIsNotAvailable(): void\n    {\n        if (!class_exists(winzouStateMachineBundle::class)) {\n            $this->markTestSkipped('Winzou State machine is not available.');\n        }\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Controller/MainControllerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\tests\\Symfony\\Controller;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Initiator\\RequestContextInitiatorInterface;\nuse Sylius\\Resource\\Exception\\RuntimeException;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Operation\\HttpOperationInitiatorInterface;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Sylius\\Resource\\Symfony\\Controller\\MainController;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nfinal class MainControllerTest extends TestCase\n{\n    private HttpOperationInitiatorInterface|MockObject $operationInitiator;\n\n    private RequestContextInitiatorInterface|MockObject $requestContextInitiator;\n\n    private ProviderInterface|MockObject $provider;\n\n    private ProcessorInterface|MockObject $processor;\n\n    private MainController $mainController;\n\n    protected function setUp(): void\n    {\n        $this->operationInitiator = $this->createMock(HttpOperationInitiatorInterface::class);\n        $this->requestContextInitiator = $this->createMock(RequestContextInitiatorInterface::class);\n        $this->provider = $this->createMock(ProviderInterface::class);\n        $this->processor = $this->createMock(ProcessorInterface::class);\n\n        $this->mainController = new MainController(\n            $this->operationInitiator,\n            $this->requestContextInitiator,\n            $this->provider,\n            $this->processor,\n        );\n    }\n\n    /** @test */\n    public function it_returns_a_response(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $operation = new Create();\n        $context = new Context();\n        $response = new Response();\n        $data = new \\stdClass();\n\n        $request->attributes = $attributes;\n\n        $this->operationInitiator->expects($this->once())->method('initializeOperation')->with($request)->willReturn($operation);\n\n        $this->requestContextInitiator->expects($this->once())->method('initializeContext')->with($request)->willReturn($context);\n\n        $request->method('isMethodSafe')->willReturn(true);\n\n        $attributes->expects($this->once())->method('getBoolean')->with('is_valid', true)->willReturn(true);\n\n        $this->provider->expects($this->once())->method('provide')->with($operation, $context)->willReturn($data);\n        $this->processor->expects($this->once())->method('process')->with($data, $operation, $context)->willReturn($response);\n\n        $result = $this->mainController->__invoke($request);\n        $this->assertEquals($response, $result);\n    }\n\n    /** @test */\n    public function it_throws_an_exception_when_operation_is_null(): void\n    {\n        $request = $this->createMock(Request::class);\n\n        $this->operationInitiator->expects($this->once())->method('initializeOperation')->with($request)->willReturn(null);\n\n        $this->expectException(RuntimeException::class);\n        $this->expectExceptionMessage('Operation should not be null.');\n\n        $this->mainController->__invoke($request);\n    }\n\n    /** @test */\n    public function it_disables_write_if_http_method_is_safe(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $operation = $this->createMock(HttpOperation::class);\n        $context = new Context();\n        $response = new Response();\n        $data = new \\stdClass();\n\n        $request->attributes = $attributes;\n\n        $this->operationInitiator->expects($this->once())->method('initializeOperation')->with($request)->willReturn($operation);\n\n        $this->requestContextInitiator->expects($this->once())->method('initializeContext')->with($request)->willReturn($context);\n\n        $request->method('isMethodSafe')->willReturn(true);\n\n        $attributes->expects($this->once())->method('getBoolean')->with('is_valid', true)->willReturn(true);\n\n        $this->provider->expects($this->once())->method('provide')->with($operation, $context)->willReturn($data);\n        $this->processor->expects($this->once())->method('process')->with($data, $operation, $context)->willReturn($response);\n\n        $operation->method('canWrite')->willReturn(null);\n        $operation->expects($this->once())->method('withWrite')->with(false)->willReturn($operation);\n\n        $this->mainController->__invoke($request);\n    }\n\n    /** @test */\n    public function it_disables_write_if_validation_has_failed(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $operation = $this->createMock(HttpOperation::class);\n        $context = new Context();\n        $response = new Response();\n        $data = new \\stdClass();\n\n        $request->attributes = $attributes;\n\n        $this->operationInitiator->expects($this->once())->method('initializeOperation')->with($request)->willReturn($operation);\n\n        $this->requestContextInitiator->expects($this->once())->method('initializeContext')->with($request)->willReturn($context);\n\n        $attributes->expects($this->once())->method('getBoolean')->with('is_valid', true)->willReturn(false);\n\n        $this->provider->expects($this->once())->method('provide')->with($operation, $context)->willReturn($data);\n        $this->processor->expects($this->once())->method('process')->with($data, $operation, $context)->willReturn($response);\n\n        $operation->method('canWrite')->willReturn(true);\n        $operation->expects($this->once())->method('withWrite')->with(false)->willReturn($operation);\n\n        $this->mainController->__invoke($request);\n    }\n\n    /** @test */\n    public function it_does_not_enable_write_if_validation_is_ok(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $operation = $this->createMock(HttpOperation::class);\n        $context = new Context();\n        $response = new Response();\n        $data = new \\stdClass();\n\n        $request->attributes = $attributes;\n\n        $this->operationInitiator->expects($this->once())->method('initializeOperation')->with($request)->willReturn($operation);\n\n        $this->requestContextInitiator->expects($this->once())->method('initializeContext')->with($request)->willReturn($context);\n\n        $attributes->expects($this->once())->method('getBoolean')->with('is_valid', true)->willReturn(true);\n\n        $this->provider->expects($this->once())->method('provide')->with($operation, $context)->willReturn($data);\n        $this->processor->expects($this->once())->method('process')->with($data, $operation, $context)->willReturn($response);\n\n        $operation->method('canWrite')->willReturn(false);\n        $operation->expects($this->never())->method('withWrite');\n\n        $this->mainController->__invoke($request);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/DependencyInjection/Compiler/DisableMetadataCachePassTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\DependencyInjection\\Compiler;\n\nuse Matthias\\SymfonyDependencyInjectionTest\\PhpUnit\\AbstractCompilerPassTestCase;\nuse PHPUnit\\Framework\\Attributes\\CoversClass;\nuse PHPUnit\\Framework\\Attributes\\DataProvider;\nuse PHPUnit\\Framework\\Attributes\\Test;\nuse Sylius\\Resource\\Symfony\\DependencyInjection\\Compiler\\DisableMetadataCachePass;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Definition;\n\n#[CoversClass(DisableMetadataCachePass::class)]\nfinal class DisableMetadataCachePassTest extends AbstractCompilerPassTestCase\n{\n    #[Test]\n    #[DataProvider('getCachedServiceIdProvider')]\n    public function it_disables_cache_when_debug_is_enabled(string $cachedServiceId): void\n    {\n        $this->setDefinition($cachedServiceId, new Definition());\n        $this->setParameter('kernel.debug', true);\n\n        $this->compile();\n\n        $this->assertContainerBuilderNotHasService($cachedServiceId);\n    }\n\n    #[Test]\n    #[DataProvider('getCachedServiceIdProvider')]\n    public function it_does_not_disable_cache_when_debug_is_disabled(string $cachedServiceId): void\n    {\n        $this->setDefinition($cachedServiceId, new Definition());\n        $this->setParameter('kernel.debug', false);\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasService($cachedServiceId);\n    }\n\n    #[Test]\n    #[DataProvider('getCachedServiceIdProvider')]\n    public function it_does_not_disable_cache_when_debug_parameter_does_not_exist(string $cachedServiceId): void\n    {\n        $this->setDefinition('sylius.resource_metadata_collection.factory.cached', new Definition());\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasService('sylius.resource_metadata_collection.factory.cached');\n    }\n\n    protected function registerCompilerPass(ContainerBuilder $container): void\n    {\n        $container->addCompilerPass(new DisableMetadataCachePass());\n    }\n\n    public static function getCachedServiceIdProvider(): iterable\n    {\n        yield ['sylius.resource_metadata_collection.factory.cached'];\n        yield ['sylius.metadata.resource_class_list.cached'];\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/DependencyInjection/Compiler/FallbackToKernelDefaultLocalePassTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\DependencyInjection\\Compiler;\n\nuse Matthias\\SymfonyDependencyInjectionTest\\PhpUnit\\AbstractCompilerPassTestCase;\nuse PHPUnit\\Framework\\Attributes\\Test;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\FlashHelper;\nuse Sylius\\Resource\\Symfony\\DependencyInjection\\Compiler\\FallbackToKernelDefaultLocalePass;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Definition;\n\nfinal class FallbackToKernelDefaultLocalePassTest extends AbstractCompilerPassTestCase\n{\n    /** @test */\n    public function it_does_nothing_if_locale_parameter_has_been_defined(): void\n    {\n        $this->setParameter('locale', 'en_US');\n        $this->setDefinition('sylius.resource_controller.flash_helper', new Definition());\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasService('sylius.resource_controller.flash_helper');\n    }\n\n    /** @test */\n    public function it_replaces_locale_argument_in_flash_helper(): void\n    {\n        $flashHelperDefinition = (new Definition(FlashHelper::class))->setArguments([\n            null,\n            null,\n            null,\n        ]);\n\n        $this->setParameter('kernel.default_locale', 'en_US');\n        $this->setDefinition('sylius.resource_controller.flash_helper', $flashHelperDefinition);\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasService('sylius.resource_controller.flash_helper');\n        $this->assertContainerBuilderHasServiceDefinitionWithArgument('sylius.resource_controller.flash_helper', 2, 'en_US');\n    }\n\n    /** @test */\n    public function it_replaces_locale_argument_in_translation_locale_provider(): void\n    {\n        $translationLocaleProviderDefinition = (new Definition(FlashHelper::class))->setArguments([\n            [],\n            null,\n        ]);\n\n        $this->setParameter('kernel.default_locale', 'en_US');\n        $this->setDefinition('sylius.translation_locale_provider.immutable', $translationLocaleProviderDefinition);\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasService('sylius.translation_locale_provider.immutable');\n        $this->assertContainerBuilderHasServiceDefinitionWithArgument('sylius.translation_locale_provider.immutable', 0, ['en_US']);\n        $this->assertContainerBuilderHasServiceDefinitionWithArgument('sylius.translation_locale_provider.immutable', 1, 'en_US');\n    }\n\n    protected function registerCompilerPass(ContainerBuilder $container): void\n    {\n        $container->addCompilerPass(new FallbackToKernelDefaultLocalePass());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/DependencyInjection/Compiler/MetadataMutatorPassTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\DependencyInjection\\Compiler;\n\nuse Matthias\\SymfonyDependencyInjectionTest\\PhpUnit\\AbstractCompilerPassTestCase;\nuse Sylius\\Resource\\Symfony\\DependencyInjection\\Compiler\\MetadataMutatorPass;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Definition;\nuse Symfony\\Component\\DependencyInjection\\Reference;\n\nfinal class MetadataMutatorPassTest extends AbstractCompilerPassTestCase\n{\n    public function testItDoesNothingWhenResourceMutatorCollectionDoesNotExist(): void\n    {\n        $this->compile();\n\n        $this->assertContainerBuilderNotHasService('sylius.metadata.mutator_collection.resource');\n    }\n\n    public function testItDoesNothingWhenOperationMutatorCollectionDoesNotExist(): void\n    {\n        $this->compile();\n\n        $this->assertContainerBuilderNotHasService('sylius.metadata.mutator_collection.operation');\n    }\n\n    public function testItAddsResourceMutatorsToCollection(): void\n    {\n        $mutatorCollectionDefinition = new Definition();\n        $this->setDefinition('sylius.metadata.mutator_collection.resource', $mutatorCollectionDefinition);\n\n        $mutatorDefinition = new Definition();\n        $mutatorDefinition->addTag('sylius.resource_mutator', ['resourceClass' => 'App\\Entity\\Product']);\n        $this->setDefinition('app.resource_mutator.product', $mutatorDefinition);\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.metadata.mutator_collection.resource',\n            'add',\n            [\n                'App\\Entity\\Product',\n                new Reference('app.resource_mutator.product'),\n            ],\n        );\n    }\n\n    public function testItAddsMultipleResourceMutatorsToCollection(): void\n    {\n        $mutatorCollectionDefinition = new Definition();\n        $this->setDefinition('sylius.metadata.mutator_collection.resource', $mutatorCollectionDefinition);\n\n        $productMutatorDefinition = new Definition();\n        $productMutatorDefinition->addTag('sylius.resource_mutator', ['resourceClass' => 'App\\Entity\\Product']);\n        $this->setDefinition('app.resource_mutator.product', $productMutatorDefinition);\n\n        $customerMutatorDefinition = new Definition();\n        $customerMutatorDefinition->addTag('sylius.resource_mutator', ['resourceClass' => 'App\\Entity\\Customer']);\n        $this->setDefinition('app.resource_mutator.customer', $customerMutatorDefinition);\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.metadata.mutator_collection.resource',\n            'add',\n            [\n                'App\\Entity\\Product',\n                new Reference('app.resource_mutator.product'),\n            ],\n        );\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.metadata.mutator_collection.resource',\n            'add',\n            [\n                'App\\Entity\\Customer',\n                new Reference('app.resource_mutator.customer'),\n            ],\n        );\n    }\n\n    public function testItAddsResourceMutatorWithMultipleTags(): void\n    {\n        $mutatorCollectionDefinition = new Definition();\n        $this->setDefinition('sylius.metadata.mutator_collection.resource', $mutatorCollectionDefinition);\n\n        $mutatorDefinition = new Definition();\n        $mutatorDefinition->addTag('sylius.resource_mutator', ['resourceClass' => 'App\\Entity\\Product']);\n        $mutatorDefinition->addTag('sylius.resource_mutator', ['resourceClass' => 'App\\Entity\\Customer']);\n        $this->setDefinition('app.resource_mutator.multi', $mutatorDefinition);\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.metadata.mutator_collection.resource',\n            'add',\n            [\n                'App\\Entity\\Product',\n                new Reference('app.resource_mutator.multi'),\n            ],\n        );\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.metadata.mutator_collection.resource',\n            'add',\n            [\n                'App\\Entity\\Customer',\n                new Reference('app.resource_mutator.multi'),\n            ],\n        );\n    }\n\n    public function testItAddsOperationMutatorsToCollection(): void\n    {\n        $mutatorCollectionDefinition = new Definition();\n        $this->setDefinition('sylius.metadata.mutator_collection.operation', $mutatorCollectionDefinition);\n\n        $mutatorDefinition = new Definition();\n        $mutatorDefinition->addTag('sylius.operation_mutator', ['operationName' => 'app_product_create']);\n        $this->setDefinition('app.operation_mutator.product_create', $mutatorDefinition);\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.metadata.mutator_collection.operation',\n            'add',\n            [\n                'app_product_create',\n                new Reference('app.operation_mutator.product_create'),\n            ],\n        );\n    }\n\n    public function testItAddsMultipleOperationMutatorsToCollection(): void\n    {\n        $mutatorCollectionDefinition = new Definition();\n        $this->setDefinition('sylius.metadata.mutator_collection.operation', $mutatorCollectionDefinition);\n\n        $createMutatorDefinition = new Definition();\n        $createMutatorDefinition->addTag('sylius.operation_mutator', ['operationName' => 'app_product_create']);\n        $this->setDefinition('app.operation_mutator.product_create', $createMutatorDefinition);\n\n        $updateMutatorDefinition = new Definition();\n        $updateMutatorDefinition->addTag('sylius.operation_mutator', ['operationName' => 'app_product_update']);\n        $this->setDefinition('app.operation_mutator.product_update', $updateMutatorDefinition);\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.metadata.mutator_collection.operation',\n            'add',\n            [\n                'app_product_create',\n                new Reference('app.operation_mutator.product_create'),\n            ],\n        );\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.metadata.mutator_collection.operation',\n            'add',\n            [\n                'app_product_update',\n                new Reference('app.operation_mutator.product_update'),\n            ],\n        );\n    }\n\n    public function testItAddsOperationMutatorWithMultipleTags(): void\n    {\n        $mutatorCollectionDefinition = new Definition();\n        $this->setDefinition('sylius.metadata.mutator_collection.operation', $mutatorCollectionDefinition);\n\n        $mutatorDefinition = new Definition();\n        $mutatorDefinition->addTag('sylius.operation_mutator', ['operationName' => 'app_product_create']);\n        $mutatorDefinition->addTag('sylius.operation_mutator', ['operationName' => 'app_product_update']);\n        $this->setDefinition('app.operation_mutator.multi', $mutatorDefinition);\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.metadata.mutator_collection.operation',\n            'add',\n            [\n                'app_product_create',\n                new Reference('app.operation_mutator.multi'),\n            ],\n        );\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.metadata.mutator_collection.operation',\n            'add',\n            [\n                'app_product_update',\n                new Reference('app.operation_mutator.multi'),\n            ],\n        );\n    }\n\n    public function testItProcessesBothResourceAndOperationMutators(): void\n    {\n        $resourceMutatorCollectionDefinition = new Definition();\n        $this->setDefinition('sylius.metadata.mutator_collection.resource', $resourceMutatorCollectionDefinition);\n\n        $operationMutatorCollectionDefinition = new Definition();\n        $this->setDefinition('sylius.metadata.mutator_collection.operation', $operationMutatorCollectionDefinition);\n\n        $resourceMutatorDefinition = new Definition();\n        $resourceMutatorDefinition->addTag('sylius.resource_mutator', ['resourceClass' => 'App\\Entity\\Product']);\n        $this->setDefinition('app.resource_mutator', $resourceMutatorDefinition);\n\n        $operationMutatorDefinition = new Definition();\n        $operationMutatorDefinition->addTag('sylius.operation_mutator', ['operationName' => 'app_product_create']);\n        $this->setDefinition('app.operation_mutator', $operationMutatorDefinition);\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.metadata.mutator_collection.resource',\n            'add',\n            [\n                'App\\Entity\\Product',\n                new Reference('app.resource_mutator'),\n            ],\n        );\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.metadata.mutator_collection.operation',\n            'add',\n            [\n                'app_product_create',\n                new Reference('app.operation_mutator'),\n            ],\n        );\n    }\n\n    protected function registerCompilerPass(ContainerBuilder $container): void\n    {\n        $container->addCompilerPass(new MetadataMutatorPass());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/EventDispatcher/GenericEventTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\EventDispatcher;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\GenericEvent;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nfinal class GenericEventTest extends TestCase\n{\n    public function testItIsInitializable(): void\n    {\n        $event = new GenericEvent();\n\n        $this->assertInstanceOf(GenericEvent::class, $event);\n    }\n\n    public function testItCanSetAndGetMessageType(): void\n    {\n        $event = new GenericEvent();\n        $event->setMessageType(GenericEvent::TYPE_SUCCESS);\n\n        $this->assertSame(GenericEvent::TYPE_SUCCESS, $event->getMessageType());\n    }\n\n    public function testItCanSetAndGetMessage(): void\n    {\n        $event = new GenericEvent();\n        $event->setMessage('Test message');\n\n        $this->assertSame('Test message', $event->getMessage());\n    }\n\n    public function testItCanSetAndGetMessageParameters(): void\n    {\n        $event = new GenericEvent();\n        $parameters = ['%name%' => 'John', '%count%' => 5];\n        $event->setMessageParameters($parameters);\n\n        $this->assertSame($parameters, $event->getMessageParameters());\n    }\n\n    public function testItCanSetAndGetErrorCode(): void\n    {\n        $event = new GenericEvent();\n        $event->setErrorCode(404);\n\n        $this->assertSame(404, $event->getErrorCode());\n    }\n\n    public function testItCanSetAndCheckResponse(): void\n    {\n        $event = new GenericEvent();\n        $response = new Response();\n\n        $this->assertFalse($event->hasResponse());\n\n        $event->setResponse($response);\n\n        $this->assertTrue($event->hasResponse());\n        $this->assertSame($response, $event->getResponse());\n    }\n\n    public function testItReturnsNullWhenNoResponse(): void\n    {\n        $event = new GenericEvent();\n\n        $this->assertNull($event->getResponse());\n    }\n\n    public function testItCanStopPropagationWithDefaultValues(): void\n    {\n        $event = new GenericEvent();\n        $event->stop('Error occurred');\n\n        $this->assertTrue($event->isStopped());\n        $this->assertSame('Error occurred', $event->getMessage());\n        $this->assertSame(GenericEvent::TYPE_ERROR, $event->getMessageType());\n        $this->assertSame([], $event->getMessageParameters());\n        $this->assertSame(500, $event->getErrorCode());\n    }\n\n    public function testItCanStopPropagationWithCustomType(): void\n    {\n        $event = new GenericEvent();\n        $event->stop('Warning message', GenericEvent::TYPE_WARNING);\n\n        $this->assertTrue($event->isStopped());\n        $this->assertSame('Warning message', $event->getMessage());\n        $this->assertSame(GenericEvent::TYPE_WARNING, $event->getMessageType());\n        $this->assertSame(500, $event->getErrorCode());\n    }\n\n    public function testItCanStopPropagationWithCustomParameters(): void\n    {\n        $event = new GenericEvent();\n        $parameters = ['%item%' => 'Product'];\n        $event->stop('Item not found', GenericEvent::TYPE_ERROR, $parameters);\n\n        $this->assertTrue($event->isStopped());\n        $this->assertSame('Item not found', $event->getMessage());\n        $this->assertSame(GenericEvent::TYPE_ERROR, $event->getMessageType());\n        $this->assertSame($parameters, $event->getMessageParameters());\n        $this->assertSame(500, $event->getErrorCode());\n    }\n\n    public function testItCanStopPropagationWithCustomErrorCode(): void\n    {\n        $event = new GenericEvent();\n        $event->stop('Not found', GenericEvent::TYPE_ERROR, [], 404);\n\n        $this->assertTrue($event->isStopped());\n        $this->assertSame('Not found', $event->getMessage());\n        $this->assertSame(GenericEvent::TYPE_ERROR, $event->getMessageType());\n        $this->assertSame([], $event->getMessageParameters());\n        $this->assertSame(404, $event->getErrorCode());\n    }\n\n    public function testItCanStopPropagationWithAllParameters(): void\n    {\n        $event = new GenericEvent();\n        $parameters = ['%name%' => 'User', '%id%' => 123];\n        $event->stop('User not found', GenericEvent::TYPE_WARNING, $parameters, 404);\n\n        $this->assertTrue($event->isStopped());\n        $this->assertSame('User not found', $event->getMessage());\n        $this->assertSame(GenericEvent::TYPE_WARNING, $event->getMessageType());\n        $this->assertSame($parameters, $event->getMessageParameters());\n        $this->assertSame(404, $event->getErrorCode());\n    }\n\n    public function testItHasTypeErrorConstant(): void\n    {\n        $this->assertSame('error', GenericEvent::TYPE_ERROR);\n    }\n\n    public function testItHasTypeWarningConstant(): void\n    {\n        $this->assertSame('warning', GenericEvent::TYPE_WARNING);\n    }\n\n    public function testItHasTypeInfoConstant(): void\n    {\n        $this->assertSame('info', GenericEvent::TYPE_INFO);\n    }\n\n    public function testItHasTypeSuccessConstant(): void\n    {\n        $this->assertSame('success', GenericEvent::TYPE_SUCCESS);\n    }\n\n    public function testItCanBeCreatedWithSubject(): void\n    {\n        $subject = new \\stdClass();\n        $event = new GenericEvent($subject);\n\n        $this->assertSame($subject, $event->getSubject());\n    }\n\n    public function testItCanBeCreatedWithSubjectAndArguments(): void\n    {\n        $subject = new \\stdClass();\n        $arguments = ['key1' => 'value1', 'key2' => 'value2'];\n        $event = new GenericEvent($subject, $arguments);\n\n        $this->assertSame($subject, $event->getSubject());\n        $this->assertSame('value1', $event->getArgument('key1'));\n        $this->assertSame('value2', $event->getArgument('key2'));\n    }\n\n    public function testItReturnsEmptyStringForMessageTypeByDefault(): void\n    {\n        $event = new GenericEvent();\n\n        $this->assertSame('', $event->getMessageType());\n    }\n\n    public function testItReturnsEmptyStringForMessageByDefault(): void\n    {\n        $event = new GenericEvent();\n\n        $this->assertSame('', $event->getMessage());\n    }\n\n    public function testItReturnsEmptyArrayForMessageParametersByDefault(): void\n    {\n        $event = new GenericEvent();\n\n        $this->assertSame([], $event->getMessageParameters());\n    }\n\n    public function testItReturns500ForErrorCodeByDefault(): void\n    {\n        $event = new GenericEvent();\n\n        $this->assertSame(500, $event->getErrorCode());\n    }\n\n    public function testItIsNotStoppedByDefault(): void\n    {\n        $event = new GenericEvent();\n\n        $this->assertFalse($event->isStopped());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/EventDispatcher/OperationEventDispatcherTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\EventDispatcher;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\BulkDelete;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEvent;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventDispatcher;\nuse Symfony\\Component\\EventDispatcher\\EventDispatcherInterface;\n\nfinal class OperationEventDispatcherTest extends TestCase\n{\n    private EventDispatcherInterface $eventDispatcher;\n\n    private OperationEventDispatcher $operationEventDispatcher;\n\n    protected function setUp(): void\n    {\n        $this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);\n        $this->operationEventDispatcher = new OperationEventDispatcher($this->eventDispatcher);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(OperationEventDispatcher::class, $this->operationEventDispatcher);\n    }\n\n    public function testItDispatchesEvents(): void\n    {\n        $data = new \\stdClass();\n        $resource = $this->createResource();\n        $show = (new Show(eventShortName: 'read'))->withResource($resource);\n        $context = new Context();\n\n        $this->eventDispatcher\n            ->expects($this->once())\n            ->method('dispatch')\n            ->with(\n                $this->callback(fn (OperationEvent $event) => $event->getSubject() === $data),\n                'app.book.read',\n            )\n            ->willReturnArgument(0);\n\n        $result = $this->operationEventDispatcher->dispatch($data, $show, $context);\n\n        $this->assertInstanceOf(OperationEvent::class, $result);\n    }\n\n    public function testItDispatchesEventsForBulkOperations(): void\n    {\n        $data = new \\ArrayObject();\n        $resource = $this->createResource();\n        $bulkDelete = (new BulkDelete(eventShortName: 'delete'))->withResource($resource);\n        $context = new Context();\n\n        $this->eventDispatcher\n            ->expects($this->once())\n            ->method('dispatch')\n            ->with(\n                $this->callback(fn (OperationEvent $event) => $event->getSubject() === $data),\n                'app.book.bulk_delete',\n            )\n            ->willReturnArgument(0);\n\n        $result = $this->operationEventDispatcher->dispatchBulkEvent($data, $bulkDelete, $context);\n\n        $this->assertInstanceOf(OperationEvent::class, $result);\n    }\n\n    public function testItDispatchesPreEvents(): void\n    {\n        $data = new \\stdClass();\n        $resource = $this->createResource();\n        $create = (new Create(eventShortName: 'create'))->withResource($resource);\n        $context = new Context();\n\n        $this->eventDispatcher\n            ->expects($this->once())\n            ->method('dispatch')\n            ->with(\n                $this->callback(fn (OperationEvent $event) => $event->getSubject() === $data),\n                'app.book.pre_create',\n            )\n            ->willReturnArgument(0);\n\n        $result = $this->operationEventDispatcher->dispatchPreEvent($data, $create, $context);\n\n        $this->assertInstanceOf(OperationEvent::class, $result);\n    }\n\n    public function testItDispatchesPostEvents(): void\n    {\n        $data = new \\stdClass();\n        $resource = $this->createResource();\n        $create = (new Create(eventShortName: 'create'))->withResource($resource);\n        $context = new Context();\n\n        $this->eventDispatcher\n            ->expects($this->once())\n            ->method('dispatch')\n            ->with(\n                $this->callback(fn (OperationEvent $event) => $event->getSubject() === $data),\n                'app.book.post_create',\n            )\n            ->willReturnArgument(0);\n\n        $result = $this->operationEventDispatcher->dispatchPostEvent($data, $create, $context);\n\n        $this->assertInstanceOf(OperationEvent::class, $result);\n    }\n\n    public function testItDispatchesInitializeEvents(): void\n    {\n        $data = new \\stdClass();\n        $resource = $this->createResource();\n        $create = (new Create(eventShortName: 'create'))->withResource($resource);\n        $context = new Context();\n\n        $this->eventDispatcher\n            ->expects($this->once())\n            ->method('dispatch')\n            ->with(\n                $this->callback(fn (OperationEvent $event) => $event->getSubject() === $data),\n                'app.book.initialize_create',\n            )\n            ->willReturnArgument(0);\n\n        $result = $this->operationEventDispatcher->dispatchInitializeEvent($data, $create, $context);\n\n        $this->assertInstanceOf(OperationEvent::class, $result);\n    }\n\n    public function testItReturnsEventWithoutDispatchingWhenResourceIsNull(): void\n    {\n        $data = new \\stdClass();\n        $create = new Create();\n        $context = new Context();\n\n        $this->eventDispatcher\n            ->expects($this->never())\n            ->method('dispatch');\n\n        $result = $this->operationEventDispatcher->dispatch($data, $create, $context);\n\n        $this->assertInstanceOf(OperationEvent::class, $result);\n        $this->assertSame($data, $result->getSubject());\n    }\n\n    public function testItReturnsEventWithoutDispatchingWhenResourceIsNullForBulkEvent(): void\n    {\n        $data = new \\ArrayObject();\n        $bulkDelete = new BulkDelete();\n        $context = new Context();\n\n        $this->eventDispatcher\n            ->expects($this->never())\n            ->method('dispatch');\n\n        $result = $this->operationEventDispatcher->dispatchBulkEvent($data, $bulkDelete, $context);\n\n        $this->assertInstanceOf(OperationEvent::class, $result);\n        $this->assertSame($data, $result->getSubject());\n    }\n\n    public function testItReturnsEventWithoutDispatchingWhenResourceIsNullForPreEvent(): void\n    {\n        $data = new \\stdClass();\n        $create = new Create();\n        $context = new Context();\n\n        $this->eventDispatcher\n            ->expects($this->never())\n            ->method('dispatch');\n\n        $result = $this->operationEventDispatcher->dispatchPreEvent($data, $create, $context);\n\n        $this->assertInstanceOf(OperationEvent::class, $result);\n        $this->assertSame($data, $result->getSubject());\n    }\n\n    public function testItReturnsEventWithoutDispatchingWhenResourceIsNullForPostEvent(): void\n    {\n        $data = new \\stdClass();\n        $create = new Create();\n        $context = new Context();\n\n        $this->eventDispatcher\n            ->expects($this->never())\n            ->method('dispatch');\n\n        $result = $this->operationEventDispatcher->dispatchPostEvent($data, $create, $context);\n\n        $this->assertInstanceOf(OperationEvent::class, $result);\n        $this->assertSame($data, $result->getSubject());\n    }\n\n    public function testItReturnsEventWithoutDispatchingWhenResourceIsNullForInitializeEvent(): void\n    {\n        $data = new \\stdClass();\n        $create = new Create();\n        $context = new Context();\n\n        $this->eventDispatcher\n            ->expects($this->never())\n            ->method('dispatch');\n\n        $result = $this->operationEventDispatcher->dispatchInitializeEvent($data, $create, $context);\n\n        $this->assertInstanceOf(OperationEvent::class, $result);\n        $this->assertSame($data, $result->getSubject());\n    }\n\n    private function createResource(): ResourceMetadata\n    {\n        return new ResourceMetadata(alias: 'app.book', name: 'book', applicationName: 'app');\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/EventDispatcher/OperationEventHandlerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\EventDispatcher;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\Update;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEvent;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventHandler;\nuse Sylius\\Resource\\Symfony\\Routing\\RedirectHandlerInterface;\nuse Sylius\\Resource\\Symfony\\Session\\Flash\\FlashHelperInterface;\nuse Symfony\\Component\\HttpFoundation\\RedirectResponse;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\HttpKernel\\Exception\\HttpException;\n\nfinal class OperationEventHandlerTest extends TestCase\n{\n    private RedirectHandlerInterface $redirectHandler;\n\n    private FlashHelperInterface $flashHelper;\n\n    private OperationEventHandler $operationEventHandler;\n\n    protected function setUp(): void\n    {\n        $this->redirectHandler = $this->createMock(RedirectHandlerInterface::class);\n        $this->flashHelper = $this->createMock(FlashHelperInterface::class);\n        $this->operationEventHandler = new OperationEventHandler($this->redirectHandler, $this->flashHelper);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(OperationEventHandler::class, $this->operationEventHandler);\n    }\n\n    public function testItReturnsNullWhenPreProcessEventIsNotStopped(): void\n    {\n        $event = new OperationEvent();\n        $context = new Context();\n\n        $this->flashHelper->expects($this->never())->method('addFlashFromEvent');\n        $this->redirectHandler->expects($this->never())->method('redirectToResource');\n        $this->redirectHandler->expects($this->never())->method('redirectToOperation');\n\n        $result = $this->operationEventHandler->handlePreProcessEvent($event, $context);\n\n        $this->assertNull($result);\n    }\n\n    public function testItThrowsAnHttpExceptionWhenPreProcessEventIsStoppedAndRequestFormatIsNotHtml(): void\n    {\n        $event = new OperationEvent();\n        $event->stop(message: 'What the hell is going on?', errorCode: 666);\n\n        $context = new Context();\n\n        try {\n            $this->operationEventHandler->handlePreProcessEvent($event, $context);\n            $this->fail('Expected HttpException to be thrown');\n        } catch (HttpException $e) {\n            $this->assertSame('What the hell is going on?', $e->getMessage());\n            $this->assertSame(666, $e->getStatusCode());\n        }\n    }\n\n    public function testItReturnsResponseFromPreProcessEventWhenItHasOneAndRequestFormatIsHtml(): void\n    {\n        $response = $this->createMock(Response::class);\n        $request = $this->createMock(Request::class);\n\n        $event = new OperationEvent();\n        $event->stop(message: 'What the hell is going on?', errorCode: 666);\n        $event->setResponse($response);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->method('getRequestFormat')->willReturn('html');\n\n        $this->flashHelper->expects($this->once())->method('addFlashFromEvent')->with($event, $context);\n\n        $result = $this->operationEventHandler->handlePreProcessEvent($event, $context);\n\n        $this->assertSame($response, $result);\n    }\n\n    public function testItDoesNotReturnsResponseFromPreProcessEventWhenRequestFormatIsNotHtml(): void\n    {\n        $response = $this->createMock(Response::class);\n        $request = $this->createMock(Request::class);\n\n        $event = new OperationEvent();\n        $event->stop(message: 'What the hell is going on?', errorCode: 666);\n        $event->setResponse($response);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->method('getRequestFormat')->willReturn('json');\n\n        try {\n            $this->operationEventHandler->handlePreProcessEvent($event, $context);\n            $this->fail('Expected HttpException to be thrown');\n        } catch (HttpException $e) {\n            $this->assertSame('What the hell is going on?', $e->getMessage());\n            $this->assertSame(666, $e->getStatusCode());\n        }\n    }\n\n    public function testItCanRedirectToResourceWhenPreProcessEventIsStoppedAndHasNoResponseAndOperationIsAnHttpOperation(): void\n    {\n        $data = new \\stdClass();\n        $request = $this->createMock(Request::class);\n        $redirectResponse = $this->createMock(RedirectResponse::class);\n\n        $event = new OperationEvent($data);\n        $event->stop(message: 'What the hell is going on?', errorCode: 666);\n\n        $operation = new Update();\n        $event->setArgument('operation', $operation);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->method('getRequestFormat')->willReturn('html');\n\n        $this->flashHelper->expects($this->once())->method('addFlashFromEvent')->with($event, $context);\n        $this->redirectHandler\n            ->expects($this->once())\n            ->method('redirectToResource')\n            ->with($data, $operation, $request)\n            ->willReturn($redirectResponse);\n\n        $result = $this->operationEventHandler->handlePreProcessEvent($event, $context);\n\n        $this->assertInstanceOf(RedirectResponse::class, $result);\n    }\n\n    public function testItCanRedirectToOperationWhenPreProcessEventIsStoppedAndHasNoResponseAndOperationIsAnHttpOperation(): void\n    {\n        $data = new \\stdClass();\n        $request = $this->createMock(Request::class);\n        $redirectResponse = $this->createMock(RedirectResponse::class);\n\n        $event = new OperationEvent($data);\n        $event->stop(message: 'What the hell is going on?', errorCode: 666);\n\n        $operation = new Update();\n        $event->setArgument('operation', $operation);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->method('getRequestFormat')->willReturn('html');\n\n        $this->flashHelper->expects($this->once())->method('addFlashFromEvent')->with($event, $context);\n        $this->redirectHandler\n            ->expects($this->once())\n            ->method('redirectToOperation')\n            ->with($data, $operation, $request, 'index')\n            ->willReturn($redirectResponse);\n\n        $result = $this->operationEventHandler->handlePreProcessEvent($event, $context, 'index');\n\n        $this->assertInstanceOf(RedirectResponse::class, $result);\n    }\n\n    public function testItReturnsNullWhenPreProcessEventIsStoppedAndHasNoResponseAndOperationIsNotAnHttpOperation(): void\n    {\n        $data = new \\stdClass();\n        $request = $this->createMock(Request::class);\n        $operation = $this->createMock(Operation::class);\n\n        $event = new OperationEvent($data);\n        $event->stop(message: 'What the hell is going on?', errorCode: 666);\n        $event->setArgument('operation', $operation);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->method('getRequestFormat')->willReturn('html');\n\n        $this->flashHelper->expects($this->once())->method('addFlashFromEvent')->with($event, $context);\n\n        $result = $this->operationEventHandler->handlePreProcessEvent($event, $context);\n\n        $this->assertNull($result);\n    }\n\n    public function testItReturnsPostProcessEventResponseWhenRequestFormatIsHtml(): void\n    {\n        $data = new \\stdClass();\n        $request = $this->createMock(Request::class);\n        $response = $this->createMock(Response::class);\n\n        $event = new OperationEvent($data);\n        $event->setResponse($response);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->method('getRequestFormat')->willReturn('html');\n\n        $result = $this->operationEventHandler->handlePostProcessEvent($event, $context);\n\n        $this->assertSame($response, $result);\n    }\n\n    public function testItReturnsNullForPostProcessEventWhenRequestFormatIsHtmlButEventHasNoResponse(): void\n    {\n        $data = new \\stdClass();\n        $request = $this->createMock(Request::class);\n\n        $event = new OperationEvent($data);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->method('getRequestFormat')->willReturn('html');\n\n        $result = $this->operationEventHandler->handlePostProcessEvent($event, $context);\n\n        $this->assertNull($result);\n    }\n\n    public function testItReturnsNullForPostProcessEventWhenRequestFormatIsNotHtml(): void\n    {\n        $data = new \\stdClass();\n        $request = $this->createMock(Request::class);\n\n        $event = new OperationEvent($data);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->method('getRequestFormat')->willReturn('json');\n\n        $result = $this->operationEventHandler->handlePostProcessEvent($event, $context);\n\n        $this->assertNull($result);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/EventDispatcher/OperationEventTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\EventDispatcher;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEvent;\n\nfinal class OperationEventTest extends TestCase\n{\n    public function testItIsInitializable(): void\n    {\n        $event = new OperationEvent();\n\n        $this->assertInstanceOf(OperationEvent::class, $event);\n    }\n\n    public function testItCanBeCreatedWithSubject(): void\n    {\n        $subject = new \\stdClass();\n        $event = new OperationEvent($subject);\n\n        $this->assertSame($subject, $event->getSubject());\n    }\n\n    public function testItCanGetOperation(): void\n    {\n        $operation = new Create();\n        $event = new OperationEvent();\n        $event->setArgument('operation', $operation);\n\n        $this->assertSame($operation, $event->getOperation());\n    }\n\n    public function testItCanGetContext(): void\n    {\n        $context = new Context();\n        $event = new OperationEvent();\n        $event->setArgument('context', $context);\n\n        $this->assertSame($context, $event->getContext());\n    }\n\n    public function testItCanGetOperationAndContext(): void\n    {\n        $operation = new Create();\n        $context = new Context();\n        $subject = new \\stdClass();\n\n        $event = new OperationEvent($subject);\n        $event->setArgument('operation', $operation);\n        $event->setArgument('context', $context);\n\n        $this->assertSame($subject, $event->getSubject());\n        $this->assertSame($operation, $event->getOperation());\n        $this->assertSame($context, $event->getContext());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/EventDispatcher/State/DispatchPostReadEventProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\EventDispatcher\\State;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEvent;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventDispatcherInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\State\\DispatchPostReadEventProvider;\n\nfinal class DispatchPostReadEventProviderTest extends TestCase\n{\n    private ProviderInterface $provider;\n\n    private OperationEventDispatcherInterface $operationEventDispatcher;\n\n    private DispatchPostReadEventProvider $dispatchPostReadEventProvider;\n\n    protected function setUp(): void\n    {\n        $this->provider = $this->createMock(ProviderInterface::class);\n        $this->operationEventDispatcher = $this->createMock(OperationEventDispatcherInterface::class);\n        $this->dispatchPostReadEventProvider = new DispatchPostReadEventProvider(\n            $this->provider,\n            $this->operationEventDispatcher,\n        );\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(DispatchPostReadEventProvider::class, $this->dispatchPostReadEventProvider);\n    }\n\n    public function testItDispatchesEventsForIndexOperation(): void\n    {\n        $operation = new Index(provider: '\\App\\Provider');\n        $context = new Context();\n        $operationEvent = new OperationEvent();\n\n        $this->provider->expects($this->once())->method('provide')->with($operation, $context);\n        $this->operationEventDispatcher\n            ->expects($this->once())\n            ->method('dispatch')\n            ->with(null, $operation, $context)\n            ->willReturn($operationEvent);\n\n        $this->dispatchPostReadEventProvider->provide($operation, $context);\n    }\n\n    public function testItDispatchesEventsForShowOperation(): void\n    {\n        $operation = new Show(provider: '\\App\\Provider');\n        $context = new Context();\n        $operationEvent = new OperationEvent();\n\n        $this->provider->expects($this->once())->method('provide')->with($operation, $context);\n        $this->operationEventDispatcher\n            ->expects($this->once())\n            ->method('dispatch')\n            ->with(null, $operation, $context)\n            ->willReturn($operationEvent);\n\n        $this->dispatchPostReadEventProvider->provide($operation, $context);\n    }\n\n    public function testItDoesNotDispatchEventsForCreateOperation(): void\n    {\n        $operation = new Create(provider: '\\App\\Provider');\n        $context = new Context();\n\n        $this->provider->expects($this->once())->method('provide')->with($operation, $context);\n        $this->operationEventDispatcher->expects($this->never())->method('dispatch');\n\n        $this->dispatchPostReadEventProvider->provide($operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/EventDispatcher/State/DispatchPostWriteEventProcessorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace spec\\Sylius\\Resource\\State\\Processor;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEvent;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventDispatcherInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventHandlerInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\State\\DispatchPostWriteEventProcessor;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nfinal class DispatchPostWriteEventProcessorTest extends TestCase\n{\n    private ProcessorInterface|MockObject $processor;\n\n    private OperationEventDispatcherInterface|MockObject $operationEventDispatcher;\n\n    private OperationEventHandlerInterface|MockObject $eventHandler;\n\n    private DispatchPostWriteEventProcessor $dispatchPostWriteEventProcessor;\n\n    protected function setUp(): void\n    {\n        $this->processor = $this->createMock(ProcessorInterface::class);\n        $this->operationEventDispatcher = $this->createMock(OperationEventDispatcherInterface::class);\n        $this->eventHandler = $this->createMock(OperationEventHandlerInterface::class);\n\n        $this->dispatchPostWriteEventProcessor = new DispatchPostWriteEventProcessor(\n            $this->processor,\n            $this->operationEventDispatcher,\n            $this->eventHandler,\n        );\n    }\n\n    /** @test */\n    public function it_dispatches_post_events_with_operation_as_string(): void\n    {\n        $data = new \\stdClass();\n\n        $operation = new Create(processor: '\\App\\Processor');\n        $context = new Context();\n\n        $this->processor->expects($this->once())->method('process')->with($data, $operation, $context)->willReturn($data);\n\n        $postEvent = new OperationEvent();\n\n        $this->operationEventDispatcher->expects($this->once())->method('dispatchPostEvent')->with($data, $operation, $context)->willReturn($postEvent);\n\n        $this->eventHandler->expects($this->once())->method('handlePostProcessEvent')->with($postEvent, $context)->willReturn(null);\n\n        $result = $this->dispatchPostWriteEventProcessor->process($data, $operation, $context);\n        $this->assertEquals($data, $result);\n    }\n\n    /** @test */\n    public function it_returns_post_event_response(): void\n    {\n        $data = new \\stdClass();\n        $response = new Response();\n\n        $operation = new Create(processor: '\\App\\Processor');\n        $context = new Context();\n\n        $this->processor->expects($this->once())->method('process')->with($data, $operation, $context)->willReturn($data);\n\n        $postEvent = new OperationEvent();\n\n        $this->operationEventDispatcher->expects($this->once())->method('dispatchPostEvent')->with($data, $operation, $context)->willReturn($postEvent);\n\n        $this->eventHandler->expects($this->once())->method('handlePostProcessEvent')->with($postEvent, $context)->willReturn($response);\n\n        $result = $this->dispatchPostWriteEventProcessor->process($data, $operation, $context);\n        $this->assertEquals($response, $result);\n    }\n\n    /** @test */\n    public function it_does_nothing_if_the_decorated_processor_returns_a_response(): void\n    {\n        $data = new \\stdClass();\n\n        $operation = new Create(processor: '\\App\\Processor');\n        $context = new Context();\n\n        $response = new Response();\n\n        $this->processor->expects($this->once())->method('process')->with($data, $operation, $context)->willReturn($response);\n\n        $this->operationEventDispatcher->expects($this->never())->method('dispatchPostEvent');\n\n        $this->eventHandler->expects($this->never())->method('handlePostProcessEvent');\n\n        $this->dispatchPostWriteEventProcessor->process($data, $operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/EventDispatcher/State/DispatchPreWriteEventProcessorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace spec\\Sylius\\Resource\\Symfony\\EventDispatcher\\State;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEvent;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventDispatcherInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEventHandlerInterface;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\State\\DispatchPreWriteEventProcessor;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nfinal class DispatchPreWriteEventProcessorTest extends TestCase\n{\n    private ProcessorInterface|MockObject $processor;\n\n    private OperationEventDispatcherInterface|MockObject $operationEventDispatcher;\n\n    private OperationEventHandlerInterface|MockObject $eventHandler;\n\n    private DispatchPreWriteEventProcessor $dispatchPreWriteEventProcessor;\n\n    protected function setUp(): void\n    {\n        $this->processor = $this->createMock(ProcessorInterface::class);\n        $this->operationEventDispatcher = $this->createMock(OperationEventDispatcherInterface::class);\n        $this->eventHandler = $this->createMock(OperationEventHandlerInterface::class);\n\n        $this->dispatchPreWriteEventProcessor = new DispatchPreWriteEventProcessor(\n            $this->processor,\n            $this->operationEventDispatcher,\n            $this->eventHandler,\n        );\n    }\n\n    /** @test */\n    public function it_dispatches_pre_events(): void\n    {\n        $data = new \\stdClass();\n\n        $operation = new Create(processor: '\\App\\Processor');\n        $context = new Context();\n\n        $preEvent = new OperationEvent();\n\n        $this->operationEventDispatcher->expects($this->once())->method('dispatchPreEvent')->with($data, $operation, $context)->willReturn($preEvent);\n\n        $this->eventHandler->expects($this->once())->method('handlePreProcessEvent')->with($preEvent, $context, 'index')->willReturn(null);\n\n        $this->processor->expects($this->once())->method('process')->with($data, $operation, $context)->willReturn($data);\n\n        $result = $this->dispatchPreWriteEventProcessor->process($data, $operation, $context);\n        $this->assertEquals($data, $result);\n    }\n\n    /** @test */\n    public function it_does_not_call_processor_if_pre_event_returns_a_response(): void\n    {\n        $data = new \\stdClass();\n        $response = new Response();\n\n        $operation = new Create(processor: '\\App\\Processor');\n        $context = new Context();\n\n        $preEvent = new OperationEvent();\n\n        $this->operationEventDispatcher->expects($this->once())->method('dispatchPreEvent')->with($data, $operation, $context)->willReturn($preEvent);\n\n        $this->eventHandler->expects($this->once())->method('handlePreProcessEvent')->with($preEvent, $context, 'index')->willReturn($response);\n\n        $this->processor->expects($this->never())->method('process');\n\n        $result = $this->dispatchPreWriteEventProcessor->process($data, $operation, $context);\n        $this->assertEquals($response, $result);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/EventListener/AddFormatListenerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\EventListener;\n\nuse Negotiation\\Negotiator;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Operation\\HttpOperationInitiatorInterface;\nuse Sylius\\Resource\\Symfony\\EventListener\\AddFormatListener;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpKernel\\Event\\RequestEvent;\nuse Symfony\\Component\\HttpKernel\\Exception\\NotAcceptableHttpException;\nuse Symfony\\Component\\HttpKernel\\HttpKernelInterface;\nuse Symfony\\Component\\HttpKernel\\KernelInterface;\n\nfinal class AddFormatListenerTest extends TestCase\n{\n    private HttpOperationInitiatorInterface $operationInitiator;\n\n    private Negotiator $negotiator;\n\n    private AddFormatListener $addFormatListener;\n\n    protected function setUp(): void\n    {\n        $this->operationInitiator = $this->createMock(HttpOperationInitiatorInterface::class);\n        $this->negotiator = new Negotiator();\n        $this->addFormatListener = new AddFormatListener($this->operationInitiator, $this->negotiator);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(AddFormatListener::class, $this->addFormatListener);\n    }\n\n    public function testItDoesNothingWhenOperationIsNull(): void\n    {\n        $request = new Request();\n        $event = $this->createRequestEvent($request);\n\n        $this->operationInitiator\n            ->expects($this->once())\n            ->method('initializeOperation')\n            ->with($request)\n            ->willReturn(null);\n\n        $this->addFormatListener->onKernelRequest($event);\n    }\n\n    public function testItSetsFormatFromAcceptHeaderWhenMediaTypeIsNegotiated(): void\n    {\n        $request = new Request();\n        $request->headers->set('Accept', 'application/json');\n\n        $event = $this->createRequestEvent($request);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $this->operationInitiator\n            ->method('initializeOperation')\n            ->with($request)\n            ->willReturn($operation);\n\n        $this->addFormatListener->onKernelRequest($event);\n\n        $this->assertSame('json', $request->getRequestFormat());\n    }\n\n    public function testItSetsFormatFromAcceptHeaderForXml(): void\n    {\n        $request = new Request();\n        $request->headers->set('Accept', 'application/xml');\n\n        $event = $this->createRequestEvent($request);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $this->operationInitiator\n            ->method('initializeOperation')\n            ->with($request)\n            ->willReturn($operation);\n\n        $this->addFormatListener->onKernelRequest($event);\n\n        $this->assertSame('xml', $request->getRequestFormat());\n    }\n\n    public function testItSetsFormatFromAcceptHeaderForHtml(): void\n    {\n        $request = new Request();\n        $request->headers->set('Accept', 'text/html');\n\n        $event = $this->createRequestEvent($request);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $this->operationInitiator\n            ->method('initializeOperation')\n            ->with($request)\n            ->willReturn($operation);\n\n        $this->addFormatListener->onKernelRequest($event);\n\n        $this->assertSame('html', $request->getRequestFormat());\n    }\n\n    public function testItDoesNothingWhenAcceptHeaderIsNullAndRequestFormatIsNotSet(): void\n    {\n        $request = new Request();\n        $event = $this->createRequestEvent($request);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $this->operationInitiator\n            ->method('initializeOperation')\n            ->with($request)\n            ->willReturn($operation);\n\n        $this->addFormatListener->onKernelRequest($event);\n\n        $this->assertNull($request->getRequestFormat(null));\n    }\n\n    public function testItDoesNothingWhenMediaTypeCannotBeNegotiatedAndRequestFormatIsSupported(): void\n    {\n        $request = new Request();\n        $request->headers->set('Accept', 'application/pdf');\n        $request->setRequestFormat('json');\n\n        $event = $this->createRequestEvent($request);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $this->operationInitiator\n            ->method('initializeOperation')\n            ->with($request)\n            ->willReturn($operation);\n\n        $this->addFormatListener->onKernelRequest($event);\n\n        $this->assertSame('json', $request->getRequestFormat());\n    }\n\n    public function testItThrowsExceptionWhenMediaTypeCannotBeNegotiatedAndRequestFormatIsUnsupported(): void\n    {\n        $request = new Request();\n        $request->headers->set('Accept', 'application/pdf');\n        $request->setRequestFormat('pdf');\n\n        $event = $this->createRequestEvent($request);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $this->operationInitiator\n            ->method('initializeOperation')\n            ->with($request)\n            ->willReturn($operation);\n\n        $this->expectException(NotAcceptableHttpException::class);\n\n        $this->addFormatListener->onKernelRequest($event);\n    }\n\n    public function testItThrowsExceptionWhenRequestFormatHasNoMimeType(): void\n    {\n        $request = new Request();\n        $request->headers->set('Accept', 'application/unknown');\n        $request->setRequestFormat('unknown');\n\n        $event = $this->createRequestEvent($request);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $this->operationInitiator\n            ->method('initializeOperation')\n            ->with($request)\n            ->willReturn($operation);\n\n        $this->expectException(NotAcceptableHttpException::class);\n        $this->expectExceptionMessage('Requested format \"\" is not supported. Supported MIME types are \"text/html\", \"application/json\", \"application/xml\".');\n\n        $this->addFormatListener->onKernelRequest($event);\n    }\n\n    public function testItHandlesComplexAcceptHeaderWithMultipleTypes(): void\n    {\n        $request = new Request();\n        $request->headers->set('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8');\n\n        $event = $this->createRequestEvent($request);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $this->operationInitiator\n            ->method('initializeOperation')\n            ->with($request)\n            ->willReturn($operation);\n\n        $this->addFormatListener->onKernelRequest($event);\n\n        $this->assertSame('html', $request->getRequestFormat());\n    }\n\n    public function testItDoesNotOverrideFormatWhenRequestFormatIsHtml(): void\n    {\n        $request = new Request();\n        $request->headers->set('Accept', 'application/pdf');\n        $request->setRequestFormat('html');\n\n        $event = $this->createRequestEvent($request);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $this->operationInitiator\n            ->method('initializeOperation')\n            ->with($request)\n            ->willReturn($operation);\n\n        $this->addFormatListener->onKernelRequest($event);\n\n        $this->assertSame('html', $request->getRequestFormat());\n    }\n\n    private function createRequestEvent(Request $request): RequestEvent\n    {\n        $kernel = $this->createMock(KernelInterface::class);\n\n        return new RequestEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/ExpressionLanguage/ArgumentParserTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\ExpressionLanguage;\n\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\ArgumentParserInterface;\nuse Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase;\n\nfinal class ArgumentParserTest extends KernelTestCase\n{\n    public function testMetadataArgumentParser(): void\n    {\n        self::bootKernel();\n\n        $container = static::getContainer();\n\n        /** @var ArgumentParserInterface $argumentParser */\n        $argumentParser = $container->get('sylius.expression_language.argument_parser.metadata');\n\n        $this->assertInstanceOf(ArgumentParserInterface::class, $argumentParser);\n        $this->assertTrue($argumentParser->parseExpression('token.getUser() === null'));\n        $this->assertTrue($argumentParser->parseExpression('user === null'));\n        $this->assertTrue($argumentParser->parseExpression('request === null'));\n        $this->assertTrue($argumentParser->parseExpression('throw_not_found_on_null(true)'));\n    }\n\n    public function testResourceFactoryArgumentParser(): void\n    {\n        self::bootKernel();\n\n        $container = static::getContainer();\n\n        /** @var ArgumentParserInterface $argumentParser */\n        $argumentParser = $container->get('sylius.expression_language.argument_parser.factory');\n\n        $this->assertInstanceOf(ArgumentParserInterface::class, $argumentParser);\n        $this->assertTrue($argumentParser->parseExpression('token.getUser() === null'));\n        $this->assertTrue($argumentParser->parseExpression('user === null'));\n        $this->assertTrue($argumentParser->parseExpression('request === null'));\n        $this->assertTrue($argumentParser->parseExpression('throw_not_found_on_null(true)'));\n    }\n\n    public function testRepositoryArgumentParser(): void\n    {\n        self::bootKernel();\n\n        $container = static::getContainer();\n\n        /** @var ArgumentParserInterface $argumentParser */\n        $argumentParser = $container->get('sylius.expression_language.argument_parser.repository');\n\n        $this->assertInstanceOf(ArgumentParserInterface::class, $argumentParser);\n        $this->assertTrue($argumentParser->parseExpression('token.getUser() === null'));\n        $this->assertTrue($argumentParser->parseExpression('user === null'));\n        $this->assertTrue($argumentParser->parseExpression('request === null'));\n    }\n\n    public function testRoutingArgumentParser(): void\n    {\n        self::bootKernel();\n\n        $container = static::getContainer();\n\n        /** @var ArgumentParserInterface $argumentParser */\n        $argumentParser = $container->get('sylius.expression_language.argument_parser.routing');\n        $this->assertTrue($argumentParser->parseExpression('request === null'));\n\n        $this->assertInstanceOf(ArgumentParserInterface::class, $argumentParser);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/ExpressionLanguage/Provider/ThrowNotFoundOnNullExpressionFunctionProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\ExpressionLanguage\\Provider;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\Provider\\ThrowNotFoundOnNullExpressionFunctionProvider;\nuse Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage;\nuse Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException;\n\nfinal class ThrowNotFoundOnNullExpressionFunctionProviderTest extends TestCase\n{\n    private ExpressionLanguage $expressionLanguage;\n\n    private ThrowNotFoundOnNullExpressionFunctionProvider $provider;\n\n    protected function setUp(): void\n    {\n        $this->provider = new ThrowNotFoundOnNullExpressionFunctionProvider();\n        $this->expressionLanguage = new ExpressionLanguage();\n        $this->expressionLanguage->registerProvider($this->provider);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(ThrowNotFoundOnNullExpressionFunctionProvider::class, $this->provider);\n    }\n\n    public function testItProvidesFunctions(): void\n    {\n        $functions = $this->provider->getFunctions();\n\n        $this->assertIsArray($functions);\n        $this->assertCount(1, $functions);\n        $this->assertContainsOnlyInstancesOf(\\Symfony\\Component\\ExpressionLanguage\\ExpressionFunction::class, $functions);\n    }\n\n    public function testItReturnsTheValueWhenNotNull(): void\n    {\n        $result = $this->expressionLanguage->evaluate('throw_not_found_on_null(value)', [\n            'value' => 'foo',\n        ]);\n\n        $this->assertSame('foo', $result);\n    }\n\n    public function testItReturnsNumericValue(): void\n    {\n        $result = $this->expressionLanguage->evaluate('throw_not_found_on_null(value)', [\n            'value' => 123,\n        ]);\n\n        $this->assertSame(123, $result);\n    }\n\n    public function testItReturnsArrayValue(): void\n    {\n        $result = $this->expressionLanguage->evaluate('throw_not_found_on_null(value)', [\n            'value' => ['key' => 'value'],\n        ]);\n\n        $this->assertSame(['key' => 'value'], $result);\n    }\n\n    public function testItReturnsObjectValue(): void\n    {\n        $object = new \\stdClass();\n        $object->property = 'value';\n\n        $result = $this->expressionLanguage->evaluate('throw_not_found_on_null(value)', [\n            'value' => $object,\n        ]);\n\n        $this->assertSame($object, $result);\n        $this->assertSame('value', $result->property);\n    }\n\n    public function testItReturnsFalseValue(): void\n    {\n        $result = $this->expressionLanguage->evaluate('throw_not_found_on_null(value)', [\n            'value' => false,\n        ]);\n\n        $this->assertFalse($result);\n    }\n\n    public function testItReturnsZeroValue(): void\n    {\n        $result = $this->expressionLanguage->evaluate('throw_not_found_on_null(value)', [\n            'value' => 0,\n        ]);\n\n        $this->assertSame(0, $result);\n    }\n\n    public function testItReturnsEmptyStringValue(): void\n    {\n        $result = $this->expressionLanguage->evaluate('throw_not_found_on_null(value)', [\n            'value' => '',\n        ]);\n\n        $this->assertSame('', $result);\n    }\n\n    public function testItThrowsNotFoundExceptionWhenNullWithEmptyMessage(): void\n    {\n        $this->expectException(NotFoundHttpException::class);\n        $this->expectExceptionMessage('');\n\n        $this->expressionLanguage->evaluate('throw_not_found_on_null(value)', [\n            'value' => null,\n        ]);\n    }\n\n    public function testItThrowsNotFoundExceptionWhenNullWithCustomMessage(): void\n    {\n        $this->expectException(NotFoundHttpException::class);\n        $this->expectExceptionMessage('Custom message.');\n\n        $this->expressionLanguage->evaluate('throw_not_found_on_null(value, \"Custom message.\")', [\n            'value' => null,\n        ]);\n    }\n\n    public function testItThrowsNotFoundExceptionWithDetailedMessage(): void\n    {\n        $this->expectException(NotFoundHttpException::class);\n        $this->expectExceptionMessage('Resource with ID 123 was not found.');\n\n        $this->expressionLanguage->evaluate('throw_not_found_on_null(value, \"Resource with ID 123 was not found.\")', [\n            'value' => null,\n        ]);\n    }\n\n    public function testItCompilesExpressionWithoutMessage(): void\n    {\n        $compiled = $this->expressionLanguage->compile('throw_not_found_on_null(value)', ['value']);\n\n        $this->assertIsString($compiled);\n        $this->assertStringContainsString('null !== $value', $compiled);\n        $this->assertStringContainsString('NotFoundHttpException()', $compiled);\n        $this->assertSame(\n            '(null !== $value) ? $value : throw new \\Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException()',\n            $compiled,\n        );\n    }\n\n    public function testItCompilesExpressionWithMessage(): void\n    {\n        $compiled = $this->expressionLanguage->compile('throw_not_found_on_null(value, \"Not found\")', ['value']);\n\n        $this->assertIsString($compiled);\n        $this->assertStringContainsString('null !== $value', $compiled);\n        $this->assertStringContainsString('NotFoundHttpException(\"Not found\")', $compiled);\n        $this->assertSame(\n            '(null !== $value) ? $value : throw new \\Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException(\"Not found\")',\n            $compiled,\n        );\n    }\n\n    public function testItCompilesExpressionWithComplexMessage(): void\n    {\n        $compiled = $this->expressionLanguage->compile(\n            'throw_not_found_on_null(value, \"Resource not found with the given parameters\")',\n            ['value'],\n        );\n\n        $this->assertIsString($compiled);\n        $this->assertStringContainsString('NotFoundHttpException(\"Resource not found with the given parameters\")', $compiled);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/ExpressionLanguage/RequestVariablesTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\ExpressionLanguage;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\RequestVariables;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\RequestStack;\n\nfinal class RequestVariablesTest extends TestCase\n{\n    private RequestStack $requestStack;\n\n    private RequestVariables $requestVariables;\n\n    protected function setUp(): void\n    {\n        $this->requestStack = $this->createMock(RequestStack::class);\n        $this->requestVariables = new RequestVariables($this->requestStack);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(RequestVariables::class, $this->requestVariables);\n    }\n\n    public function testItReturnsRequestVars(): void\n    {\n        $request = $this->createMock(Request::class);\n        $this->requestStack->method('getCurrentRequest')->willReturn($request);\n\n        $result = $this->requestVariables->getVariables();\n\n        $this->assertSame(['request' => $request], $result);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/ExpressionLanguage/SyliusRepositoriesVariablesTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\ExpressionLanguage;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\SyliusRepositoriesVariables;\n\nfinal class SyliusRepositoriesVariablesTest extends TestCase\n{\n    public function testItReturnsTheSyliusRepositoryVariables(): void\n    {\n        $syliusRepositories = $this->createMock(ContainerInterface::class);\n\n        $syliusRepositoriesVariables = new SyliusRepositoriesVariables($syliusRepositories);\n\n        $this->assertSame(['sylius_repositories' => $syliusRepositories], $syliusRepositoriesVariables->getVariables());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/ExpressionLanguage/TokenVariablesTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\ExpressionLanguage;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\TokenVariables;\nuse Symfony\\Component\\Security\\Core\\Authentication\\Token\\NullToken;\nuse Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorageInterface;\nuse Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface;\nuse Symfony\\Component\\Security\\Core\\User\\UserInterface;\n\nfinal class TokenVariablesTest extends TestCase\n{\n    private TokenStorageInterface $tokenStorage;\n\n    private TokenVariables $tokenVariables;\n\n    protected function setUp(): void\n    {\n        $this->tokenStorage = $this->createMock(TokenStorageInterface::class);\n        $this->tokenVariables = new TokenVariables($this->tokenStorage);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(TokenVariables::class, $this->tokenVariables);\n    }\n\n    public function testItReturnsTokenAndUserVars(): void\n    {\n        $token = $this->createMock(TokenInterface::class);\n        $user = $this->createMock(UserInterface::class);\n\n        $this->tokenStorage->method('getToken')->willReturn($token);\n        $token->method('getUser')->willReturn($user);\n\n        $result = $this->tokenVariables->getVariables();\n\n        $this->assertSame(['token' => $token, 'user' => $user], $result);\n    }\n\n    public function testItReturnsANullTokenIfThereIsNoTokenOnStorage(): void\n    {\n        $this->tokenStorage->method('getToken')->willReturn(null);\n\n        $result = $this->tokenVariables->getVariables();\n\n        $this->assertInstanceOf(NullToken::class, $result['token']);\n    }\n\n    public function testItCanReturnNullAsUser(): void\n    {\n        $token = $this->createMock(TokenInterface::class);\n        $token->method('getUser')->willReturn(null);\n\n        $this->tokenStorage->method('getToken')->willReturn($token);\n\n        $result = $this->tokenVariables->getVariables();\n\n        $this->assertSame(['token' => $token, 'user' => null], $result);\n    }\n\n    public function testItThrowsAnExceptionWhenThereIsNoTokenStorage(): void\n    {\n        $tokenVariables = new TokenVariables(null);\n\n        $this->expectException(\\LogicException::class);\n        $this->expectExceptionMessage('The \"symfony/security-bundle\" must be installed and configured to use the \"token\" & \"user\" attribute. Try running \"composer require symfony/security-bundle\"');\n\n        $tokenVariables->getVariables();\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/ExpressionLanguage/VariablesCollectionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\ExpressionLanguage;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\VariablesCollection;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\VariablesInterface;\n\nfinal class VariablesCollectionTest extends TestCase\n{\n    public function testItIsInitializable(): void\n    {\n        $firstVariables = $this->createMock(VariablesInterface::class);\n        $secondVariables = $this->createMock(VariablesInterface::class);\n\n        $variablesCollection = new VariablesCollection([$firstVariables, $secondVariables]);\n\n        $this->assertInstanceOf(VariablesCollection::class, $variablesCollection);\n    }\n\n    public function testItMergesVariables(): void\n    {\n        $firstVariables = $this->createMock(VariablesInterface::class);\n        $secondVariables = $this->createMock(VariablesInterface::class);\n\n        $firstVariables->method('getVariables')->willReturn(['foo' => 'bar', 'user' => '123']);\n        $secondVariables->method('getVariables')->willReturn(['foo' => 'fighters', 'value' => 'xyz']);\n\n        $variablesCollection = new VariablesCollection([$firstVariables, $secondVariables]);\n\n        $result = $variablesCollection->getVariables();\n\n        $this->assertSame([\n            'foo' => 'fighters',\n            'user' => '123',\n            'value' => 'xyz',\n        ], $result);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/ExpressionLanguage/VarsResolverTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\ExpressionLanguage;\n\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\VarsResolverInterface;\nuse Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase;\n\nfinal class VarsResolverTest extends KernelTestCase\n{\n    private VarsResolverInterface $varsResolver;\n\n    protected function setUp(): void\n    {\n        $container = static::getContainer();\n\n        /** @var VarsResolverInterface $varsResolver */\n        $this->varsResolver = $container->get('sylius.expression_language.vars_resolver.metadata');\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(VarsResolverInterface::class, $this->varsResolver);\n    }\n\n    public function testItResolvesSimpleExpression(): void\n    {\n        $result = $this->varsResolver->resolve(['has_user' => '@=token.getUser() === null']);\n\n        $this->assertIsArray($result);\n        $this->assertArrayHasKey('has_user', $result);\n        $this->assertTrue($result['has_user']);\n    }\n\n    public function testItResolvesNestedExpression(): void\n    {\n        $result = $this->varsResolver->resolve(['parameters' => ['has_user' => '@=token.getUser() === null']]);\n\n        $this->assertIsArray($result);\n        $this->assertArrayHasKey('parameters', $result);\n        $this->assertIsArray($result['parameters']);\n        $this->assertArrayHasKey('has_user', $result['parameters']);\n        $this->assertTrue($result['parameters']['has_user']);\n    }\n\n    public function testItDoesNotProcessStringValuesWithoutExpressionPrefix(): void\n    {\n        $result = $this->varsResolver->resolve(['name' => 'John']);\n\n        $this->assertIsArray($result);\n        $this->assertArrayHasKey('name', $result);\n        $this->assertSame('John', $result['name']);\n    }\n\n    public function testItDoesNotProcessNumericStrings(): void\n    {\n        $result = $this->varsResolver->resolve(['count' => '123']);\n\n        $this->assertIsArray($result);\n        $this->assertArrayHasKey('count', $result);\n        $this->assertSame('123', $result['count']);\n    }\n\n    public function testItDoesNotProcessBooleanStrings(): void\n    {\n        $result = $this->varsResolver->resolve(['flag' => 'true']);\n\n        $this->assertIsArray($result);\n        $this->assertArrayHasKey('flag', $result);\n        $this->assertSame('true', $result['flag']);\n    }\n\n    public function testItDoesNotProcessEmptyStrings(): void\n    {\n        $result = $this->varsResolver->resolve(['empty' => '']);\n\n        $this->assertIsArray($result);\n        $this->assertArrayHasKey('empty', $result);\n        $this->assertSame('', $result['empty']);\n    }\n\n    public function testItHandlesMixedValuesWithAndWithoutExpressions(): void\n    {\n        $result = $this->varsResolver->resolve([\n            'name' => 'John',\n            'has_user' => '@=token.getUser() === null',\n        ]);\n\n        $this->assertIsArray($result);\n        $this->assertCount(2, $result);\n        $this->assertArrayHasKey('name', $result);\n        $this->assertArrayHasKey('has_user', $result);\n        $this->assertSame('John', $result['name']);\n        $this->assertTrue($result['has_user']);\n    }\n\n    public function testItHandlesNestedArraysWithMixedValues(): void\n    {\n        $result = $this->varsResolver->resolve([\n            'parameters' => [\n                'name' => 'John',\n                'has_user' => '@=token.getUser() === null',\n            ],\n        ]);\n\n        $this->assertIsArray($result);\n        $this->assertArrayHasKey('parameters', $result);\n        $this->assertIsArray($result['parameters']);\n        $this->assertCount(2, $result['parameters']);\n        $this->assertSame('John', $result['parameters']['name']);\n        $this->assertTrue($result['parameters']['has_user']);\n    }\n\n    public function testItReturnsEmptyArrayWhenGivenEmptyArray(): void\n    {\n        $result = $this->varsResolver->resolve([]);\n\n        $this->assertIsArray($result);\n        $this->assertEmpty($result);\n    }\n\n    public function testItResolvesMultipleExpressions(): void\n    {\n        $result = $this->varsResolver->resolve([\n            'has_user' => '@=token.getUser() === null',\n            'is_authenticated' => '@=token.getUser() !== null',\n        ]);\n\n        $this->assertIsArray($result);\n        $this->assertCount(2, $result);\n        $this->assertArrayHasKey('has_user', $result);\n        $this->assertArrayHasKey('is_authenticated', $result);\n        $this->assertTrue($result['has_user']);\n        $this->assertFalse($result['is_authenticated']);\n    }\n\n    public function testItHandlesDeeplyNestedArrays(): void\n    {\n        $result = $this->varsResolver->resolve([\n            'level1' => [\n                'level2' => [\n                    'has_user' => '@=token.getUser() === null',\n                    'name' => 'test',\n                ],\n            ],\n        ]);\n\n        $this->assertIsArray($result);\n        $this->assertArrayHasKey('level1', $result);\n        $this->assertIsArray($result['level1']);\n        $this->assertArrayHasKey('level2', $result['level1']);\n        $this->assertIsArray($result['level1']['level2']);\n        $this->assertTrue($result['level1']['level2']['has_user']);\n        $this->assertSame('test', $result['level1']['level2']['name']);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Form/Factory/FormFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Form\\Factory;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\ArgumentParserInterface;\nuse Sylius\\Resource\\Symfony\\Form\\Factory\\FormFactory;\nuse Symfony\\Component\\Form\\FormFactoryInterface as SymfonyFormFactoryInterface;\nuse Symfony\\Component\\Form\\FormInterface;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class FormFactoryTest extends TestCase\n{\n    private SymfonyFormFactoryInterface&MockObject $symfonyFormFactory;\n\n    private ArgumentParserInterface&MockObject $argumentParser;\n\n    private FormFactory $formFactory;\n\n    protected function setUp(): void\n    {\n        $this->symfonyFormFactory = $this->createMock(SymfonyFormFactoryInterface::class);\n        $this->argumentParser = $this->createMock(ArgumentParserInterface::class);\n        $this->formFactory = new FormFactory($this->symfonyFormFactory, $this->argumentParser);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(FormFactory::class, $this->formFactory);\n    }\n\n    public function testItCreatesAForm(): void\n    {\n        $operation = $this->createMock(Operation::class);\n        $form = $this->createMock(FormInterface::class);\n\n        $operation->method('getFormType')->willReturn('App\\Form\\DummyType');\n        $operation->method('getFormOptions')->willReturn(['foo' => 'fighters']);\n\n        $this->symfonyFormFactory\n            ->expects($this->once())\n            ->method('createNamed')\n            ->with('', 'App\\Form\\DummyType', null, ['foo' => 'fighters', 'csrf_protection' => false])\n            ->willReturn($form);\n\n        $result = $this->formFactory->create($operation, new Context());\n\n        $this->assertSame($form, $result);\n    }\n\n    public function testItCreatesAFormFormHtmlRequest(): void\n    {\n        $operation = $this->createMock(Operation::class);\n        $form = $this->createMock(FormInterface::class);\n        $request = $this->createMock(Request::class);\n\n        $operation->method('getFormType')->willReturn('App\\Form\\DummyType');\n        $operation->method('getFormOptions')->willReturn(['foo' => 'fighters']);\n        $request->method('getRequestFormat')->willReturn('html');\n\n        $this->symfonyFormFactory\n            ->expects($this->once())\n            ->method('create')\n            ->with('App\\Form\\DummyType', null, ['foo' => 'fighters'])\n            ->willReturn($form);\n\n        $result = $this->formFactory->create($operation, new Context(new RequestOption($request)));\n\n        $this->assertSame($form, $result);\n    }\n\n    public function testItUsesExpressionParserForExpressionLanguagePrefixedFormOptions(): void\n    {\n        $operation = $this->createMock(Operation::class);\n        $form = $this->createMock(FormInterface::class);\n        $request = $this->createMock(Request::class);\n\n        $operation->method('getFormType')->willReturn('App\\Form\\DummyType');\n        $operation->method('getFormOptions')->willReturn(['customer' => '@=sylius_context_shopper.getCustomer()']);\n        $request->method('getRequestFormat')->willReturn('html');\n\n        $customer = new \\StdClass();\n\n        $this->argumentParser\n            ->expects($this->exactly(1))\n            ->method('parseExpression')\n            ->with('sylius_context_shopper.getCustomer()')\n            ->willReturn($customer);\n\n        $this->symfonyFormFactory\n            ->expects($this->once())\n            ->method('create')\n            ->with('App\\Form\\DummyType', null, ['customer' => $customer])\n            ->willReturn($form);\n\n        $result = $this->formFactory->create($operation, new Context(new RequestOption($request)));\n\n        $this->assertSame($form, $result);\n    }\n\n    public function testItThrowsAnExceptionWhenOperationHasNoFormType(): void\n    {\n        $operation = $this->createMock(Operation::class);\n\n        $operation->method('getFormType')->willReturn(null);\n        $operation->method('getFormOptions')->willReturn([]);\n        $operation->method('getName')->willReturn('app_dummy_create');\n\n        $this->expectException(\\RuntimeException::class);\n        $this->expectExceptionMessage('Operation \"app_dummy_create\" has no configured form type.');\n\n        $this->formFactory->create($operation, new Context());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Form/State/FormProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\tests\\Symfony\\Form\\State;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\BulkUpdate;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Sylius\\Resource\\Symfony\\Form\\Factory\\FormFactoryInterface;\nuse Sylius\\Resource\\Symfony\\Form\\State\\FormProvider;\nuse Symfony\\Component\\Form\\FormInterface;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nfinal class FormProviderTest extends TestCase\n{\n    private ProviderInterface $decorated;\n\n    private FormFactoryInterface $formFactory;\n\n    private FormProvider $formProvider;\n\n    protected function setUp(): void\n    {\n        $this->decorated = $this->createMock(ProviderInterface::class);\n        $this->formFactory = $this->createMock(FormFactoryInterface::class);\n\n        $this->formProvider = new FormProvider(\n            $this->decorated,\n            $this->formFactory,\n        );\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(FormProvider::class, $this->formProvider);\n    }\n\n    public function testItHandlesFormsForCreateOperation(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $form = $this->createMock(FormInterface::class);\n        $data = ['foo' => 'fighters'];\n\n        $request->attributes = $attributes;\n\n        $request\n            ->expects($this->once())\n            ->method('getRequestFormat')\n            ->willReturn('html');\n\n        $operation = new Create(formType: 'App\\Type\\DummyType');\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->formFactory\n            ->expects($this->once())\n            ->method('create')\n            ->with($operation, $context, $data)\n            ->willReturn($form);\n\n        $form\n            ->expects($this->once())\n            ->method('handleRequest')\n            ->with($request)\n            ->willReturn($form);\n\n        $attributes\n            ->expects($this->once())\n            ->method('set')\n            ->with('form', $form);\n\n        $result = $this->formProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItHandlesFormsForUpdateOperation(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $form = $this->createMock(FormInterface::class);\n        $data = new \\stdClass();\n\n        $request->attributes = $attributes;\n\n        $request\n            ->expects($this->once())\n            ->method('getRequestFormat')\n            ->willReturn('html');\n\n        $operation = new Update(formType: 'App\\Type\\DummyType');\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->formFactory\n            ->expects($this->once())\n            ->method('create')\n            ->with($operation, $context, $data)\n            ->willReturn($form);\n\n        $form\n            ->expects($this->once())\n            ->method('handleRequest')\n            ->with($request)\n            ->willReturn($form);\n\n        $attributes\n            ->expects($this->once())\n            ->method('set')\n            ->with('form', $form);\n\n        $result = $this->formProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItDoesNothingWhenDataIsAResponse(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $response = $this->createMock(Response::class);\n\n        $request->attributes = $attributes;\n\n        $request\n            ->expects($this->once())\n            ->method('getRequestFormat')\n            ->willReturn('html');\n\n        $operation = new Create(formType: 'App\\Type\\DummyType');\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($response);\n\n        $this->formFactory\n            ->expects($this->never())\n            ->method('create');\n\n        $attributes\n            ->expects($this->never())\n            ->method('set');\n\n        $result = $this->formProvider->provide($operation, $context);\n\n        $this->assertSame($response, $result);\n    }\n\n    public function testItDoesNothingWhenOperationHasNoFormType(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $data = ['foo' => 'bar'];\n\n        $request->attributes = $attributes;\n\n        $request\n            ->expects($this->once())\n            ->method('getRequestFormat')\n            ->willReturn('html');\n\n        $operation = new Create(formType: null);\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->formFactory\n            ->expects($this->never())\n            ->method('create');\n\n        $attributes\n            ->expects($this->never())\n            ->method('set');\n\n        $result = $this->formProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItDoesNothingWhenOperationIsNotACreateOrUpdate(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $data = ['foo' => 'bar'];\n\n        $request->attributes = $attributes;\n\n        $request\n            ->expects($this->once())\n            ->method('getRequestFormat')\n            ->willReturn('html');\n\n        $operation = new Show(formType: 'App\\Type\\DummyType');\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->formFactory\n            ->expects($this->never())\n            ->method('create');\n\n        $attributes\n            ->expects($this->never())\n            ->method('set');\n\n        $result = $this->formProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItDoesNothingWhenOperationIsABulkUpdate(): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $data = ['foo' => 'bar'];\n\n        $request->attributes = $attributes;\n\n        $request\n            ->expects($this->once())\n            ->method('getRequestFormat')\n            ->willReturn('html');\n\n        $operation = new BulkUpdate(formType: 'App\\Type\\DummyType');\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->formFactory\n            ->expects($this->never())\n            ->method('create');\n\n        $attributes\n            ->expects($this->never())\n            ->method('set');\n\n        $result = $this->formProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItReturnsDataWhenRequestIsNull(): void\n    {\n        $data = ['foo' => 'bar'];\n        $operation = new Create(formType: 'App\\Type\\DummyType');\n        $context = new Context();\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->formFactory\n            ->expects($this->never())\n            ->method('create');\n\n        $result = $this->formProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    /**\n     * @dataProvider nonHtmlRequestFormatProvider\n     */\n    public function testItDoesNothingWhenRequestFormatIsNotHtml(string $requestFormat): void\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $data = ['foo' => 'bar'];\n\n        $request->attributes = $attributes;\n\n        $request\n            ->expects($this->once())\n            ->method('getRequestFormat')\n            ->willReturn($requestFormat);\n\n        $operation = new Create(formType: 'App\\Type\\DummyType');\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->formFactory\n            ->expects($this->never())\n            ->method('create');\n\n        $attributes\n            ->expects($this->never())\n            ->method('set');\n\n        $result = $this->formProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    /**\n     * @return iterable<string, array<string>>\n     */\n    public static function nonHtmlRequestFormatProvider(): iterable\n    {\n        yield 'json' => ['json'];\n        yield 'xml' => ['xml'];\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Request/RepositoryArgumentResolverTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Request;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\RepositoryWithCallables;\nuse Sylius\\Resource\\Reflection\\CallableReflection;\nuse Sylius\\Resource\\Symfony\\Request\\RepositoryArgumentResolver;\nuse Symfony\\Component\\HttpFoundation\\InputBag;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class RepositoryArgumentResolverTest extends TestCase\n{\n    private RepositoryArgumentResolver $repositoryArgumentResolver;\n\n    protected function setUp(): void\n    {\n        $this->repositoryArgumentResolver = new RepositoryArgumentResolver();\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(RepositoryArgumentResolver::class, $this->repositoryArgumentResolver);\n    }\n\n    public function testItGetsArgumentsToSentToTheRepository(): void\n    {\n        $request = $this->createRequest(['id' => 'my_id'], [], []);\n\n        $callable = [RepositoryWithCallables::class, 'find'];\n        $reflector = CallableReflection::from($callable);\n\n        $result = $this->repositoryArgumentResolver->getArguments($request, $reflector);\n\n        $this->assertSame(['id' => 'my_id'], $result);\n    }\n\n    public function testItUsesQueryParamsWhenRouteParamsAreNotMatching(): void\n    {\n        $request = $this->createRequest(\n            ['_sylius' => ['resource' => 'app.dummy']],\n            ['id' => 'my_id'],\n            [],\n        );\n\n        $callable = [RepositoryWithCallables::class, 'find'];\n        $reflector = CallableReflection::from($callable);\n\n        $result = $this->repositoryArgumentResolver->getArguments($request, $reflector);\n\n        $this->assertSame(['id' => 'my_id'], $result);\n    }\n\n    public function testItUsesRequestParamsWhenRouteParamsAreNotMatching(): void\n    {\n        $request = $this->createRequest(\n            ['_sylius' => ['resource' => 'app.dummy']],\n            [],\n            ['id' => 'my_id'],\n        );\n\n        $callable = [RepositoryWithCallables::class, 'find'];\n        $reflector = CallableReflection::from($callable);\n\n        $result = $this->repositoryArgumentResolver->getArguments($request, $reflector);\n\n        $this->assertSame(['id' => 'my_id'], $result);\n    }\n\n    public function testItEncapsulatesArgumentsWhenTheMethodHasOnlyOneRequiredArrayArgument(): void\n    {\n        $request = $this->createRequest(\n            ['enabled' => 'true', 'author' => 'author@example.com'],\n            [],\n            [],\n        );\n\n        $callable = [RepositoryWithCallables::class, 'findOneBy'];\n        $reflector = CallableReflection::from($callable);\n\n        $result = $this->repositoryArgumentResolver->getArguments($request, $reflector);\n\n        $this->assertSame([['enabled' => 'true', 'author' => 'author@example.com']], $result);\n    }\n\n    public function testItReturnArrayValuesWhenMethodIsMagic(): void\n    {\n        $request = $this->createRequest(\n            ['_sylius' => ['resource' => 'app.dummy']],\n            [],\n            ['ids' => ['first_id', 'second_id']],\n        );\n\n        $callable = [new RepositoryWithCallables(), '__call'];\n        $reflector = CallableReflection::from($callable);\n\n        $result = $this->repositoryArgumentResolver->getArguments($request, $reflector);\n\n        $this->assertSame([['first_id', 'second_id']], $result);\n    }\n\n    private function createRequest(array $routeParams, array $queryParams, array $requestParams): Request\n    {\n        $request = new Request();\n        $request->attributes = new ParameterBag();\n        $request->query = new InputBag($queryParams);\n        $request->request = new InputBag($requestParams);\n\n        $attributesMock = $this->createMock(ParameterBag::class);\n        $attributesMock->method('all')->with('_route_params')->willReturn($routeParams);\n\n        $request->attributes = $attributesMock;\n\n        return $request;\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Request/State/ApiResponderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Request\\State;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Delete;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Update;\nuse Sylius\\Resource\\Symfony\\Request\\State\\ApiResponder;\nuse Sylius\\Resource\\Symfony\\Response\\ApiHeadersInitiator;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nfinal class ApiResponderTest extends TestCase\n{\n    private ApiResponder $apiResponder;\n\n    protected function setUp(): void\n    {\n        $this->apiResponder = new ApiResponder(new ApiHeadersInitiator());\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(ApiResponder::class, $this->apiResponder);\n    }\n\n    public function testItReturnsAResponseWithHttpCreatedForResourceCreate(): void\n    {\n        $request = $this->createRequest();\n        $context = new Context(new RequestOption($request));\n\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book');\n        $operation = (new Create())->withResource($resource);\n\n        $response = $this->apiResponder->respond('serialized_data', $operation, $context);\n\n        $this->assertInstanceOf(Response::class, $response);\n        $this->assertSame(Response::HTTP_CREATED, $response->getStatusCode());\n    }\n\n    public function testItReturnsAResponseWithHttpNoContentForResourceUpdate(): void\n    {\n        $request = $this->createRequest();\n        $context = new Context(new RequestOption($request));\n\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book');\n        $operation = (new Update())->withResource($resource);\n\n        $response = $this->apiResponder->respond('serialized_data', $operation, $context);\n\n        $this->assertInstanceOf(Response::class, $response);\n        $this->assertSame(Response::HTTP_NO_CONTENT, $response->getStatusCode());\n    }\n\n    public function testItReturnsAResponseWithHttpNoContentForResourceDelete(): void\n    {\n        $request = $this->createRequest();\n        $context = new Context(new RequestOption($request));\n\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book');\n        $operation = (new Delete())->withResource($resource);\n\n        $response = $this->apiResponder->respond('serialized_data', $operation, $context);\n\n        $this->assertInstanceOf(Response::class, $response);\n        $this->assertSame(Response::HTTP_NO_CONTENT, $response->getStatusCode());\n    }\n\n    public function testItReturnsAResponseWithHttpUnprocessableEntityForInvalidResource(): void\n    {\n        $request = $this->createRequest(false);\n        $context = new Context(new RequestOption($request));\n\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book');\n        $operation = (new Create())->withResource($resource);\n\n        $response = $this->apiResponder->respond('serialized_data', $operation, $context);\n\n        $this->assertInstanceOf(Response::class, $response);\n        $this->assertSame(Response::HTTP_UNPROCESSABLE_ENTITY, $response->getStatusCode());\n    }\n\n    private function createRequest(bool $isValid = true): Request\n    {\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n\n        $request->attributes = $attributes;\n\n        $request->method('getRequestFormat')->willReturn('json');\n        $request->method('getMimeType')->with('json')->willReturn('application/json');\n\n        $attributes->method('getBoolean')->with('is_valid', true)->willReturn($isValid);\n        $attributes->method('get')->with('form')->willReturn(null);\n\n        return $request;\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Request/State/ProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Request\\State;\n\nuse Pagerfanta\\Pagerfanta;\nuse PHPUnit\\Framework\\TestCase;\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\CreatePaginatorTrait;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\RepositoryWithCallables;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Exception\\InvalidArgumentException;\nuse Sylius\\Resource\\Exception\\RuntimeException;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\ArgumentParserInterface;\nuse Sylius\\Resource\\Symfony\\Request\\RepositoryArgumentResolver;\nuse Sylius\\Resource\\Symfony\\Request\\State\\Provider;\nuse Symfony\\Component\\HttpFoundation\\InputBag;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class ProviderTest extends TestCase\n{\n    private ContainerInterface $locator;\n\n    private ArgumentParserInterface $argumentParser;\n\n    private Provider $provider;\n\n    protected function setUp(): void\n    {\n        $this->locator = $this->createMock(ContainerInterface::class);\n        $this->argumentParser = $this->createMock(ArgumentParserInterface::class);\n        $this->provider = new Provider($this->locator, new RepositoryArgumentResolver(), $this->argumentParser);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(Provider::class, $this->provider);\n    }\n\n    public function testItCallsRepositoryAsCallable(): void\n    {\n        $operation = $this->createMock(Operation::class);\n        $request = $this->createRequest(['id' => 'my_id'], [], []);\n\n        $operation->method('getRepository')->willReturn([RepositoryWithCallables::class, 'find']);\n        $operation->method('getRepositoryArguments')->willReturn(null);\n\n        $response = $this->provider->provide($operation, new Context(new RequestOption($request)));\n\n        $this->assertInstanceOf(\\stdClass::class, $response);\n        $this->assertSame('my_id', $response->id);\n    }\n\n    public function testItCallsRepositoryAsString(): void\n    {\n        $operation = $this->createMock(Operation::class);\n        $request = $this->createRequest(['id' => 'my_id', '_sylius' => ['resource' => 'app.dummy']], [], []);\n        $repository = $this->createMock(RepositoryInterface::class);\n        $stdClass = new \\stdClass();\n\n        $operation->method('getRepository')->willReturn('App\\Repository');\n        $operation->method('getRepositoryMethod')->willReturn(null);\n        $operation->method('getRepositoryArguments')->willReturn(null);\n\n        $this->locator->method('has')->with('App\\Repository')->willReturn(true);\n        $this->locator->method('get')->with('App\\Repository')->willReturn($repository);\n\n        $repository->method('findOneBy')->with(['id' => 'my_id'])->willReturn($stdClass);\n\n        $response = $this->provider->provide($operation, new Context(new RequestOption($request)));\n\n        $this->assertSame($stdClass, $response);\n    }\n\n    public function testItCallsCreatePaginatorByDefaultOnCollectionOperations(): void\n    {\n        $operation = new Index(repository: 'App\\Repository');\n        $request = $this->createRequest(['id' => 'my_id', '_sylius' => ['resource' => 'app.dummy']], [], []);\n        $repository = $this->createMock(RepositoryInterface::class);\n        $pagerfanta = $this->createMock(Pagerfanta::class);\n\n        $this->locator->method('has')->with('App\\Repository')->willReturn(true);\n        $this->locator->method('get')->with('App\\Repository')->willReturn($repository);\n\n        $repository->expects($this->once())->method('createPaginator')->willReturn($pagerfanta);\n        $pagerfanta->expects($this->once())->method('setCurrentPage')->with(1)->willReturnSelf();\n\n        $response = $this->provider->provide($operation, new Context(new RequestOption($request)));\n\n        $this->assertSame($pagerfanta, $response);\n    }\n\n    public function testItSetsCurrentPageFromRequestWhenDataIsAPaginator(): void\n    {\n        $operation = new Index(repository: 'App\\Repository');\n        $request = $this->createRequest(['id' => 'my_id', '_sylius' => ['resource' => 'app.dummy']], ['page' => 42], []);\n        $repository = $this->createMock(RepositoryInterface::class);\n        $pagerfanta = $this->createMock(Pagerfanta::class);\n\n        $this->locator->method('has')->with('App\\Repository')->willReturn(true);\n        $this->locator->method('get')->with('App\\Repository')->willReturn($repository);\n\n        $repository->expects($this->once())->method('createPaginator')->willReturn($pagerfanta);\n        $pagerfanta->expects($this->once())->method('setCurrentPage')->with(42)->willReturnSelf();\n        $pagerfanta->method('getCurrentPage')->willReturn(42);\n\n        $response = $this->provider->provide($operation, new Context(new RequestOption($request)));\n\n        $this->assertSame($pagerfanta, $response);\n        $this->assertSame(42, $pagerfanta->getCurrentPage());\n    }\n\n    public function testItCallsRepositoryAsStringWithSpecificRepositoryMethod(): void\n    {\n        $operation = $this->createMock(Operation::class);\n        $request = $this->createRequest(['id' => 'my_id', '_sylius' => ['resource' => 'app.dummy']], [], []);\n        $repository = $this->createMock(RepositoryInterface::class);\n        $stdClass = new \\stdClass();\n\n        $operation->method('getRepository')->willReturn('App\\Repository');\n        $operation->method('getRepositoryMethod')->willReturn('find');\n        $operation->method('getRepositoryArguments')->willReturn(null);\n\n        $this->locator->method('has')->with('App\\Repository')->willReturn(true);\n        $this->locator->method('get')->with('App\\Repository')->willReturn($repository);\n\n        $repository->method('find')->with('my_id')->willReturn($stdClass);\n\n        $response = $this->provider->provide($operation, new Context(new RequestOption($request)));\n\n        $this->assertSame($stdClass, $response);\n    }\n\n    public function testItCallsRepositoryAsStringWithSpecificRepositoryMethodAndArguments(): void\n    {\n        $operation = $this->createMock(Operation::class);\n        $request = $this->createMock(Request::class);\n        $repository = $this->createMock(RepositoryInterface::class);\n        $stdClass = new \\stdClass();\n\n        $operation->method('getRepository')->willReturn('App\\Repository');\n        $operation->method('getRepositoryMethod')->willReturn('find');\n        $operation->method('getRepositoryArguments')->willReturn(['id' => \"request.attributes.get('id')\"]);\n\n        $this->argumentParser\n            ->expects($this->once())\n            ->method('parseExpression')\n            ->with(\"request.attributes.get('id')\")\n            ->willReturn('my_id');\n\n        $this->locator->method('has')->with('App\\Repository')->willReturn(true);\n        $this->locator->method('get')->with('App\\Repository')->willReturn($repository);\n\n        $repository->method('find')->with('my_id')->willReturn($stdClass);\n\n        $response = $this->provider->provide($operation, new Context(new RequestOption($request)));\n\n        $this->assertSame($stdClass, $response);\n    }\n\n    public function testItCallsRepositoryAsStringWithSpecificRepositoryMethodAndExpressionLanguagePrefixedArguments(): void\n    {\n        $operation = $this->createMock(Operation::class);\n        $request = $this->createMock(Request::class);\n        $repository = $this->createMock(RepositoryInterface::class);\n        $stdClass = new \\stdClass();\n\n        $operation->method('getRepository')->willReturn('App\\Repository');\n        $operation->method('getRepositoryMethod')->willReturn('find');\n        $operation->method('getRepositoryArguments')->willReturn(['id' => \"@=request.attributes.get('id')\"]);\n\n        $this->argumentParser\n            ->expects($this->once())\n            ->method('parseExpression')\n            ->with(\"request.attributes.get('id')\")\n            ->willReturn('my_id');\n\n        $this->locator->method('has')->with('App\\Repository')->willReturn(true);\n        $this->locator->method('get')->with('App\\Repository')->willReturn($repository);\n\n        $repository->method('find')->with('my_id')->willReturn($stdClass);\n\n        $response = $this->provider->provide($operation, new Context(new RequestOption($request)));\n\n        $this->assertSame($stdClass, $response);\n    }\n\n    public function testItParsesNestedArrayArguments(): void\n    {\n        $operation = $this->createMock(Operation::class);\n        $request = $this->createMock(Request::class);\n        $repository = $this->createMock(RepositoryInterface::class);\n        $stdClass = new \\stdClass();\n\n        $operation->method('getRepository')->willReturn('App\\Repository');\n        $operation->method('getRepositoryMethod')->willReturn('findOneBy');\n        $operation->method('getRepositoryArguments')->willReturn([['tokenValue' => \"@=request.attributes.get('tokenValue')\"]]);\n\n        $this->argumentParser\n            ->expects($this->once())\n            ->method('parseExpression')\n            ->with(\"request.attributes.get('tokenValue')\")\n            ->willReturn('my_token');\n\n        $this->locator->method('has')->with('App\\Repository')->willReturn(true);\n        $this->locator->method('get')->with('App\\Repository')->willReturn($repository);\n\n        $repository->method('findOneBy')->with(['tokenValue' => 'my_token'])->willReturn($stdClass);\n\n        $response = $this->provider->provide($operation, new Context(new RequestOption($request)));\n\n        $this->assertSame($stdClass, $response);\n    }\n\n    public function testItThrowsAnExceptionWhenRepositoryMethodDoesNotExist(): void\n    {\n        $operation = $this->createMock(Operation::class);\n        $request = $this->createMock(Request::class);\n\n        $operation->method('getRepository')->willReturn('App\\Repository');\n        $operation->method('getRepositoryMethod')->willReturn('notFoundMethod');\n        $operation->method('getRepositoryArguments')->willReturn(['id' => \"request.attributes.get('id')\"]);\n\n        $this->locator->method('has')->with('App\\Repository')->willReturn(true);\n        $this->locator->method('get')->with('App\\Repository')->willReturn(new \\stdClass());\n\n        $errorMessage = sprintf(\n            'Method \"notFoundMethod\" not found on repository \"%s\". You can either add it or configure another one in the repositoryMethod option for your operation.',\n            \\stdClass::class,\n        );\n\n        $this->expectException(RuntimeException::class);\n        $this->expectExceptionMessage($errorMessage);\n\n        $this->provider->provide($operation, new Context(new RequestOption($request)));\n    }\n\n    public function testItThrowsAnExceptionWhenRepositoryMethodDoesNotExistAndSuggestToUseCreatePaginatorIfItIsAppropriated(): void\n    {\n        $operation = $this->createMock(Operation::class);\n        $request = $this->createMock(Request::class);\n\n        $operation->method('getRepository')->willReturn('App\\Repository');\n        $operation->method('getRepositoryMethod')->willReturn('createPaginator');\n        $operation->method('getRepositoryArguments')->willReturn(['id' => \"request.attributes.get('id')\"]);\n\n        $this->locator->method('has')->with('App\\Repository')->willReturn(true);\n        $this->locator->method('get')->with('App\\Repository')->willReturn(new \\stdClass());\n\n        $errorMessage = sprintf(\n            'Method \"createPaginator\" not found on repository \"%s\". You can use the \"%s\" trait on this repository class.',\n            \\stdClass::class,\n            CreatePaginatorTrait::class,\n        );\n\n        $this->expectException(RuntimeException::class);\n        $this->expectExceptionMessage($errorMessage);\n\n        $this->provider->provide($operation, new Context(new RequestOption($request)));\n    }\n\n    public function testItThrowsAnExceptionWhenRepositoryArgumentsAreNotScalarOnes(): void\n    {\n        $operation = $this->createMock(Operation::class);\n        $request = $this->createMock(Request::class);\n        $repository = $this->createMock(RepositoryInterface::class);\n\n        $operation->method('getRepository')->willReturn('App\\Repository');\n        $operation->method('getRepositoryMethod')->willReturn('findOneBy');\n        $operation->method('getRepositoryArguments')->willReturn([['foo' => 'resource.code', 'bar' => new \\stdClass()]]);\n\n        $this->locator->method('has')->with('App\\Repository')->willReturn(true);\n        $this->locator->method('get')->with('App\\Repository')->willReturn($repository);\n\n        $this->expectException(InvalidArgumentException::class);\n        $this->expectExceptionMessage('Parameter \"bar\" should be a scalar or an array.');\n\n        $this->provider->provide($operation, new Context(new RequestOption($request)));\n    }\n\n    private function createRequest(array $routeParams, array $queryParams, array $requestParams): Request\n    {\n        $request = new Request();\n        $request->attributes = new ParameterBag(['_route_params' => $routeParams]);\n        $request->query = new InputBag($queryParams);\n        $request->request = new InputBag($requestParams);\n\n        return $request;\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Request/State/ResponderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Request\\State;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\State\\ResponderInterface;\nuse Sylius\\Resource\\Symfony\\Request\\State\\Responder;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nfinal class ResponderTest extends TestCase\n{\n    private ContainerInterface $locator;\n\n    private Responder $responder;\n\n    protected function setUp(): void\n    {\n        $this->locator = $this->createMock(ContainerInterface::class);\n        $this->responder = new Responder($this->locator);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(Responder::class, $this->responder);\n    }\n\n    public function testItUsesHtmlResponderOnHtmlFormat(): void\n    {\n        $data = new \\stdClass();\n        $request = $this->createMock(Request::class);\n        $htmlResponder = $this->createMock(ResponderInterface::class);\n        $operation = $this->createMock(HttpOperation::class);\n        $response = $this->createMock(Response::class);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->method('getRequestFormat')->willReturn('html');\n\n        $this->locator->method('has')->with('sylius.state_responder.html')->willReturn(true);\n        $this->locator->method('get')->with('sylius.state_responder.html')->willReturn($htmlResponder);\n\n        $htmlResponder\n            ->expects($this->once())\n            ->method('respond')\n            ->with($data, $operation, $context)\n            ->willReturn($response);\n\n        $this->responder->respond($data, $operation, $context);\n    }\n\n    public function testItUsesApiResponderOnJsonFormat(): void\n    {\n        $data = new \\stdClass();\n        $request = $this->createMock(Request::class);\n        $apiResponder = $this->createMock(ResponderInterface::class);\n        $operation = $this->createMock(HttpOperation::class);\n        $response = $this->createMock(Response::class);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->method('getRequestFormat')->willReturn('json');\n\n        $this->locator->method('has')->with('sylius.state_responder.api')->willReturn(true);\n        $this->locator->method('get')->with('sylius.state_responder.api')->willReturn($apiResponder);\n\n        $apiResponder\n            ->expects($this->once())\n            ->method('respond')\n            ->with($data, $operation, $context)\n            ->willReturn($response);\n\n        $this->responder->respond($data, $operation, $context);\n    }\n\n    public function testItThrowAnExceptionWhenHtmlResponderWasNotFound(): void\n    {\n        $data = new \\stdClass();\n        $request = $this->createMock(Request::class);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->method('getRequestFormat')->willReturn('html');\n\n        $this->locator->method('has')->with('sylius.state_responder.html')->willReturn(false);\n\n        $this->expectException(\\LogicException::class);\n        $this->expectExceptionMessage('Responder \"sylius.state_responder.html\" was not found but it should.');\n\n        $this->responder->respond($data, $operation, $context);\n    }\n\n    public function testItThrowAnExceptionWhenJsonResponderWasNotFound(): void\n    {\n        $data = new \\stdClass();\n        $request = $this->createMock(Request::class);\n        $operation = $this->createMock(HttpOperation::class);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->method('getRequestFormat')->willReturn('json');\n\n        $this->locator->method('has')->with('sylius.state_responder.api')->willReturn(false);\n\n        $this->expectException(\\LogicException::class);\n        $this->expectExceptionMessage('Responder \"sylius.state_responder.api\" was not found but it should.');\n\n        $this->responder->respond($data, $operation, $context);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Request/State/TwigResponderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Request\\State;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Symfony\\Request\\State\\TwigResponder;\nuse Sylius\\Resource\\Symfony\\Routing\\RedirectHandlerInterface;\nuse Sylius\\Resource\\Twig\\Context\\Factory\\ContextFactoryInterface;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\RedirectResponse;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Twig\\Environment;\n\nfinal class TwigResponderTest extends TestCase\n{\n    private Environment $twig;\n\n    private RedirectHandlerInterface $redirectHandler;\n\n    private ContextFactoryInterface $contextFactory;\n\n    private TwigResponder $twigResponder;\n\n    protected function setUp(): void\n    {\n        $this->twig = $this->createMock(Environment::class);\n        $this->redirectHandler = $this->createMock(RedirectHandlerInterface::class);\n        $this->contextFactory = $this->createMock(ContextFactoryInterface::class);\n        $this->twigResponder = new TwigResponder($this->redirectHandler, $this->contextFactory, $this->twig);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(TwigResponder::class, $this->twigResponder);\n    }\n\n    public function testItReturnsAResponseForResourceShow(): void\n    {\n        $data = new \\stdClass();\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->attributes = $attributes;\n\n        $request->method('isMethodSafe')->willReturn(true);\n\n        $attributes->expects($this->once())->method('getBoolean')->with('is_valid', true)->willReturn(false);\n        $attributes->method('get')->with('form')->willReturn(null);\n\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book');\n        $operation = (new Show(template: 'book/show.html.twig'))->withResource($resource);\n\n        $this->contextFactory\n            ->expects($this->once())\n            ->method('create')\n            ->with($data, $operation, $context)\n            ->willReturn(['book' => $data]);\n\n        $this->twig\n            ->expects($this->once())\n            ->method('render')\n            ->with('book/show.html.twig', ['book' => $data])\n            ->willReturn('result');\n\n        $response = $this->twigResponder->respond($data, $operation, $context);\n\n        $this->assertSame(200, $response->getStatusCode());\n    }\n\n    public function testItReturnsAResponseForResourceIndex(): void\n    {\n        $data = new \\ArrayObject();\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->attributes = $attributes;\n\n        $request->method('isMethodSafe')->willReturn(true);\n\n        $attributes->expects($this->once())->method('getBoolean')->with('is_valid', true)->willReturn(true);\n        $attributes->method('get')->with('form')->willReturn(null);\n\n        $resource = new ResourceMetadata(alias: 'app.book', pluralName: 'books');\n        $operation = (new Index(template: 'book/index.html.twig'))->withResource($resource);\n\n        $this->contextFactory\n            ->expects($this->once())\n            ->method('create')\n            ->with($data, $operation, $context)\n            ->willReturn(['books' => $data]);\n\n        $this->twig\n            ->expects($this->once())\n            ->method('render')\n            ->with('book/index.html.twig', ['books' => $data])\n            ->willReturn('result');\n\n        $this->twigResponder->respond($data, $operation, $context);\n    }\n\n    public function testItRedirectToRouteAfterCreation(): void\n    {\n        $data = new \\ArrayObject();\n        $data['id'] = 'xyz';\n\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n        $redirectResponse = $this->createMock(RedirectResponse::class);\n\n        $request->attributes = $attributes;\n\n        $request->method('isMethodSafe')->willReturn(false);\n        $attributes->expects($this->once())->method('getBoolean')->with('is_valid', true)->willReturn(true);\n\n        $operation = new Create();\n\n        $this->redirectHandler\n            ->expects($this->once())\n            ->method('redirectToResource')\n            ->with($data, $operation, $request)\n            ->willReturn($redirectResponse);\n\n        $result = $this->twigResponder->respond($data, $operation, new Context(new RequestOption($request)));\n\n        $this->assertSame($redirectResponse, $result);\n    }\n\n    public function testItResponseIsUnprocessableWhenValidationHasFailed(): void\n    {\n        $data = new \\ArrayObject();\n        $data['id'] = 'xyz';\n\n        $request = $this->createMock(Request::class);\n        $attributes = $this->createMock(ParameterBag::class);\n\n        $context = new Context(new RequestOption($request));\n\n        $request->attributes = $attributes;\n\n        $request->method('isMethodSafe')->willReturn(false);\n\n        $attributes->expects($this->once())->method('getBoolean')->with('is_valid', true)->willReturn(false);\n\n        $operation = new Create();\n\n        $this->contextFactory\n            ->expects($this->once())\n            ->method('create')\n            ->with($data, $operation, $context)\n            ->willReturn(['books' => $data]);\n\n        $this->twig\n            ->expects($this->once())\n            ->method('render')\n            ->with('', ['books' => $data])\n            ->willReturn('twig_content');\n\n        $response = $this->twigResponder->respond($data, $operation, new Context(new RequestOption($request)));\n\n        $this->assertSame(422, $response->getStatusCode());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Routing/Factory/AttributesOperationRouteFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Routing\\Factory;\n\nuse PHPUnit\\Framework\\Attributes\\CoversClass;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithOperations;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Inflector\\Inflector;\nuse Sylius\\Resource\\Metadata\\Metadata;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\Registry;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\AttributesResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\AttributesOperationRouteFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\OperationRouteFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RouteName\\OperationRouteNameFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\OperationRoutePathFactoryInterface;\nuse Symfony\\Component\\Routing\\RouteCollection;\n\n#[CoversClass(AttributesOperationRouteFactory::class)]\nfinal class AttributesOperationRouteFactoryTest extends TestCase\n{\n    private RegistryInterface $resourceRegistry;\n\n    private OperationRoutePathFactoryInterface $routePathFactory;\n\n    private AttributesOperationRouteFactory $attributesOperationRouteFactory;\n\n    protected function setUp(): void\n    {\n        $this->resourceRegistry = new Registry();\n        $this->routePathFactory = $this->createMock(OperationRoutePathFactoryInterface::class);\n\n        $this->attributesOperationRouteFactory = new AttributesOperationRouteFactory(\n            $this->resourceRegistry,\n            new OperationRouteFactory($this->routePathFactory, new Operation\\DashPathSegmentNameGenerator(new Inflector()), false),\n            new AttributesResourceMetadataCollectionFactory(\n                $this->resourceRegistry,\n                new OperationRouteNameFactory(),\n            ),\n        );\n    }\n\n    public function testItCreatesRoutesWithOperations(): void\n    {\n        $routeCollection = new RouteCollection();\n\n        $this->resourceRegistry->add(Metadata::fromAliasAndConfiguration('app.dummy', [\n            'driver' => 'dummy_driver',\n        ]));\n\n        $this->routePathFactory\n            ->expects($this->exactly(4))\n            ->method('createRoutePath')\n            ->willReturnCallback(function ($operation, $path) {\n                if ($operation instanceof Index) {\n                    return '/dummies';\n                }\n                if ($operation instanceof Create) {\n                    return '/dummies/new';\n                }\n                if ($operation instanceof Update) {\n                    return '/dummies/{id}/edit';\n                }\n                if ($operation instanceof Show) {\n                    return '/dummies/{id}';\n                }\n\n                return $path;\n            });\n\n        $this->attributesOperationRouteFactory->createRouteForClass($routeCollection, DummyResourceWithOperations::class);\n\n        $this->assertCount(4, $routeCollection);\n        $this->assertNotNull($routeCollection->get('app_dummy_index'), 'Route \"app_dummy_index\" not found but it should.');\n        $this->assertNotNull($routeCollection->get('app_dummy_create'), 'Route \"app_dummy_create\" not found but it should.');\n        $this->assertNotNull($routeCollection->get('app_dummy_update'), 'Route \"app_dummy_update\" not found but it should.');\n        $this->assertNotNull($routeCollection->get('app_dummy_show'), 'Route \"app_dummy_show\" not found but it should.');\n    }\n\n    public function testItSkipsNonHttpOperations(): void\n    {\n        $routeCollection = new RouteCollection();\n\n        $this->resourceRegistry->add(Metadata::fromAliasAndConfiguration('app.dummy', [\n            'driver' => 'dummy_driver',\n        ]));\n\n        $nonHttpOperation = new class() extends Operation {\n            public function getShortName(): ?string\n            {\n                return 'custom';\n            }\n        };\n\n        $httpOperation = (new Index(name: 'app_dummy_index'))->withRouteName('app_dummy_index');\n\n        $resource = new ResourceMetadata(\n            alias: 'app.dummy',\n            name: 'dummy',\n            pluralName: 'dummies',\n            operations: [\n                'app_dummy_custom' => $nonHttpOperation,\n                'app_dummy_index' => $httpOperation,\n            ],\n        );\n\n        $resourceCollection = new ResourceMetadataCollection();\n        $resourceCollection[] = $resource;\n\n        $resourceMetadataFactory = $this->createMock(ResourceMetadataCollectionFactoryInterface::class);\n        $resourceMetadataFactory\n            ->method('create')\n            ->with(\\stdClass::class)\n            ->willReturn($resourceCollection);\n\n        $this->routePathFactory\n            ->expects($this->once())\n            ->method('createRoutePath')\n            ->with($httpOperation, 'dummies')\n            ->willReturn('/dummies');\n\n        $factory = new AttributesOperationRouteFactory(\n            $this->resourceRegistry,\n            new OperationRouteFactory($this->routePathFactory, new Operation\\DashPathSegmentNameGenerator(new Inflector()), false),\n            $resourceMetadataFactory,\n        );\n\n        $factory->createRouteForClass($routeCollection, \\stdClass::class);\n\n        $this->assertCount(1, $routeCollection);\n        $this->assertNotNull($routeCollection->get('app_dummy_index'), 'Route \"app_dummy_index\" not found but it should.');\n        $this->assertNull($routeCollection->get('app_dummy_custom'), 'Non-HTTP operation should not create a route.');\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Routing/Factory/OperationRouteFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Routing\\Factory;\n\nuse Behat\\Transliterator\\Transliterator;\nuse PHPUnit\\Framework\\Attributes\\CoversClass;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Inflector\\Inflector;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\Operation\\DashPathSegmentNameGenerator;\nuse Sylius\\Resource\\Metadata\\Operation\\UnderscorePathSegmentNameGenerator;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\OperationRouteFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\OperationRoutePathFactoryInterface;\nuse Symfony\\Component\\Routing\\Route;\n\n#[CoversClass(OperationRouteFactory::class)]\nfinal class OperationRouteFactoryTest extends TestCase\n{\n    private OperationRoutePathFactoryInterface $routePathFactory;\n\n    private OperationRouteFactory $operationRouteFactory;\n\n    private OperationRouteFactory $bcOperationRouteFactory;\n\n    protected function setUp(): void\n    {\n        $this->routePathFactory = $this->createMock(OperationRoutePathFactoryInterface::class);\n        $this->operationRouteFactory = new OperationRouteFactory($this->routePathFactory, new DashPathSegmentNameGenerator(new Inflector()), false);\n        $this->bcOperationRouteFactory = new OperationRouteFactory($this->routePathFactory, new DashPathSegmentNameGenerator(new Inflector()), true);\n    }\n\n    public function testItCreatesRouteWithDefaultPathWithBcLayer(): void\n    {\n        $this->markAsSkippedIfBcLayerCannotBeEnabled();\n\n        $metadata = $this->createMock(MetadataInterface::class);\n        $metadata->method('getPluralName')->willReturn('books');\n\n        $resource = new ResourceMetadata(alias: 'app.book');\n        $operation = new Index();\n\n        $this->routePathFactory\n            ->expects($this->once())\n            ->method('createRoutePath')\n            ->with($operation, 'books')\n            ->willReturn('/books');\n\n        $route = $this->bcOperationRouteFactory->create($metadata, $resource, $operation);\n\n        $this->assertInstanceOf(Route::class, $route);\n        $this->assertSame('/books', $route->getPath());\n        $this->assertSame('sylius.main_controller', $route->getDefault('_controller'));\n        $this->assertSame(['resource' => 'app.book'], $route->getDefault('_sylius'));\n    }\n\n    public function testItCreatesRouteWithDefaultPath(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n\n        $resource = new ResourceMetadata(alias: 'app.book', pluralName: 'books');\n        $operation = new Index();\n\n        $this->routePathFactory\n            ->expects($this->once())\n            ->method('createRoutePath')\n            ->with($operation, 'books')\n            ->willReturn('/books');\n\n        $route = $this->operationRouteFactory->create($metadata, $resource, $operation);\n\n        $this->assertInstanceOf(Route::class, $route);\n        $this->assertSame('/books', $route->getPath());\n        $this->assertSame('sylius.main_controller', $route->getDefault('_controller'));\n        $this->assertSame(['resource' => 'app.book'], $route->getDefault('_sylius'));\n    }\n\n    public function testItCreatesRouteWithCustomPath(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $resource = new ResourceMetadata(alias: 'app.book');\n        $operation = new Index(path: '/custom/books/list');\n\n        $this->routePathFactory\n            ->expects($this->never())\n            ->method('createRoutePath');\n\n        $route = $this->operationRouteFactory->create($metadata, $resource, $operation);\n\n        $this->assertSame('/custom/books/list', $route->getPath());\n    }\n\n    public function testItCreatesRouteWithRoutePrefixWithBcLayer(): void\n    {\n        $this->markAsSkippedIfBcLayerCannotBeEnabled();\n\n        $metadata = $this->createMock(MetadataInterface::class);\n        $metadata->method('getPluralName')->willReturn('books');\n\n        $resource = new ResourceMetadata(alias: 'app.book');\n        $operation = (new Index())->withRoutePrefix('/admin');\n\n        $this->routePathFactory\n            ->method('createRoutePath')\n            ->with($operation, 'books')\n            ->willReturn('/books');\n\n        $route = $this->bcOperationRouteFactory->create($metadata, $resource, $operation);\n\n        $this->assertSame('/admin/books', $route->getPath());\n    }\n\n    public function testItCreatesRouteWithRoutePrefix(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n\n        $resource = new ResourceMetadata(alias: 'app.book', pluralName: 'books');\n        $operation = (new Index())->withRoutePrefix('/admin');\n\n        $this->routePathFactory\n            ->method('createRoutePath')\n            ->with($operation, 'books')\n            ->willReturn('/books');\n\n        $route = $this->operationRouteFactory->create($metadata, $resource, $operation);\n\n        $this->assertSame('/admin/books', $route->getPath());\n    }\n\n    public function testItCreatesRouteWithCustomPathAndRoutePrefix(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $resource = new ResourceMetadata(alias: 'app.book');\n        $operation = new Index(path: '/custom/books/list', routePrefix: '/admin');\n\n        $this->routePathFactory\n            ->expects($this->never())\n            ->method('createRoutePath');\n\n        $route = $this->operationRouteFactory->create($metadata, $resource, $operation);\n\n        $this->assertSame('/admin/custom/books/list', $route->getPath());\n    }\n\n    public function testItCreatesRouteWithCustomPathAndRoutePrefixAndTooManySlashes(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $resource = new ResourceMetadata(alias: 'app.book');\n        $operation = new Index(path: '/custom/books/list', routePrefix: '/admin/');\n\n        $this->routePathFactory\n            ->expects($this->never())\n            ->method('createRoutePath');\n\n        $route = $this->operationRouteFactory->create($metadata, $resource, $operation);\n\n        $this->assertSame('/admin/custom/books/list', $route->getPath());\n    }\n\n    public function testItCreatesRouteWithSection(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n\n        $resource = new ResourceMetadata(alias: 'app.book', section: 'admin');\n        $operation = new Index();\n\n        $this->routePathFactory\n            ->method('createRoutePath')\n            ->willReturn('/books');\n\n        $route = $this->operationRouteFactory->create($metadata, $resource, $operation);\n\n        $syliusOptions = $route->getDefault('_sylius');\n        $this->assertSame('app.book', $syliusOptions['resource']);\n        $this->assertSame('admin', $syliusOptions['section']);\n    }\n\n    public function testItCreatesRouteWithVars(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n\n        $resource = new ResourceMetadata(alias: 'app.book');\n        $operation = (new Index())->withVars(['grid' => 'app_book']);\n\n        $this->routePathFactory\n            ->method('createRoutePath')\n            ->willReturn('/books');\n\n        $route = $this->operationRouteFactory->create($metadata, $resource, $operation);\n\n        $syliusOptions = $route->getDefault('_sylius');\n        $this->assertSame('app.book', $syliusOptions['resource']);\n        $this->assertSame(['grid' => 'app_book'], $syliusOptions['vars']);\n    }\n\n    public function testItCreatesRouteWithoutVarsWhenNull(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n\n        $resource = new ResourceMetadata(alias: 'app.book');\n        $operation = new Index();\n\n        $this->routePathFactory\n            ->method('createRoutePath')\n            ->willReturn('/books');\n\n        $route = $this->operationRouteFactory->create($metadata, $resource, $operation);\n\n        $syliusOptions = $route->getDefault('_sylius');\n        $this->assertSame('app.book', $syliusOptions['resource']);\n        $this->assertArrayNotHasKey('vars', $syliusOptions);\n    }\n\n    public function testItCreatesRouteWithRequirements(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n\n        $resource = new ResourceMetadata(alias: 'app.book');\n        $operation = (new Show())->withRouteRequirements(['id' => '\\d+']);\n\n        $this->routePathFactory\n            ->method('createRoutePath')\n            ->willReturn('/books/{id}');\n\n        $route = $this->operationRouteFactory->create($metadata, $resource, $operation);\n\n        $this->assertSame(['id' => '\\d+'], $route->getRequirements());\n    }\n\n    public function testItCreatesRouteWithEmptyRequirementsWhenNull(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n\n        $resource = new ResourceMetadata(alias: 'app.book');\n        $operation = new Index();\n\n        $this->routePathFactory\n            ->method('createRoutePath')\n            ->willReturn('/books');\n\n        $route = $this->operationRouteFactory->create($metadata, $resource, $operation);\n\n        $this->assertSame([], $route->getRequirements());\n    }\n\n    public function testItCreatesRouteWithMethods(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n\n        $resource = new ResourceMetadata(alias: 'app.book');\n        $operation = (new Index())->withMethods(['GET', 'POST']);\n\n        $this->routePathFactory\n            ->method('createRoutePath')\n            ->willReturn('/books');\n\n        $route = $this->operationRouteFactory->create($metadata, $resource, $operation);\n\n        $this->assertSame(['GET', 'POST'], $route->getMethods());\n    }\n\n    public function testItCreatesRouteWithDefaultMethodsForIndex(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $metadata->method('getPluralName')->willReturn('books');\n\n        $resource = new ResourceMetadata(alias: 'app.book');\n        $operation = new Index(); // Index has default method 'GET'\n\n        $this->routePathFactory\n            ->method('createRoutePath')\n            ->willReturn('/books');\n\n        $route = $this->operationRouteFactory->create($metadata, $resource, $operation);\n\n        $this->assertSame(['GET'], $route->getMethods());\n    }\n\n    public function testItCreatesRouteWithCondition(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $metadata->method('getPluralName')->willReturn('books');\n\n        $resource = new ResourceMetadata(alias: 'app.book');\n        $operation = (new Index())->withRouteCondition('context.getMethod() == \"GET\"');\n\n        $this->routePathFactory\n            ->method('createRoutePath')\n            ->willReturn('/books');\n\n        $route = $this->operationRouteFactory->create($metadata, $resource, $operation);\n\n        $this->assertSame('context.getMethod() == \"GET\"', $route->getCondition());\n    }\n\n    public function testItCreatesRouteWithEmptyConditionWhenNotSet(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n\n        $resource = new ResourceMetadata(alias: 'app.book');\n        $operation = new Index();\n\n        $this->routePathFactory\n            ->method('createRoutePath')\n            ->willReturn('/books');\n\n        $route = $this->operationRouteFactory->create($metadata, $resource, $operation);\n\n        $this->assertSame('', $route->getCondition());\n    }\n\n    public function testItUrlizesPluralName(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n\n        $resource = new ResourceMetadata(alias: 'app.book_category', pluralName: 'Book Categories');\n        $operation = new Index();\n\n        $this->routePathFactory\n            ->expects($this->once())\n            ->method('createRoutePath')\n            ->with($operation, 'book-categories')\n            ->willReturn('/book-categories');\n\n        $route = $this->operationRouteFactory->create($metadata, $resource, $operation);\n\n        $this->assertSame('/book-categories', $route->getPath());\n    }\n\n    public function testItUrlizesPluralNameWithBcLayerEnabled(): void\n    {\n        $this->markAsSkippedIfBcLayerCannotBeEnabled();\n\n        $metadata = $this->createMock(MetadataInterface::class);\n        $metadata->method('getPluralName')->willReturn('Book Categories');\n\n        $resource = new ResourceMetadata(alias: 'app.book_category');\n        $operation = new Index();\n\n        $this->routePathFactory\n            ->expects($this->once())\n            ->method('createRoutePath')\n            ->with($operation, 'book-categories')\n            ->willReturn('/book-categories');\n\n        $route = $this->bcOperationRouteFactory->create($metadata, $resource, $operation);\n\n        $this->assertSame('/book-categories', $route->getPath());\n    }\n\n    public function testItUrlizesPluralNameUsingUnderscoreAsSeparator(): void\n    {\n        $operationRouteFactory = new OperationRouteFactory($this->routePathFactory, new UnderscorePathSegmentNameGenerator(new Inflector()), false);\n\n        $metadata = $this->createMock(MetadataInterface::class);\n\n        $resource = new ResourceMetadata(alias: 'app.book_category', pluralName: 'BookCategories');\n        $operation = new Index();\n\n        $this->routePathFactory\n            ->expects($this->once())\n            ->method('createRoutePath')\n            ->with($operation, 'book_categories')\n            ->willReturn('/book_categories');\n\n        $route = $operationRouteFactory->create($metadata, $resource, $operation);\n\n        $this->assertSame('/book_categories', $route->getPath());\n    }\n\n    private function markAsSkippedIfBcLayerCannotBeEnabled(): void\n    {\n        if (!class_exists(Transliterator::class)) {\n            $this->markTestSkipped('This test requires The Behat Transliterator.');\n        }\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Routing/Factory/Resource/ResourceRouteCollectionFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Routing\\Factory\\Resource;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithOperations;\nuse Sylius\\Component\\Resource\\Tests\\Dummy\\DummyResourceWithRoutePriorities;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Inflector\\Inflector;\nuse Sylius\\Resource\\Metadata\\Metadata;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\Registry;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\AttributesResourceMetadataCollectionFactory;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\OperationRouteFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\Resource\\ResourceRouteCollectionFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RouteName\\OperationRouteNameFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\OperationRoutePathFactoryInterface;\n\nfinal class ResourceRouteCollectionFactoryTest extends TestCase\n{\n    private ResourceRouteCollectionFactory $factory;\n\n    private RegistryInterface $resourceRegistry;\n\n    private OperationRoutePathFactoryInterface $routePathFactory;\n\n    protected function setUp(): void\n    {\n        $this->resourceRegistry = new Registry();\n        $this->routePathFactory = $this->createMock(OperationRoutePathFactoryInterface::class);\n\n        $this->factory = new ResourceRouteCollectionFactory(\n            new OperationRouteFactory($this->routePathFactory, new Operation\\DashPathSegmentNameGenerator(new Inflector()), false),\n            new AttributesResourceMetadataCollectionFactory(\n                $this->resourceRegistry,\n                new OperationRouteNameFactory(),\n            ),\n            $this->resourceRegistry,\n        );\n    }\n\n    public function testItCreatesRoutesWithOperations(): void\n    {\n        $this->resourceRegistry->add(Metadata::fromAliasAndConfiguration('app.dummy', [\n            'driver' => 'dummy_driver',\n        ]));\n\n        $routeCollection = $this->factory->createRouteCollectionForClass(DummyResourceWithOperations::class);\n\n        $this->assertCount(4, $routeCollection);\n        $this->assertNotNull($routeCollection->get('app_dummy_index'), 'Route \"app_dummy_index\" not found but it should.');\n        $this->assertNotNull($routeCollection->get('app_dummy_create'), 'Route \"app_dummy_create\" not found but it should.');\n        $this->assertNotNull($routeCollection->get('app_dummy_update'), 'Route \"app_dummy_update\" not found but it should.');\n        $this->assertNotNull($routeCollection->get('app_dummy_show'), 'Route \"app_dummy_show\" not found but it should.');\n    }\n\n    public function testItCreatesRoutesWithPriorities(): void\n    {\n        $this->resourceRegistry->add(Metadata::fromAliasAndConfiguration('app.dummy', [\n            'driver' => 'dummy_driver',\n        ]));\n\n        $routeCollection = $this->factory->createRouteCollectionForClass(DummyResourceWithRoutePriorities::class);\n\n        $this->assertCount(4, $routeCollection);\n\n        $routeNames = array_keys(iterator_to_array($routeCollection->getIterator()));\n        $this->assertSame([\n            'app_dummy_create',\n            'app_dummy_update',\n            'app_dummy_index',\n            'app_dummy_show',\n        ], $routeNames);\n    }\n\n    public function testItSkipsNonHttpOperations(): void\n    {\n        $nonHttpOperation = new class() extends Operation {\n            public function getShortName(): ?string\n            {\n                return 'custom';\n            }\n        };\n\n        $httpOperation = (new Index(name: 'app_dummy_index'))->withRouteName('app_dummy_index');\n\n        $resource = new ResourceMetadata(\n            alias: 'app.dummy',\n            name: 'dummy',\n            pluralName: 'dummies',\n            operations: [\n                'app_dummy_custom' => $nonHttpOperation,\n                'app_dummy_index' => $httpOperation,\n            ],\n        );\n\n        $resourceCollection = new ResourceMetadataCollection();\n        $resourceCollection[] = $resource;\n\n        $resourceMetadataFactory = $this->createMock(ResourceMetadataCollectionFactoryInterface::class);\n        $resourceMetadataFactory\n            ->method('create')\n            ->with(\\stdClass::class)\n            ->willReturn($resourceCollection);\n\n        $this->resourceRegistry->add(Metadata::fromAliasAndConfiguration('app.dummy', [\n            'driver' => 'dummy_driver',\n        ]));\n\n        $factory = new ResourceRouteCollectionFactory(\n            new OperationRouteFactory($this->routePathFactory, new Operation\\DashPathSegmentNameGenerator(new Inflector()), false),\n            $resourceMetadataFactory,\n            $this->resourceRegistry,\n        );\n\n        $routeCollection = $factory->createRouteCollectionForClass(\\stdClass::class);\n\n        $this->assertCount(1, $routeCollection);\n        $this->assertNotNull($routeCollection->get('app_dummy_index'), 'Route \"app_dummy_index\" not found but it should.');\n        $this->assertNull($routeCollection->get('app_dummy_custom'), 'Non-HTTP operation should not create a route.');\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Routing/Factory/RouteName/OperationRouteNameFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Routing\\Factory\\RouteName;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RouteName\\OperationRouteNameFactory;\n\nfinal class OperationRouteNameFactoryTest extends TestCase\n{\n    private OperationRouteNameFactory $operationRouteNameFactory;\n\n    protected function setUp(): void\n    {\n        $this->operationRouteNameFactory = new OperationRouteNameFactory();\n    }\n\n    public function testItCreatesRouteNameForOperationWithResource(): void\n    {\n        $resource = new ResourceMetadata(\n            alias: 'app.dummy',\n            name: 'dummy',\n            applicationName: 'app',\n        );\n\n        $operation = (new Index())->withResource($resource);\n\n        $result = $this->operationRouteNameFactory->createRouteName($operation);\n\n        $this->assertSame('app_dummy_index', $result);\n    }\n\n    public function testItCreatesRouteNameForOperationWithSection(): void\n    {\n        $resource = new ResourceMetadata(\n            alias: 'app.dummy',\n            section: 'admin',\n            name: 'dummy',\n            applicationName: 'app',\n        );\n\n        $operation = (new Index())->withResource($resource);\n\n        $result = $this->operationRouteNameFactory->createRouteName($operation);\n\n        $this->assertSame('app_admin_dummy_index', $result);\n    }\n\n    public function testItCreatesRouteNameWithCustomShortName(): void\n    {\n        $resource = new ResourceMetadata(\n            alias: 'app.dummy',\n            name: 'dummy',\n            applicationName: 'app',\n        );\n\n        $operation = (new Show())->withResource($resource);\n\n        $result = $this->operationRouteNameFactory->createRouteName($operation, 'details');\n\n        $this->assertSame('app_dummy_details', $result);\n    }\n\n    public function testItThrowsExceptionWhenOperationHasNoResourceWithShortName(): void\n    {\n        $operation = new Show(shortName: 'custom_show');\n\n        $this->expectException(\\RuntimeException::class);\n        $this->expectExceptionMessage('No resource was found on the operation \"custom_show\"');\n\n        $this->operationRouteNameFactory->createRouteName($operation);\n    }\n\n    public function testItThrowsExceptionWhenOperationHasNoResourceWithDefaultShortName(): void\n    {\n        $operation = new Show();\n\n        $this->expectException(\\RuntimeException::class);\n        $this->expectExceptionMessage('No resource was found on the operation \"show\"');\n\n        $this->operationRouteNameFactory->createRouteName($operation);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Routing/Factory/RoutePath/BulkOperationRoutePathFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Routing\\Factory\\RoutePath;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\BulkDelete;\nuse Sylius\\Resource\\Metadata\\BulkUpdate;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Inflector\\Inflector;\nuse Sylius\\Resource\\Metadata\\Operation\\DashPathSegmentNameGenerator;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\BulkOperationRoutePathFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\OperationRoutePathFactoryInterface;\n\nfinal class BulkOperationRoutePathFactoryTest extends TestCase\n{\n    private OperationRoutePathFactoryInterface $routePathFactory;\n\n    private BulkOperationRoutePathFactory $bulkOperationRoutePathFactory;\n\n    protected function setUp(): void\n    {\n        $this->routePathFactory = $this->createMock(OperationRoutePathFactoryInterface::class);\n        $this->bulkOperationRoutePathFactory = new BulkOperationRoutePathFactory(\n            $this->routePathFactory,\n            new DashPathSegmentNameGenerator(new Inflector()),\n        );\n    }\n\n    public function testItGeneratesRoutePathForBulkDeleteOperations(): void\n    {\n        $operation = new BulkDelete();\n\n        $result = $this->bulkOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/bulk-delete', $result);\n    }\n\n    public function testItGeneratesRoutePathForBulkUpdateOperations(): void\n    {\n        $operation = new BulkUpdate();\n\n        $result = $this->bulkOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/bulk-update', $result);\n    }\n\n    public function testItDelegatesToDecoratedFactoryForNonBulkOperations(): void\n    {\n        $operation = new Index();\n\n        $this->routePathFactory\n            ->expects($this->once())\n            ->method('createRoutePath')\n            ->with($operation, '/dummies')\n            ->willReturn('/dummies');\n\n        $result = $this->bulkOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies', $result);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Routing/Factory/RoutePath/CollectionOperationRoutePathFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Routing\\Factory\\RoutePath;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Api;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Inflector\\Inflector;\nuse Sylius\\Resource\\Metadata\\Operation\\DashPathSegmentNameGenerator;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\CollectionOperationRoutePathFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\OperationRoutePathFactoryInterface;\n\nfinal class CollectionOperationRoutePathFactoryTest extends TestCase\n{\n    private OperationRoutePathFactoryInterface $routePathFactory;\n\n    private CollectionOperationRoutePathFactory $collectionOperationRoutePathFactory;\n\n    protected function setUp(): void\n    {\n        $this->routePathFactory = $this->createMock(OperationRoutePathFactoryInterface::class);\n        $this->collectionOperationRoutePathFactory = new CollectionOperationRoutePathFactory(\n            $this->routePathFactory,\n            new DashPathSegmentNameGenerator(new Inflector()),\n        );\n    }\n\n    public function testItGeneratesRoutePathForIndexOperations(): void\n    {\n        $operation = new Index();\n\n        $result = $this->collectionOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies', $result);\n    }\n\n    public function testItGeneratesRoutePathForIndexOperationsWithCustomShortName(): void\n    {\n        $operation = new Index(shortName: 'list');\n\n        $result = $this->collectionOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/list', $result);\n    }\n\n    public function testItGeneratesRoutePathForApiGetCollectionOperations(): void\n    {\n        $operation = new Api\\GetCollection();\n\n        $result = $this->collectionOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies', $result);\n    }\n\n    public function testItDelegatesToDecoratedFactoryForNonCollectionOperations(): void\n    {\n        $operation = new Show();\n\n        $this->routePathFactory\n            ->expects($this->once())\n            ->method('createRoutePath')\n            ->with($operation, '/dummies')\n            ->willReturn('/dummies/{id}');\n\n        $result = $this->collectionOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{id}', $result);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Routing/Factory/RoutePath/CreateOperationRoutePathFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Routing\\Factory\\RoutePath;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Api;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Inflector\\Inflector;\nuse Sylius\\Resource\\Metadata\\Operation\\DashPathSegmentNameGenerator;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\CreateOperationRoutePathFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\OperationRoutePathFactoryInterface;\n\nfinal class CreateOperationRoutePathFactoryTest extends TestCase\n{\n    private OperationRoutePathFactoryInterface $routePathFactory;\n\n    private CreateOperationRoutePathFactory $createOperationRoutePathFactory;\n\n    protected function setUp(): void\n    {\n        $this->routePathFactory = $this->createMock(OperationRoutePathFactoryInterface::class);\n        $this->createOperationRoutePathFactory = new CreateOperationRoutePathFactory(\n            $this->routePathFactory,\n            new DashPathSegmentNameGenerator(new Inflector()),\n        );\n    }\n\n    public function testItGeneratesRoutePathForCreateOperations(): void\n    {\n        $operation = new Create();\n\n        $result = $this->createOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/new', $result);\n    }\n\n    public function testItGeneratesRoutePathForCreateOperationsWithCustomShortName(): void\n    {\n        $operation = new Create(shortName: 'register');\n\n        $result = $this->createOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/register', $result);\n    }\n\n    public function testItGeneratesRoutePathForApiPostOperations(): void\n    {\n        $operation = new Api\\Post();\n\n        $result = $this->createOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies', $result);\n    }\n\n    public function testItDelegatesToDecoratedFactoryForNonCreateOperations(): void\n    {\n        $operation = new Index();\n\n        $this->routePathFactory\n            ->expects($this->once())\n            ->method('createRoutePath')\n            ->with($operation, '/dummies')\n            ->willReturn('/dummies');\n\n        $result = $this->createOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies', $result);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Routing/Factory/RoutePath/DeleteOperationRoutePathFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Routing\\Factory\\RoutePath;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Api;\nuse Sylius\\Resource\\Metadata\\Delete;\nuse Sylius\\Resource\\Metadata\\Inflector\\Inflector;\nuse Sylius\\Resource\\Metadata\\Operation\\DashPathSegmentNameGenerator;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\DeleteOperationRoutePathFactory;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\OperationRoutePathFactoryInterface;\n\nfinal class DeleteOperationRoutePathFactoryTest extends TestCase\n{\n    private OperationRoutePathFactoryInterface $routePathFactory;\n\n    private DeleteOperationRoutePathFactory $deleteOperationRoutePathFactory;\n\n    protected function setUp(): void\n    {\n        $this->routePathFactory = $this->createMock(OperationRoutePathFactoryInterface::class);\n        $this->deleteOperationRoutePathFactory = new DeleteOperationRoutePathFactory(\n            $this->routePathFactory,\n            new DashPathSegmentNameGenerator(new Inflector()),\n        );\n    }\n\n    public function testItGeneratesRoutePathForDeleteOperations(): void\n    {\n        $operation = new Delete();\n\n        $result = $this->deleteOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{id}/delete', $result);\n    }\n\n    public function testItGeneratesRoutePathForDeleteOperationsWithCustomIdentifier(): void\n    {\n        $operation = (new Delete())->withResource(new ResourceMetadata(identifier: 'code'));\n\n        $result = $this->deleteOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{code}/delete', $result);\n    }\n\n    public function testItGeneratesRoutePathForDeleteOperationsWithCustomShortName(): void\n    {\n        $operation = new Delete(shortName: 'remove');\n\n        $result = $this->deleteOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{id}/remove', $result);\n    }\n\n    public function testItGeneratesRoutePathForApiDeleteOperations(): void\n    {\n        $operation = new Api\\Delete();\n\n        $result = $this->deleteOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{id}', $result);\n    }\n\n    public function testItGeneratesRoutePathForApiDeleteOperationsWithCustomShortName(): void\n    {\n        $operation = new Api\\Delete(shortName: 'remove');\n\n        $result = $this->deleteOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{id}/remove', $result);\n    }\n\n    public function testItDelegatesToDecoratedFactoryForNonDeleteOperations(): void\n    {\n        $operation = new Show();\n\n        $this->routePathFactory\n            ->expects($this->once())\n            ->method('createRoutePath')\n            ->with($operation, '/dummies')\n            ->willReturn('/dummies/{id}');\n\n        $result = $this->deleteOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{id}', $result);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Routing/Factory/RoutePath/OperationRoutePathFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Routing\\Factory\\RoutePath;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\OperationRoutePathFactory;\n\nfinal class OperationRoutePathFactoryTest extends TestCase\n{\n    private OperationRoutePathFactory $operationRoutePathFactory;\n\n    protected function setUp(): void\n    {\n        $this->operationRoutePathFactory = new OperationRoutePathFactory();\n    }\n\n    public function testItThrowsExceptionWhenCalledWithOperationWithName(): void\n    {\n        $operation = new Show(name: 'app_dummy_show');\n\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage('Impossible to get a default route path for operation \"app_dummy_show\". Please define a path.');\n\n        $this->operationRoutePathFactory->createRoutePath($operation, '/dummies');\n    }\n\n    public function testItThrowsExceptionWhenCalledWithOperationWithoutName(): void\n    {\n        $operation = new Show();\n\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage('Impossible to get a default route path for operation \"\". Please define a path.');\n\n        $this->operationRoutePathFactory->createRoutePath($operation, '/dummies');\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Routing/Factory/RoutePath/ShowOperationRoutePathFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Routing\\Factory\\RoutePath;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Api;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Inflector\\Inflector;\nuse Sylius\\Resource\\Metadata\\Operation\\DashPathSegmentNameGenerator;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\OperationRoutePathFactoryInterface;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\ShowOperationRoutePathFactory;\n\nfinal class ShowOperationRoutePathFactoryTest extends TestCase\n{\n    private OperationRoutePathFactoryInterface $routePathFactory;\n\n    private ShowOperationRoutePathFactory $showOperationRoutePathFactory;\n\n    protected function setUp(): void\n    {\n        $this->routePathFactory = $this->createMock(OperationRoutePathFactoryInterface::class);\n        $this->showOperationRoutePathFactory = new ShowOperationRoutePathFactory(\n            $this->routePathFactory,\n            new DashPathSegmentNameGenerator(new Inflector()),\n        );\n    }\n\n    public function testItGeneratesRoutePathForShowOperations(): void\n    {\n        $operation = new Show();\n\n        $result = $this->showOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{id}', $result);\n    }\n\n    public function testItGeneratesRoutePathForShowOperationsWithCustomIdentifier(): void\n    {\n        $operation = (new Show())->withResource(new ResourceMetadata(identifier: 'code'));\n\n        $result = $this->showOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{code}', $result);\n    }\n\n    public function testItGeneratesRoutePathForShowOperationsWithCustomShortName(): void\n    {\n        $operation = new Show(shortName: 'details');\n\n        $result = $this->showOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{id}/details', $result);\n    }\n\n    public function testItGeneratesRoutePathForApiGetOperations(): void\n    {\n        $operation = new Api\\Get();\n\n        $result = $this->showOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{id}', $result);\n    }\n\n    public function testItDelegatesToDecoratedFactoryForNonShowOperations(): void\n    {\n        $operation = new Index();\n\n        $this->routePathFactory\n            ->expects($this->once())\n            ->method('createRoutePath')\n            ->with($operation, '/dummies')\n            ->willReturn('/dummies');\n\n        $result = $this->showOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies', $result);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Routing/Factory/RoutePath/UpdateOperationRoutePathFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Routing\\Factory\\RoutePath;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Api;\nuse Sylius\\Resource\\Metadata\\Inflector\\Inflector;\nuse Sylius\\Resource\\Metadata\\Operation\\DashPathSegmentNameGenerator;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\OperationRoutePathFactoryInterface;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RoutePath\\UpdateOperationRoutePathFactory;\n\nfinal class UpdateOperationRoutePathFactoryTest extends TestCase\n{\n    private OperationRoutePathFactoryInterface $routePathFactory;\n\n    private UpdateOperationRoutePathFactory $updateOperationRoutePathFactory;\n\n    protected function setUp(): void\n    {\n        $this->routePathFactory = $this->createMock(OperationRoutePathFactoryInterface::class);\n        $this->updateOperationRoutePathFactory = new UpdateOperationRoutePathFactory(\n            $this->routePathFactory,\n            new DashPathSegmentNameGenerator(new Inflector()),\n        );\n    }\n\n    public function testItGeneratesRoutePathForUpdateOperations(): void\n    {\n        $operation = new Update();\n\n        $result = $this->updateOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{id}/edit', $result);\n    }\n\n    public function testItGeneratesRoutePathForUpdateOperationsWithCustomIdentifier(): void\n    {\n        $operation = (new Update())->withResource(new ResourceMetadata(identifier: 'code'));\n\n        $result = $this->updateOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{code}/edit', $result);\n    }\n\n    public function testItGeneratesRoutePathForUpdateOperationsWithCustomShortName(): void\n    {\n        $operation = new Update(shortName: 'edition');\n\n        $result = $this->updateOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{id}/edition', $result);\n    }\n\n    public function testItGeneratesRoutePathForApiPutOperations(): void\n    {\n        $operation = new Api\\Put();\n\n        $result = $this->updateOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{id}', $result);\n    }\n\n    public function testItGeneratesRoutePathForApiPatchOperations(): void\n    {\n        $operation = new Api\\Patch();\n\n        $result = $this->updateOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{id}', $result);\n    }\n\n    public function testItDelegatesToDecoratedFactoryForNonUpdateOperations(): void\n    {\n        $operation = new Show();\n\n        $this->routePathFactory\n            ->expects($this->once())\n            ->method('createRoutePath')\n            ->with($operation, '/dummies')\n            ->willReturn('/dummies/{id}');\n\n        $result = $this->updateOperationRoutePathFactory->createRoutePath($operation, '/dummies');\n\n        $this->assertSame('/dummies/{id}', $result);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Routing/Loader/ResourceLoaderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Routing\\Loader;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceClassListFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceClassList;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\Resource\\ResourceRouteCollectionFactoryInterface;\nuse Sylius\\Resource\\Symfony\\Routing\\Loader\\ResourceLoader;\nuse Symfony\\Bundle\\FrameworkBundle\\Routing\\RouteLoaderInterface;\nuse Symfony\\Component\\Routing\\Route;\nuse Symfony\\Component\\Routing\\RouteCollection;\n\nfinal class ResourceLoaderTest extends TestCase\n{\n    private ResourceLoader $loader;\n\n    private ResourceClassListFactoryInterface $resourceClassListFactory;\n\n    private ResourceRouteCollectionFactoryInterface $resourceRouteCollectionFactory;\n\n    protected function setUp(): void\n    {\n        $this->resourceClassListFactory = $this->createMock(ResourceClassListFactoryInterface::class);\n        $this->resourceRouteCollectionFactory = $this->createMock(ResourceRouteCollectionFactoryInterface::class);\n\n        $this->loader = new ResourceLoader(\n            $this->resourceClassListFactory,\n            $this->resourceRouteCollectionFactory,\n        );\n    }\n\n    public function testItIsARouteLoader(): void\n    {\n        $this->assertInstanceOf(RouteLoaderInterface::class, $this->loader);\n    }\n\n    public function testItGeneratesRoutesFromResource(): void\n    {\n        $routeCollection = new RouteCollection();\n        $routeCollection->add('first_route', new Route('/first-route'));\n        $routeCollection->add('second_route', new Route('/second-route'));\n\n        $resourceClassList = new ResourceClassList(['\\DummyClass']);\n\n        $this->resourceClassListFactory->method('create')->willReturn($resourceClassList);\n        $this->resourceRouteCollectionFactory->method('createRouteCollectionForClass')->with('\\DummyClass')->willReturn($routeCollection);\n\n        $this->assertEquals($routeCollection, ($this->loader)());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Routing/RedirectHandlerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Routing;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\GridBundle\\Storage\\FilterStorageInterface;\nuse Sylius\\Resource\\Exception\\InvalidArgumentException;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Delete;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Symfony\\ExpressionLanguage\\ArgumentParserInterface;\nuse Sylius\\Resource\\Symfony\\Routing\\Factory\\RouteName\\OperationRouteNameFactoryInterface;\nuse Sylius\\Resource\\Symfony\\Routing\\RedirectHandler;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\Routing\\RouterInterface;\n\nfinal class RedirectHandlerTest extends TestCase\n{\n    private RouterInterface&MockObject $router;\n\n    private ArgumentParserInterface&MockObject $argumentParser;\n\n    private OperationRouteNameFactoryInterface&MockObject $operationRouteNameFactory;\n\n    private FilterStorageInterface&MockObject $filterStorage;\n\n    private RedirectHandler $redirectHandler;\n\n    protected function setUp(): void\n    {\n        $this->router = $this->createMock(RouterInterface::class);\n        $this->argumentParser = $this->createMock(ArgumentParserInterface::class);\n        $this->operationRouteNameFactory = $this->createMock(OperationRouteNameFactoryInterface::class);\n        $this->filterStorage = $this->createMock(FilterStorageInterface::class);\n\n        $this->redirectHandler = new RedirectHandler(\n            $this->router,\n            $this->argumentParser,\n            $this->operationRouteNameFactory,\n            $this->filterStorage,\n        );\n    }\n\n    private function createDataWithId(string $id = 'xyz'): \\stdClass\n    {\n        $data = new \\stdClass();\n        $data->id = $id;\n\n        return $data;\n    }\n\n    private function createDataWithCode(string $code = 'xyz'): \\stdClass\n    {\n        $data = new \\stdClass();\n        $data->code = $code;\n\n        return $data;\n    }\n\n    private function mockFilterStorage(array $filters = []): void\n    {\n        $this->filterStorage->method('all')->willReturn($filters);\n    }\n\n    private function mockRouter(string $route, array $parameters, string $returnUrl): void\n    {\n        $this->router\n            ->expects($this->once())\n            ->method('generate')\n            ->with($route, $parameters)\n            ->willReturn($returnUrl);\n    }\n\n    public function testItRedirectsToResourceWithIdArgumentByDefault(): void\n    {\n        $data = $this->createDataWithId();\n        $operation = (new Create(redirectToRoute: 'app_dummy_index'))\n            ->withResource(new ResourceMetadata(alias: 'app.book'));\n        $request = $this->createMock(Request::class);\n\n        $this->mockFilterStorage();\n        $this->mockRouter('app_dummy_index', ['id' => 'xyz'], '/dummies');\n\n        $this->redirectHandler->redirectToResource($data, $operation, $request);\n    }\n\n    public function testItRedirectsToResourceWithCustomIdentifierArgumentByDefault(): void\n    {\n        $data = $this->createDataWithCode();\n        $operation = (new Create(redirectToRoute: 'app_dummy_index'))\n            ->withResource(new ResourceMetadata(alias: 'app.ok', identifier: 'code'));\n        $request = $this->createMock(Request::class);\n\n        $this->mockFilterStorage();\n        $this->mockRouter('app_dummy_index', ['code' => 'xyz'], '/dummies');\n\n        $this->redirectHandler->redirectToResource($data, $operation, $request);\n    }\n\n    public function testItRedirectsToResourceWithoutArgumentsAfterDeleteOperationByDefault(): void\n    {\n        $data = $this->createDataWithId();\n        $operation = (new Delete(redirectToRoute: 'app_dummy_index'))\n            ->withResource(new ResourceMetadata(alias: 'app.book'));\n        $request = $this->createMock(Request::class);\n\n        $this->mockFilterStorage();\n        $this->mockRouter('app_dummy_index', [], '/dummies');\n\n        $this->redirectHandler->redirectToResource($data, $operation, $request);\n    }\n\n    public function testItUsesFiltersFromGridStorageWhenRedirectingToAnIndexOperation(): void\n    {\n        $data = $this->createDataWithId();\n        $operation = (new Delete(redirectToRoute: 'app_dummy_index'))\n            ->withResource(new ResourceMetadata(alias: 'app.book'));\n        $request = $this->createMock(Request::class);\n\n        $this->mockFilterStorage(['criteria' => ['enabled' => true]]);\n        $this->mockRouter('app_dummy_index', ['criteria' => ['enabled' => true]], '/dummies');\n\n        $this->redirectHandler->redirectToResource($data, $operation, $request);\n    }\n\n    public function testItRedirectsToRoute(): void\n    {\n        $data = new \\stdClass();\n\n        $this->mockFilterStorage();\n        $this->mockRouter('app_dummy_index', [], '/dummies');\n\n        $this->redirectHandler->redirectToRoute($data, 'app_dummy_index');\n    }\n\n    public function testItThrowsAnExceptionWhenOperationHasNoResource(): void\n    {\n        $data = new \\stdClass();\n        $operation = new Create(redirectToRoute: 'app_dummy_index', name: 'app_dummy_create');\n        $request = $this->createMock(Request::class);\n\n        $this->expectException(\\RuntimeException::class);\n        $this->expectExceptionMessage('Operation \"app_dummy_create\" has no resource, but it should.');\n\n        $this->redirectHandler->redirectToResource($data, $operation, $request);\n    }\n\n    public function testItThrowsAnExceptionWhenOperationHasNoRouteRedirection(): void\n    {\n        $data = new \\stdClass();\n        $operation = new Create(name: 'app_dummy_create');\n        $request = $this->createMock(Request::class);\n\n        $this->expectException(\\RuntimeException::class);\n        $this->expectExceptionMessage('Operation \"app_dummy_create\" has no redirection route, but it should.');\n\n        $this->redirectHandler->redirectToResource($data, $operation, $request);\n    }\n\n    public function testItThrowsAnExceptionWhenTryingRedirectWithCustomArgumentsThatAreNotScalarOnes(): void\n    {\n        $data = new \\stdClass();\n        $data->code = 'xyz';\n\n        $operation = new Create(\n            redirectToRoute: 'app_dummy_index',\n            redirectArguments: ['code' => 'resource.code', 'criteria' => ['foo' => 'resource.code', 'bar' => new \\stdClass()]],\n        );\n        $resource = new ResourceMetadata(alias: 'app.book');\n        $operation = $operation->withResource($resource);\n\n        $request = $this->createMock(Request::class);\n\n        $this->expectException(InvalidArgumentException::class);\n        $this->expectExceptionMessage('Parameter \"bar\" should be a scalar or an array.');\n\n        $this->redirectHandler->redirectToResource($data, $operation, $request);\n    }\n\n    public function testItRedirectsToOperationWithIdArgumentByDefault(): void\n    {\n        $data = $this->createDataWithId();\n        $operation = (new Create(name: 'app_dummy_create'))\n            ->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'dummy', applicationName: 'app'));\n        $request = $this->createMock(Request::class);\n\n        $this->operationRouteNameFactory\n            ->expects($this->once())\n            ->method('createRouteName')\n            ->with($operation, 'show')\n            ->willReturn('app_dummy_show');\n\n        $this->mockFilterStorage();\n        $this->mockRouter('app_dummy_show', ['id' => 'xyz'], '/dummies/xyz');\n\n        $response = $this->redirectHandler->redirectToOperation($data, $operation, $request, 'show');\n\n        $this->assertSame('/dummies/xyz', $response->getTargetUrl());\n        $this->assertSame(302, $response->getStatusCode());\n    }\n\n    public function testItRedirectsToOperationWithCustomIdentifierArgumentByDefault(): void\n    {\n        $data = $this->createDataWithCode('ABC123');\n        $operation = (new Create(name: 'app_product_create'))\n            ->withResource(new ResourceMetadata(alias: 'app.product', name: 'product', applicationName: 'app', identifier: 'code'));\n        $request = $this->createMock(Request::class);\n\n        $this->operationRouteNameFactory\n            ->expects($this->once())\n            ->method('createRouteName')\n            ->with($operation, 'update')\n            ->willReturn('app_product_update');\n\n        $this->mockFilterStorage();\n        $this->mockRouter('app_product_update', ['code' => 'ABC123'], '/products/ABC123/edit');\n\n        $response = $this->redirectHandler->redirectToOperation($data, $operation, $request, 'update');\n\n        $this->assertSame('/products/ABC123/edit', $response->getTargetUrl());\n        $this->assertSame(302, $response->getStatusCode());\n    }\n\n    public function testItRedirectsToOperationForDeleteWithoutArgumentsByDefault(): void\n    {\n        $data = $this->createDataWithId();\n        $operation = (new Delete(name: 'app_dummy_delete'))\n            ->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'dummy', applicationName: 'app'));\n        $request = $this->createMock(Request::class);\n\n        $this->operationRouteNameFactory\n            ->expects($this->once())\n            ->method('createRouteName')\n            ->with($operation, 'index')\n            ->willReturn('app_dummy_index');\n\n        $this->mockFilterStorage();\n        $this->mockRouter('app_dummy_index', [], '/dummies');\n\n        $response = $this->redirectHandler->redirectToOperation($data, $operation, $request, 'index');\n\n        $this->assertSame('/dummies', $response->getTargetUrl());\n        $this->assertSame(302, $response->getStatusCode());\n    }\n\n    public function testItRedirectsToOperationWithCustomRedirectArguments(): void\n    {\n        $data = new \\stdClass();\n        $data->id = 'xyz';\n        $data->slug = 'my-book';\n\n        $operation = new Create(\n            name: 'app_book_create',\n            redirectArguments: ['slug' => 'resource.slug'],\n        );\n        $resource = new ResourceMetadata(alias: 'app.book', name: 'book', applicationName: 'app');\n        $operation = $operation->withResource($resource);\n\n        $request = $this->createMock(Request::class);\n\n        $this->operationRouteNameFactory\n            ->expects($this->once())\n            ->method('createRouteName')\n            ->with($operation, 'show')\n            ->willReturn('app_book_show');\n\n        $this->filterStorage->method('all')->willReturn([]);\n        $this->router\n            ->expects($this->once())\n            ->method('generate')\n            ->with('app_book_show', ['slug' => 'my-book'])\n            ->willReturn('/books/my-book');\n\n        $response = $this->redirectHandler->redirectToOperation($data, $operation, $request, 'show');\n\n        $this->assertSame('/books/my-book', $response->getTargetUrl());\n    }\n\n    public function testItThrowsExceptionWhenOperationHasNoResourceInRedirectToOperation(): void\n    {\n        $data = new \\stdClass();\n        $operation = new Create(name: 'app_dummy_create');\n        $request = $this->createMock(Request::class);\n\n        $this->operationRouteNameFactory\n            ->method('createRouteName')\n            ->willReturn('app_dummy_show');\n\n        $this->expectException(\\RuntimeException::class);\n        $this->expectExceptionMessage('Operation \"app_dummy_create\" has no resource, but it should.');\n\n        $this->redirectHandler->redirectToOperation($data, $operation, $request, 'show');\n    }\n\n    public function testItParsesNestedArrayArguments(): void\n    {\n        $data = $this->createDataWithId();\n        $data->code = 'ABC';\n\n        $operation = (new Create(\n            redirectToRoute: 'app_dummy_index',\n            redirectArguments: [\n                'id' => 'resource.id',\n                'criteria' => [\n                    'code' => 'resource.code',\n                    'enabled' => true,\n                ],\n            ],\n        ))->withResource(new ResourceMetadata(alias: 'app.book'));\n        $request = $this->createMock(Request::class);\n\n        $this->mockFilterStorage();\n        $this->mockRouter('app_dummy_index', [\n            'id' => 'xyz',\n            'criteria' => [\n                'code' => 'ABC',\n                'enabled' => true,\n            ],\n        ], '/dummies');\n\n        $this->redirectHandler->redirectToResource($data, $operation, $request);\n    }\n\n    public function testItParsesResourcePropertyPathWithPropertyAccessor(): void\n    {\n        $data = $this->createDataWithId();\n        $data->author = new \\stdClass();\n        $data->author->name = 'John Doe';\n\n        $operation = (new Create(\n            redirectToRoute: 'app_book_show',\n            redirectArguments: ['id' => 'resource.id', 'author' => 'resource.author.name'],\n        ))->withResource(new ResourceMetadata(alias: 'app.book'));\n        $request = $this->createMock(Request::class);\n\n        $this->mockFilterStorage();\n        $this->mockRouter('app_book_show', ['id' => 'xyz', 'author' => 'John Doe'], '/books/xyz');\n\n        $this->redirectHandler->redirectToResource($data, $operation, $request);\n    }\n\n    public function testItUsesExpressionParserForStringValuesWithoutResourcePrefix(): void\n    {\n        $data = $this->createDataWithId();\n        $operation = (new Create(\n            redirectToRoute: 'app_book_show',\n            redirectArguments: ['id' => 'resource.id', 'page' => \"request.query.get('page')\"],\n        ))->withResource(new ResourceMetadata(alias: 'app.book')); // name is null\n        $request = $this->createMock(Request::class);\n\n        $this->argumentParser\n            ->expects($this->once())\n            ->method('parseExpression')\n            ->with(\"request.query.get('page')\", ['resource' => $data]) // Only 'resource', no name\n            ->willReturn('1');\n\n        $this->mockFilterStorage();\n        $this->router\n            ->method('generate')\n            ->with('app_book_show', ['id' => 'xyz', 'page' => '1'])\n            ->willReturn('/books/xyz?page=1');\n\n        $this->redirectHandler->redirectToResource($data, $operation, $request);\n    }\n\n    public function testItUsesExpressionParserForExpressionLanguagePrefixedValues(): void\n    {\n        $data = $this->createDataWithId();\n        $operation = (new Create(\n            redirectToRoute: 'app_book_show',\n            redirectArguments: ['id' => '@resource.getId()', 'page' => \"@=request.query.get('page')\"],\n        ))->withResource(new ResourceMetadata(alias: 'app.book')); // name is null\n        $request = $this->createMock(Request::class);\n\n        $this->argumentParser\n            ->expects($this->exactly(2))\n            ->method('parseExpression')\n            ->willReturnCallback(function (string $expression) {\n                if ('@resource.getId()' === $expression) {\n                    return 'xyz';\n                }\n\n                if (\"request.query.get('page')\" === $expression) {\n                    return '1';\n                }\n\n                return null;\n            })\n        ;\n\n        $this->mockFilterStorage();\n        $this->router\n            ->method('generate')\n            ->with('app_book_show', ['id' => 'xyz', 'page' => '1'])\n            ->willReturn('/books/xyz?page=1');\n\n        $this->redirectHandler->redirectToResource($data, $operation, $request);\n    }\n\n    public function testItSkipsExpressionParserForNonStringScalarValues(): void\n    {\n        $data = $this->createDataWithId();\n        $operation = (new Create(\n            redirectToRoute: 'app_book_show',\n            redirectArguments: ['id' => 'resource.id', 'page' => 1, 'active' => true],\n        ))->withResource(new ResourceMetadata(alias: 'app.book'));\n        $request = $this->createMock(Request::class);\n\n        $this->argumentParser\n            ->expects($this->never())\n            ->method('parseExpression');\n\n        $this->mockFilterStorage();\n        $this->mockRouter('app_book_show', ['id' => 'xyz', 'page' => 1, 'active' => true], '/books/xyz');\n\n        $this->redirectHandler->redirectToResource($data, $operation, $request);\n    }\n\n    public function testItUsesExpressionParserWhenPropertyAccessorCannotReadProperty(): void\n    {\n        $data = $this->createDataWithId();\n        $operation = (new Create(\n            redirectToRoute: 'app_book_show',\n            redirectArguments: ['id' => 'resource.id', 'nonExistent' => 'resource.nonExistentProperty'],\n        ))->withResource(new ResourceMetadata(alias: 'app.book', name: 'book'));\n        $request = $this->createMock(Request::class);\n\n        $this->argumentParser\n            ->expects($this->once())\n            ->method('parseExpression')\n            ->with('resource.nonExistentProperty', ['resource' => $data, 'book' => $data])\n            ->willReturn('default_value');\n\n        $this->mockFilterStorage();\n        $this->mockRouter('app_book_show', ['id' => 'xyz', 'nonExistent' => 'default_value'], '/books/xyz');\n\n        $this->redirectHandler->redirectToResource($data, $operation, $request);\n    }\n\n    public function testItAddsResourceNameToVariablesWhenResourceNameIsSet(): void\n    {\n        $data = $this->createDataWithId();\n        $operation = (new Create(\n            redirectToRoute: 'app_book_show',\n            redirectArguments: ['id' => 'resource.id', 'type' => 'hardcover'],\n        ))->withResource(new ResourceMetadata(alias: 'app.book', name: 'book'));\n        $request = $this->createMock(Request::class);\n\n        $this->argumentParser\n            ->expects($this->once())\n            ->method('parseExpression')\n            ->with('hardcover', ['resource' => $data, 'book' => $data])\n            ->willReturn('hardcover');\n\n        $this->mockFilterStorage();\n        $this->router\n            ->method('generate')\n            ->willReturn('/books/xyz');\n\n        $this->redirectHandler->redirectToResource($data, $operation, $request);\n    }\n\n    public function testItDoesNotAddResourceNameToVariablesWhenResourceNameIsNull(): void\n    {\n        $data = $this->createDataWithId();\n        $operation = (new Create(\n            redirectToRoute: 'app_book_show',\n            redirectArguments: ['id' => 'resource.id', 'type' => 'hardcover'],\n        ))->withResource(new ResourceMetadata(alias: 'app.book')); // name is null\n        $request = $this->createMock(Request::class);\n\n        $this->argumentParser\n            ->expects($this->once())\n            ->method('parseExpression')\n            ->with('hardcover', ['resource' => $data])\n            ->willReturn('hardcover');\n\n        $this->mockFilterStorage();\n        $this->router\n            ->method('generate')\n            ->willReturn('/books/xyz');\n\n        $this->redirectHandler->redirectToResource($data, $operation, $request);\n    }\n\n    public function testItHandlesArrayDataWithResourcePrefix(): void\n    {\n        $data = ['id' => 'xyz', 'title' => 'My Book'];\n        $operation = (new Create(\n            redirectToRoute: 'app_book_show',\n            redirectArguments: ['id' => 'resource.id', 'title' => 'resource.title'],\n        ))->withResource(new ResourceMetadata(alias: 'app.book'));\n        $request = $this->createMock(Request::class);\n\n        $this->argumentParser\n            ->expects($this->exactly(2))\n            ->method('parseExpression')\n            ->willReturnCallback(function ($value, $variables) use ($data) {\n                if ($value === 'resource.id') {\n                    return 'xyz';\n                }\n                if ($value === 'resource.title') {\n                    return 'My Book';\n                }\n\n                return $value;\n            });\n\n        $this->mockFilterStorage();\n        $this->mockRouter('app_book_show', ['id' => 'xyz', 'title' => 'My Book'], '/books/xyz');\n\n        $this->redirectHandler->redirectToResource($data, $operation, $request);\n    }\n\n    public function testItRedirectsToRefererWhenHeaderIsPresent(): void\n    {\n        $data = new \\stdClass();\n        $operation = (new Create(redirectTo: 'referer', redirectToRoute: 'app_dummy_index'))\n            ->withResource(new ResourceMetadata(alias: 'app.book'));\n\n        $request = new Request();\n        $request->headers->set('referer', '/previous-page');\n\n        // router should never be called\n        $this->router\n            ->expects($this->never())\n            ->method('generate')\n        ;\n\n        $response = $this->redirectHandler->redirectToResource($data, $operation, $request);\n\n        $this->assertSame('/previous-page', $response->getTargetUrl());\n    }\n\n    public function testItFallsBackToRouteWhenRefererIsMissing(): void\n    {\n        $data = new \\stdClass();\n        $operation = (new Create(redirectTo: 'referer', redirectToRoute: 'app_dummy_index'))\n            ->withResource(new ResourceMetadata(alias: 'app.book'));\n\n        $request = new Request(); // No referer\n\n        $this->router\n            ->expects($this->once())\n            ->method('generate')\n            ->willReturn('/fallback')\n        ;\n\n        $response = $this->redirectHandler->redirectToResource($data, $operation, $request);\n\n        $this->assertSame('/fallback', $response->getTargetUrl());\n    }\n\n    public function testItFallsBackToRouteWhenRefererIsExternal(): void\n    {\n        $data = new \\stdClass();\n        $operation = (new Create(redirectTo: 'referer', redirectToRoute: 'app_dummy_index'))\n            ->withResource(new ResourceMetadata(alias: 'app.book'));\n\n        $request = new Request();\n        $request->headers->set('referer', 'https://malicious.com/');\n\n        $this->router\n            ->expects($this->once())\n            ->method('generate')\n            ->willReturn('/fallback')\n        ;\n\n        $response = $this->redirectHandler->redirectToResource($data, $operation, $request);\n\n        $this->assertSame('/fallback', $response->getTargetUrl());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Security/OperationAccessCheckerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Security;\n\nuse PHPUnit\\Framework\\Attributes\\DataProvider;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Symfony\\Security\\OperationAccessChecker;\nuse Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationTrustResolverInterface;\nuse Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorageInterface;\nuse Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface;\nuse Symfony\\Component\\Security\\Core\\Authorization\\AuthorizationCheckerInterface;\nuse Symfony\\Component\\Security\\Core\\Authorization\\ExpressionLanguage;\nuse Symfony\\Component\\Security\\Core\\Role\\RoleHierarchyInterface;\n\nclass OperationAccessCheckerTest extends TestCase\n{\n    public static function getGranted(): iterable\n    {\n        yield [true];\n        yield [false];\n    }\n\n    private function createTokenMock(array $roleNames = []): TokenInterface\n    {\n        $token = $this->createMock(TokenInterface::class);\n        $token->method('getRoleNames')->willReturn($roleNames);\n\n        return $token;\n    }\n\n    private function createOperationMock(?string $securityExpression = 'is_granted(\"ROLE_ADMIN\")'): Operation\n    {\n        $operation = $this->createMock(Operation::class);\n        $operation->method('getSecurity')->willReturn($securityExpression);\n\n        return $operation;\n    }\n\n    private function createExpressionLanguageMock(string $expression, bool $result): ExpressionLanguage\n    {\n        $expressionLanguage = $this->createMock(ExpressionLanguage::class);\n        $expressionLanguage\n            ->method('evaluate')\n            ->with($expression, $this->isType('array'))\n            ->willReturn($result);\n\n        return $expressionLanguage;\n    }\n\n    #[DataProvider('getGranted')]\n    public function testIsGranted(bool $granted): void\n    {\n        $expressionLanguage = $this->createExpressionLanguageMock('is_granted(\"ROLE_ADMIN\")', $granted);\n        $authenticationTrustResolver = $this->createMock(AuthenticationTrustResolverInterface::class);\n        $token = $this->createTokenMock([]);\n\n        $tokenStorage = $this->createMock(TokenStorageInterface::class);\n        $tokenStorage->method('getToken')->willReturn($token);\n\n        $operation = $this->createOperationMock();\n\n        $checker = new OperationAccessChecker(\n            $expressionLanguage,\n            $authenticationTrustResolver,\n            null,\n            $tokenStorage,\n        );\n\n        $this->assertSame($granted, $checker->isGranted($operation, new Context()));\n    }\n\n    public function testSecurityComponentNotAvailable(): void\n    {\n        $this->expectException(\\LogicException::class);\n        $this->expectExceptionMessage('The \"symfony/security\" library must be installed to use the \"security\" attribute.');\n\n        $checker = new OperationAccessChecker(\n            $this->createMock(ExpressionLanguage::class),\n        );\n        $checker->isGranted(new HttpOperation(), new Context());\n    }\n\n    public function testExpressionLanguageNotInstalled(): void\n    {\n        $this->expectException(\\LogicException::class);\n        $this->expectExceptionMessage('The \"symfony/expression-language\" library must be installed to use the \"security\" attribute.');\n\n        $authenticationTrustResolver = $this->createMock(AuthenticationTrustResolverInterface::class);\n        $tokenStorage = $this->createMock(TokenStorageInterface::class);\n        $tokenStorage->method('getToken')->willReturn($this->createMock(TokenInterface::class));\n\n        $checker = new OperationAccessChecker(\n            null,\n            $authenticationTrustResolver,\n            null,\n            $tokenStorage,\n        );\n        $checker->isGranted(new HttpOperation(), new Context());\n    }\n\n    public function testWithoutAuthenticationToken(): void\n    {\n        $expressionLanguage = $this->createExpressionLanguageMock('is_granted(\"ROLE_ADMIN\")', true);\n        $authenticationTrustResolver = $this->createMock(AuthenticationTrustResolverInterface::class);\n        $authorizationChecker = $this->createMock(AuthorizationCheckerInterface::class);\n\n        $tokenStorage = $this->createMock(TokenStorageInterface::class);\n        $tokenStorage->method('getToken')->willReturn(null);\n\n        $operation = $this->createOperationMock();\n\n        $checker = new OperationAccessChecker(\n            $expressionLanguage,\n            $authenticationTrustResolver,\n            null,\n            $tokenStorage,\n            $authorizationChecker,\n        );\n\n        self::assertTrue($checker->isGranted($operation, new Context()));\n    }\n\n    public function testItGrantsAccessWhenOperationHasNoSecurityExpression(): void\n    {\n        $expressionLanguage = $this->createMock(ExpressionLanguage::class);\n        // Expression language should not be called when security is null\n        $expressionLanguage->expects($this->never())->method('evaluate');\n\n        $authenticationTrustResolver = $this->createMock(AuthenticationTrustResolverInterface::class);\n        $tokenStorage = $this->createMock(TokenStorageInterface::class);\n        $operation = $this->createOperationMock(null);\n\n        $checker = new OperationAccessChecker(\n            $expressionLanguage,\n            $authenticationTrustResolver,\n            null,\n            $tokenStorage,\n        );\n\n        // When security expression is null, should return true (access granted)\n        self::assertTrue($checker->isGranted($operation, new Context()));\n    }\n\n    #[DataProvider('getGranted')]\n    public function testIsGrantedWithRoleHierarchy(bool $granted): void\n    {\n        $expressionLanguage = $this->createExpressionLanguageMock('is_granted(\"ROLE_ADMIN\")', $granted);\n        $authenticationTrustResolver = $this->createMock(AuthenticationTrustResolverInterface::class);\n        $token = $this->createTokenMock(['ROLE_USER']);\n\n        $tokenStorage = $this->createMock(TokenStorageInterface::class);\n        $tokenStorage->method('getToken')->willReturn($token);\n\n        $roleHierarchy = $this->createMock(RoleHierarchyInterface::class);\n        $roleHierarchy\n            ->expects($this->once())\n            ->method('getReachableRoleNames')\n            ->with(['ROLE_USER'])\n            ->willReturn(['ROLE_USER', 'ROLE_ADMIN']);\n\n        $operation = $this->createOperationMock();\n\n        $checker = new OperationAccessChecker(\n            $expressionLanguage,\n            $authenticationTrustResolver,\n            $roleHierarchy,\n            $tokenStorage,\n        );\n\n        $this->assertSame($granted, $checker->isGranted($operation, new Context()));\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Serializer/State/DeserializeProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\tests\\Symfony\\Serializer\\State;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\Delete;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Sylius\\Resource\\Symfony\\Serializer\\State\\DeserializeProvider;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\Serializer\\SerializerInterface;\n\nfinal class DeserializeProviderTest extends TestCase\n{\n    private ProviderInterface|MockObject $decorated;\n\n    private SerializerInterface|MockObject $serializer;\n\n    private DeserializeProvider $deserializableProvider;\n\n    protected function setUp(): void\n    {\n        $this->decorated = $this->createMock(ProviderInterface::class);\n        $this->serializer = $this->createMock(SerializerInterface::class);\n\n        $this->deserializableProvider = new DeserializeProvider(\n            $this->decorated,\n            $this->serializer,\n        );\n    }\n\n    private function createRequestMock(bool $isMethodSafe = false, string $format = 'json', mixed $content = ['food' => 'fighters'], string $method = 'POST'): Request\n    {\n        $request = $this->createMock(Request::class);\n        $request->attributes = new ParameterBag();\n        $request->method('isMethodSafe')->willReturn($isMethodSafe);\n        $request->method('getRequestFormat')->willReturn($format);\n        $request->method('getContent')->willReturn($content);\n        $request->method('getMethod')->willReturn($method);\n\n        return $request;\n    }\n\n    private function createOperationMock(\n        ResourceMetadata|false|null $resource = false,\n        ?bool $canDeserialize = null,\n        ?array $denormalizationContext = [],\n    ): HttpOperation {\n        $operation = $this->createMock(HttpOperation::class);\n\n        if ($resource === false) {\n            $operation->method('getResource')->willReturn(new ResourceMetadata(alias: 'app.dummy', class: 'App\\Resource'));\n        } else {\n            $operation->method('getResource')->willReturn($resource);\n        }\n\n        $operation->method('canDeserialize')->willReturn($canDeserialize);\n        $operation->method('getDenormalizationContext')->willReturn($denormalizationContext);\n\n        return $operation;\n    }\n\n    public function testItDeserializesData(): void\n    {\n        $request = $this->createRequestMock();\n        $operation = $this->createOperationMock();\n        $data = new \\stdClass();\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated->expects($this->once())->method('provide')->with($operation, $context)->willReturn($data);\n        $this->serializer->expects($this->once())->method('deserialize')->with(['food' => 'fighters'], 'App\\Resource', 'json', ['object_to_populate' => $data])->willReturn($data);\n\n        $this->deserializableProvider->provide($operation, $context);\n    }\n\n    public function testItDeserializesDataWithDenormalizationContext(): void\n    {\n        $request = $this->createRequestMock();\n        $operation = $this->createOperationMock(denormalizationContext: ['groups' => ['dummy:write']]);\n        $data = new \\stdClass();\n        $context = new Context(new RequestOption($request));\n\n        $this->serializer->expects($this->once())->method('deserialize')->with(['food' => 'fighters'], 'App\\Resource', 'json', ['groups' => ['dummy:write']])->willReturn($data);\n\n        $this->deserializableProvider->provide($operation, $context);\n    }\n\n    public function testItDoesNothingIfOperationCannotBeDeserialized(): void\n    {\n        $request = $this->createRequestMock();\n        $operation = $this->createOperationMock(canDeserialize: false);\n        $context = new Context(new RequestOption($request));\n\n        $this->serializer->expects($this->never())->method('deserialize');\n\n        $this->deserializableProvider->provide($operation, $context);\n    }\n\n    public function testItDoesNothingIfOperationHasNoResource(): void\n    {\n        $request = $this->createRequestMock();\n        $operation = $this->createOperationMock(resource: null, canDeserialize: true);\n        $context = new Context(new RequestOption($request));\n        $data = new \\stdClass();\n\n        $this->decorated->method('provide')->with($operation, $context)->willReturn($data);\n        $this->serializer->expects($this->never())->method('deserialize');\n\n        $result = $this->deserializableProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItDoesNothingIfRequestFormatIsHtml(): void\n    {\n        $request = $this->createRequestMock(format: 'html');\n        $operation = $this->createOperationMock(canDeserialize: true);\n        $context = new Context(new RequestOption($request));\n\n        $this->serializer->expects($this->never())->method('deserialize');\n\n        $this->deserializableProvider->provide($operation, $context);\n    }\n\n    public function testItDoesNothingIfRequestMethodIsSafe(): void\n    {\n        $request = $this->createRequestMock(isMethodSafe: true);\n        $operation = $this->createOperationMock(canDeserialize: true);\n        $context = new Context(new RequestOption($request));\n\n        $this->serializer->expects($this->never())->method('deserialize');\n\n        $this->deserializableProvider->provide($operation, $context);\n    }\n\n    public function testItDoesNothingIfOperationIsADeleteOne(): void\n    {\n        $request = $this->createRequestMock();\n        $operation = (new Delete())->withResource(new ResourceMetadata(alias: 'app.dummy', class: 'App\\Resource'));\n        $context = new Context(new RequestOption($request));\n\n        $this->serializer->expects($this->never())->method('deserialize');\n\n        $this->deserializableProvider->provide($operation, $context);\n    }\n\n    public function testItThrowsAnExceptionWhenSerializerIsNotAvailable(): void\n    {\n        $request = $this->createRequestMock();\n        $operation = $this->createOperationMock(canDeserialize: true);\n        $context = new Context(new RequestOption($request));\n\n        $this->expectException(\\LogicException::class);\n        $this->expectExceptionMessage('You can not use the \"json\" format if the Serializer is not available. Try running \"composer require symfony/serializer\".');\n\n        $deserializableProvider = new DeserializeProvider($this->decorated, null);\n        $deserializableProvider->provide($operation, $context);\n    }\n\n    public function testItReturnsDataWhenOperationIsNotHttpOperation(): void\n    {\n        $operation = $this->createMock(\\Sylius\\Resource\\Metadata\\Operation::class);\n        $data = new \\stdClass();\n        $context = new Context();\n\n        $this->decorated->expects($this->once())->method('provide')->with($operation, $context)->willReturn($data);\n        $this->serializer->expects($this->never())->method('deserialize');\n\n        $result = $this->deserializableProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItReturnsDataWhenRequestIsNull(): void\n    {\n        $operation = $this->createMock(HttpOperation::class);\n        $data = new \\stdClass();\n        $context = new Context();\n\n        $this->decorated->expects($this->once())->method('provide')->with($operation, $context)->willReturn($data);\n        $this->serializer->expects($this->never())->method('deserialize');\n\n        $result = $this->deserializableProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Serializer/State/SerializeProcessorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Component\\Resource\\tests\\Symfony\\Serializer\\State;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\HttpOperation;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Sylius\\Resource\\Symfony\\Serializer\\State\\SerializeProcessor;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\Serializer\\SerializerInterface;\n\nfinal class SerializeProcessorTest extends TestCase\n{\n    private ProcessorInterface|MockObject $processor;\n\n    private SerializerInterface|MockObject $serializer;\n\n    private SerializeProcessor $serializeProcessor;\n\n    protected function setUp(): void\n    {\n        $this->processor = $this->createMock(ProcessorInterface::class);\n        $this->serializer = $this->createMock(SerializerInterface::class);\n\n        $this->serializeProcessor = new SerializeProcessor(\n            $this->processor,\n            $this->serializer,\n        );\n    }\n\n    private function createRequestMock(string $format = 'json'): Request\n    {\n        $request = $this->createMock(Request::class);\n        $request->method('getRequestFormat')->willReturn($format);\n\n        return $request;\n    }\n\n    private function createOperationMock(?bool $canSerialize = null, array $normalizationContext = []): HttpOperation\n    {\n        $operation = $this->createMock(HttpOperation::class);\n        $operation->method('canSerialize')->willReturn($canSerialize);\n        $operation->method('getNormalizationContext')->willReturn($normalizationContext);\n\n        return $operation;\n    }\n\n    public function testItSerializesDataToTheRequestedFormat(): void\n    {\n        $request = $this->createRequestMock();\n        $operation = $this->createOperationMock();\n        $data = new \\stdClass();\n        $context = new Context(new RequestOption($request));\n\n        $this->processor->expects($this->once())->method('process')->with('serialized_data', $operation, $context)->willReturn('serialized_data');\n        $this->serializer->expects($this->once())->method('serialize')->with($data, 'json', [])->willReturn('serialized_data');\n\n        $result = $this->serializeProcessor->process($data, $operation, $context);\n\n        $this->assertSame('serialized_data', $result);\n    }\n\n    public function testItSerializesDataToTheRequestedFormatWithNormalizationContext(): void\n    {\n        $request = $this->createRequestMock();\n        $operation = $this->createOperationMock(normalizationContext: ['groups' => ['dummy:read']]);\n        $data = new \\stdClass();\n        $context = new Context(new RequestOption($request));\n\n        $this->processor->expects($this->once())->method('process')->with('serialized_data', $operation, $context)->willReturn('serialized_data');\n        $this->serializer->expects($this->once())->method('serialize')->with($data, 'json', ['groups' => ['dummy:read']])->willReturn('serialized_data');\n\n        $result = $this->serializeProcessor->process($data, $operation, $context);\n\n        $this->assertSame('serialized_data', $result);\n    }\n\n    public function testItDoesNothingWhenFormatIsHtml(): void\n    {\n        $request = $this->createRequestMock('html');\n        $operation = $this->createOperationMock();\n        $data = new \\stdClass();\n        $context = new Context(new RequestOption($request));\n\n        $this->processor->expects($this->once())->method('process')->with($data, $operation, $context)->willReturn($data);\n        $this->serializer->expects($this->never())->method('serialize');\n\n        $result = $this->serializeProcessor->process($data, $operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItThrowsAnExceptionWhenSerializerIsNotAvailable(): void\n    {\n        $request = $this->createRequestMock();\n        $operation = $this->createOperationMock();\n        $data = new \\stdClass();\n        $context = new Context(new RequestOption($request));\n\n        $serializeProcessor = new SerializeProcessor($this->processor, null);\n        $this->processor->expects($this->never())->method('process');\n\n        $this->expectException(\\LogicException::class);\n        $this->expectExceptionMessage('You can not use the \"json\" format if the Serializer is not available. Try running \"composer require symfony/serializer\".');\n\n        $serializeProcessor->process($data, $operation, $context);\n    }\n\n    public function testItDoesNothingIfOperationCannotBeSerialized(): void\n    {\n        $request = $this->createRequestMock();\n        $operation = $this->createOperationMock(canSerialize: false);\n        $data = new \\stdClass();\n        $context = new Context(new RequestOption($request));\n\n        $this->processor->expects($this->once())->method('process')->with($data, $operation, $context)->willReturn($data);\n        $this->serializer->expects($this->never())->method('serialize');\n\n        $result = $this->serializeProcessor->process($data, $operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItProcessesDataWithoutSerializationWhenRequestIsNull(): void\n    {\n        $operation = $this->createOperationMock();\n        $data = new \\stdClass();\n        $context = new Context();\n\n        $this->processor->expects($this->once())->method('process')->with($data, $operation, $context)->willReturn($data);\n        $this->serializer->expects($this->never())->method('serialize');\n\n        $result = $this->serializeProcessor->process($data, $operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Session/Flash/FlashHelperTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Session\\Flash;\n\nuse PHPUnit\\Framework\\Attributes\\CoversClass;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\BulkDelete;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\GenericEvent;\nuse Sylius\\Resource\\Symfony\\Session\\Flash\\FlashHelper;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Session\\Session;\nuse Symfony\\Component\\Translation\\Loader\\ArrayLoader;\nuse Symfony\\Component\\Translation\\MessageCatalogueInterface;\nuse Symfony\\Component\\Translation\\Translator;\nuse Symfony\\Component\\Translation\\TranslatorBagInterface;\nuse Symfony\\Contracts\\Translation\\TranslatorInterface;\n\n#[CoversClass(FlashHelper::class)]\nfinal class FlashHelperTest extends TestCase\n{\n    public function testItAddsSuccessFlashesWithCustomMessage(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $operation = (new Create())->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'dummy', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper = new FlashHelper($this->createTranslator());\n        $flashHelper->addSuccessFlash($operation, $context, 'Custom message.');\n\n        $this->assertSame('Custom message.', $session->getFlashBag()->all()['success'][0]);\n    }\n\n    public function testItAddsSuccessFlashesWithSpecificMessage(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $translator = $this->createTranslator([\n            'app.dummy.create' => '%resource% was created successfully!!',\n            'sylius.resource.create' => '%resource% was created successfully.',\n        ]);\n\n        $flashHelper = new FlashHelper($translator);\n\n        $operation = (new Create())->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'dummy', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper->addSuccessFlash($operation, $context);\n\n        $this->assertSame('Dummy was created successfully!!', $session->getFlashBag()->all()['success'][0]);\n    }\n\n    public function testItAddsSuccessFlashesWithFallbackMessage(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $translator = $this->createTranslator([\n            'sylius.resource.create' => '%resource% was created successfully.',\n        ]);\n\n        $flashHelper = new FlashHelper($translator);\n\n        $operation = (new Create())->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'dummy', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper->addSuccessFlash($operation, $context);\n\n        $this->assertSame('Dummy was created successfully.', $session->getFlashBag()->all()['success'][0]);\n    }\n\n    public function testItAddsSuccessFlashesWithSpecificMessageForCustomOperationName(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $translator = $this->createTranslator([\n            'app.dummy.create_for_customer' => '%resource% has been added to this customer successfully.',\n        ]);\n\n        $flashHelper = new FlashHelper($translator);\n\n        $operation = (new Create(shortName: 'create_for_customer'))->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'dummy', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper->addSuccessFlash($operation, $context);\n\n        $this->assertSame('Dummy has been added to this customer successfully.', $session->getFlashBag()->all()['success'][0]);\n    }\n\n    public function testItAddsSuccessFlashesWithCustomMessageOnItsOperation(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $translator = $this->createTranslator([\n            'app.dummy.shipped' => '%resource% was shipped successfully.',\n        ]);\n\n        $flashHelper = new FlashHelper($translator);\n\n        $operation = (new Create(notificationMessage: 'app.dummy.shipped'))->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'dummy', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper->addSuccessFlash($operation, $context);\n\n        $this->assertSame('Dummy was shipped successfully.', $session->getFlashBag()->all()['success'][0]);\n    }\n\n    public function testItAddsSuccessFlashesWithCustomMessageOnItsOperationEvenIfThisIsNotInTheTranslationBag(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $translator = $this->createTranslator();\n\n        $flashHelper = new FlashHelper($translator);\n\n        $operation = (new Create(notificationMessage: 'Dummy was shipped successfully.'))->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'dummy', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper->addSuccessFlash($operation, $context);\n\n        $this->assertSame('Dummy was shipped successfully.', $session->getFlashBag()->all()['success'][0]);\n    }\n\n    public function testItAddsSuccessFlashesWithFirstDefaultMessageWhenTranslatorIsNotABag(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $operation = (new Create())->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'dummy', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $translator = $this->createMock(TranslatorInterface::class);\n        $flashHelper = new FlashHelper($translator);\n\n        $translator->expects($this->once())->method('trans')->with('app.dummy.create', ['%resource%' => 'Dummy'], 'flashes')->willReturn('Dummy was created successfully.');\n\n        $flashHelper->addSuccessFlash($operation, $context);\n\n        $this->assertSame('Dummy was created successfully.', $session->getFlashBag()->all()['success'][0]);\n    }\n\n    public function testItAddsSuccessFlashesWithHumanizedMessage(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $translator = $this->createTranslator([\n            'app.admin_user.create' => '%resource% was created successfully.',\n        ]);\n\n        $flashHelper = new FlashHelper($translator);\n\n        $operation = (new Create())->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'admin_user', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper->addSuccessFlash($operation, $context);\n\n        $this->assertSame('Admin user was created successfully.', $session->getFlashBag()->all()['success'][0]);\n    }\n\n    public function testItAddsSuccessFlashesWithTranslatedResourceInTheMessage(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $translator = $this->createTranslator([\n            'sylius.resource.create' => '%resource% was created successfully.',\n        ], [\n            'app.ui.promotion' => 'Cart promotion',\n        ]);\n\n        $flashHelper = new FlashHelper($translator);\n\n        $operation = (new Create())->withResource(new ResourceMetadata(alias: 'app.promotion', name: 'promotion', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper->addSuccessFlash($operation, $context);\n\n        $this->assertSame('Cart promotion was created successfully.', $session->getFlashBag()->all()['success'][0]);\n    }\n\n    public function testItAddsSuccessFlashesWithHumanizedMessageAndPluralNameOnBulkOperation(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $translator = $this->createTranslator([\n            'app.admin_user.bulk_delete' => '%resources% was removed successfully.',\n        ]);\n\n        $flashHelper = new FlashHelper($translator);\n\n        $operation = (new BulkDelete())->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'admin_user', pluralName: 'admin_users', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper->addSuccessFlash($operation, $context);\n\n        $this->assertSame('Admin users was removed successfully.', $session->getFlashBag()->all()['success'][0]);\n    }\n\n    public function testItAddsSuccessFlashesWithTranslatedResourceWithPluralNameInTheMessageOnBulkOperation(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $translator = $this->createTranslator([\n            'app.promotion.bulk_delete' => '%resources% was removed successfully.',\n        ], [\n            'app.ui.promotions' => 'Cart promotions',\n        ]);\n\n        $flashHelper = new FlashHelper($translator);\n\n        $operation = (new BulkDelete())->withResource(new ResourceMetadata(alias: 'app.promotion', name: 'promotion', pluralName: 'promotions', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper->addSuccessFlash($operation, $context);\n\n        $this->assertSame('Cart promotions was removed successfully.', $session->getFlashBag()->all()['success'][0]);\n    }\n\n    public function testItAddsErrorFlashesWithCustomMessage(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $operation = (new Create())->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'dummy', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper = new FlashHelper($this->createTranslator());\n\n        $flashHelper->addErrorFlash($operation, $context, 'Custom error message.');\n\n        $this->assertSame('Custom error message.', $session->getFlashBag()->all()['error'][0]);\n    }\n\n    public function testItAddsErrorFlashesWithSpecificMessage(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $translator = $this->createTranslator([\n            'app.dummy.create_error' => 'Cannot create %resource% resource!!',\n            'sylius.resource.create_error' => 'Cannot create %resource% resource.',\n        ]);\n\n        $flashHelper = new FlashHelper($translator);\n\n        $operation = (new Create())->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'dummy', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper->addErrorFlash($operation, $context);\n\n        $this->assertSame('Cannot create Dummy resource!!', $session->getFlashBag()->all()['error'][0]);\n    }\n\n    public function testItAddsErrorFlashesWithFallbackMessage(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $translator = $this->createTranslator([\n            'sylius.resource.create_error' => 'Cannot create %resource% resource.',\n        ]);\n\n        $flashHelper = new FlashHelper($translator);\n\n        $operation = (new Create())->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'dummy', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper->addErrorFlash($operation, $context);\n\n        $this->assertSame('Cannot create Dummy resource.', $session->getFlashBag()->all()['error'][0]);\n    }\n\n    public function testItAddsErrorFlashesWithSpecificMessageForCustomOperationName(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $translator = $this->createTranslator([\n            'app.dummy.create_for_customer_error' => 'Cannot create %resource% resource for this customer.',\n        ]);\n\n        $flashHelper = new FlashHelper($translator);\n\n        $operation = (new Create(shortName: 'create_for_customer'))->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'dummy', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper->addErrorFlash($operation, $context);\n\n        $this->assertSame('Cannot create Dummy resource for this customer.', $session->getFlashBag()->all()['error'][0]);\n    }\n\n    public function testItAddsErrorFlashesWithFallbackMessageForCustomOperationName(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $translator = $this->createTranslator([\n            'sylius.resource.create_error' => 'Cannot create %resource% resource.',\n        ]);\n\n        $flashHelper = new FlashHelper($translator);\n\n        $operation = (new Create(shortName: 'create_for_customer'))->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'dummy', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper->addErrorFlash($operation, $context);\n\n        $this->assertSame('Cannot create Dummy resource.', $session->getFlashBag()->all()['error'][0]);\n    }\n\n    public function testItAddsErrorFlashesWithAFallbackToDeleteTranslationKeyForABulkDelete(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $translator = $this->createTranslator([\n            'sylius.resource.delete_error' => 'Cannot delete %resource% resource.',\n        ]);\n\n        $flashHelper = new FlashHelper($translator);\n\n        $operation = (new BulkDelete())->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'dummy', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper->addErrorFlash($operation, $context);\n\n        $this->assertSame('Cannot delete Dummy resource.', $session->getFlashBag()->all()['error'][0]);\n    }\n\n    public function testItAddsErrorFlashesWithAFallbackToDeleteTranslationKeyForABulkDeleteWithACustomOperationName(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $translator = $this->createTranslator([\n            'sylius.resource.delete_error' => 'Cannot delete %resource% resource.',\n        ]);\n\n        $flashHelper = new FlashHelper($translator);\n\n        $operation = (new BulkDelete(shortName: 'bulk_delete_for_taxon'))->withResource(new ResourceMetadata(alias: 'app.dummy', name: 'dummy', applicationName: 'app'));\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper->addErrorFlash($operation, $context);\n\n        $this->assertSame('Cannot delete Dummy resource.', $session->getFlashBag()->all()['error'][0]);\n    }\n\n    public function testItTranslatesFlashesFromEventWhenTranslatorIsNotABag(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $event = new GenericEvent();\n        $event->setMessage('app.admin_user.banned');\n        $event->setMessageType('success');\n        $event->setMessageParameters(['%admin_user%' => 'Darth Vader']);\n\n        $context = new Context(new RequestOption($request));\n\n        $translator = $this->createMock(TranslatorInterface::class);\n        $flashHelper = new FlashHelper($translator);\n\n        $translator->expects($this->once())->method('trans')->with('app.admin_user.banned', ['%admin_user%' => 'Darth Vader'], 'flashes')->willReturn('Darth Vader was banned successfully.');\n\n        $flashHelper->addFlashFromEvent($event, $context);\n\n        $this->assertSame('Darth Vader was banned successfully.', $session->getFlashBag()->all()['success'][0]);\n    }\n\n    public function testItTranslatesFlashesFromEventWhenTranslatorIsABag(): void\n    {\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $event = new GenericEvent();\n        $event->setMessage('app.admin_user.banned');\n        $event->setMessageType('success');\n        $event->setMessageParameters(['%admin_user%' => 'Darth Vader']);\n\n        $translator = $this->createTranslator([\n            'app.admin_user.banned' => '%admin_user% was banned successfully.',\n        ]);\n\n        $flashHelper = new FlashHelper($translator);\n        $context = new Context(new RequestOption($request));\n\n        $flashHelper->addFlashFromEvent($event, $context);\n\n        $this->assertSame('Darth Vader was banned successfully.', $session->getFlashBag()->all()['success'][0]);\n    }\n\n    public function testItDoesNotTranslateEventMessageWhenTranslatorIsABagAndDoesNotContainsTheKey(): void\n    {\n        $translator = $this->createMockForIntersectionOfInterfaces([TranslatorInterface::class, TranslatorBagInterface::class]);\n        $messageCatalogue = $this->createMock(MessageCatalogueInterface::class);\n\n        $session = new Session();\n        $request = new Request();\n        $request->setSession($session);\n\n        $flashHelper = new FlashHelper($translator);\n\n        $event = new GenericEvent();\n        $event->setMessage('Darth Vader was banned successfully.');\n        $event->setMessageType('success');\n\n        $context = new Context(new RequestOption($request));\n\n        $translator->method('getCatalogue')->willReturn($messageCatalogue);\n        $messageCatalogue->expects($this->once())->method('has')->with('Darth Vader was banned successfully.', 'flashes')->willReturn(false);\n\n        $translator->expects($this->never())->method('trans');\n\n        $flashHelper->addFlashFromEvent($event, $context);\n\n        $this->assertSame('Darth Vader was banned successfully.', $session->getFlashBag()->all()['success'][0]);\n    }\n\n    /**\n     * @param array<string, string> $flashesTranslations\n     * @param array<string, string> $messagesTranslations\n     */\n    private function createTranslator(array $flashesTranslations = [], array $messagesTranslations = []): TranslatorInterface&TranslatorBagInterface\n    {\n        $translator = new Translator('en');\n        $translator->addLoader('array', new ArrayLoader());\n\n        foreach ($flashesTranslations as $key => $translation) {\n            $translator->addResource('array', [\n                $key => $translation,\n            ], 'en', 'flashes');\n        }\n\n        foreach ($messagesTranslations as $key => $translation) {\n            $translator->addResource('array', [\n                $key => $translation,\n            ], 'en', 'messages');\n        }\n\n        return $translator;\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Validator/EventListener/ValidationExceptionListenerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Validator\\EventListener;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Symfony\\Validator\\EventListener\\ValidationExceptionListener;\nuse Sylius\\Resource\\Symfony\\Validator\\Exception\\ValidationException;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent;\nuse Symfony\\Component\\HttpKernel\\HttpKernelInterface;\nuse Symfony\\Component\\HttpKernel\\KernelInterface;\nuse Symfony\\Component\\Serializer\\SerializerInterface;\nuse Symfony\\Component\\Validator\\ConstraintViolationList;\n\nfinal class ValidationExceptionListenerTest extends TestCase\n{\n    private SerializerInterface $serializer;\n\n    private ValidationExceptionListener $validationExceptionListener;\n\n    protected function setUp(): void\n    {\n        $this->serializer = $this->createMock(SerializerInterface::class);\n        $this->validationExceptionListener = new ValidationExceptionListener($this->serializer);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(ValidationExceptionListener::class, $this->validationExceptionListener);\n    }\n\n    public function testItTransformsValidationExceptionToAResponse(): void\n    {\n        $violationList = new ConstraintViolationList();\n        $exception = new ValidationException($violationList);\n\n        $kernel = $this->createMock(KernelInterface::class);\n        $request = $this->createMock(Request::class);\n\n        $event = new ExceptionEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST, $exception);\n\n        $request->method('getRequestFormat')->willReturn('json');\n        $request->method('getMimeType')->with('json')->willReturn('application/json');\n\n        $this->serializer\n            ->expects($this->once())\n            ->method('serialize')\n            ->with($violationList, 'json')\n            ->willReturn('serialized_exception');\n\n        $this->validationExceptionListener->onKernelException($event);\n\n        $response = $event->getResponse();\n\n        $this->assertInstanceOf(Response::class, $response);\n        $this->assertSame('serialized_exception', $response->getContent());\n        $this->assertSame(422, $response->getStatusCode());\n        $this->assertSame('application/json; charset=utf-8', $response->headers->get('Content-Type'));\n        $this->assertSame('nosniff', $response->headers->get('X-Content-Type-Options'));\n        $this->assertSame('deny', $response->headers->get('X-Frame-Options'));\n    }\n\n    public function testItDoesNothingOnOtherExceptions(): void\n    {\n        $exception = new \\Exception('Some error');\n\n        $kernel = $this->createMock(KernelInterface::class);\n        $request = $this->createMock(Request::class);\n\n        $event = new ExceptionEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST, $exception);\n\n        $this->serializer->expects($this->never())->method('serialize');\n\n        $this->validationExceptionListener->onKernelException($event);\n\n        $this->assertNull($event->getResponse());\n    }\n\n    public function testItThrowsAnExceptionWhenSerializerIsNotAvailable(): void\n    {\n        $validationExceptionListener = new ValidationExceptionListener(null);\n\n        $violationList = new ConstraintViolationList();\n        $exception = new ValidationException($violationList);\n\n        $kernel = $this->createMock(KernelInterface::class);\n        $request = $this->createMock(Request::class);\n\n        $event = new ExceptionEvent($kernel, $request, HttpKernelInterface::MAIN_REQUEST, $exception);\n\n        $this->expectException(\\LogicException::class);\n        $this->expectExceptionMessage('The Symfony Serializer is not available. Try running \"composer require symfony/serializer\".');\n\n        $validationExceptionListener->onKernelException($event);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Validator/Exception/ValidationExceptionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Validator\\Exception;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Symfony\\Validator\\Exception\\ValidationException;\nuse Symfony\\Component\\Validator\\ConstraintViolationInterface;\nuse Symfony\\Component\\Validator\\ConstraintViolationList;\n\nfinal class ValidationExceptionTest extends TestCase\n{\n    public function testItTransformsExceptionIntoAString(): void\n    {\n        $firstViolation = $this->createMock(ConstraintViolationInterface::class);\n        $secondViolation = $this->createMock(ConstraintViolationInterface::class);\n\n        $firstViolation->method('getPropertyPath')->willReturn('name');\n        $firstViolation->method('getMessage')->willReturn('This value should not be blank.');\n\n        $secondViolation->method('getPropertyPath')->willReturn('email');\n        $secondViolation->method('getMessage')->willReturn('This value should not be blank.');\n\n        $exception = new ValidationException(new ConstraintViolationList([\n            $firstViolation,\n            $secondViolation,\n        ]));\n\n        $this->assertSame(\"name: This value should not be blank.\\nemail: This value should not be blank.\", (string) $exception);\n    }\n\n    public function testItCanBeConstructedWithAMessage(): void\n    {\n        $exception = new ValidationException(new ConstraintViolationList([]), 'You should not pass!');\n\n        $this->assertSame('You should not pass!', $exception->getMessage());\n    }\n\n    public function testItCanBeConstructedWithACode(): void\n    {\n        $exception = new ValidationException(new ConstraintViolationList([]), '', 42);\n\n        $this->assertSame(42, $exception->getCode());\n    }\n\n    public function testItCanBeConstructedWithAPreviousException(): void\n    {\n        $previous = new \\Exception();\n\n        $exception = new ValidationException(new ConstraintViolationList([]), '', 0, $previous);\n\n        $this->assertSame($previous, $exception->getPrevious());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Validator/State/ValidateProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Validator\\State;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Update;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Sylius\\Resource\\Symfony\\Validator\\Exception\\ValidationException;\nuse Sylius\\Resource\\Symfony\\Validator\\State\\ValidateProvider;\nuse Symfony\\Component\\Form\\FormInterface;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Validator\\ConstraintViolation;\nuse Symfony\\Component\\Validator\\ConstraintViolationList;\nuse Symfony\\Component\\Validator\\Validator\\ValidatorInterface;\n\nfinal class ValidateProviderTest extends TestCase\n{\n    private ProviderInterface $decorated;\n\n    private ValidatorInterface $validator;\n\n    private ValidateProvider $validateProvider;\n\n    protected function setUp(): void\n    {\n        $this->decorated = $this->createMock(ProviderInterface::class);\n        $this->validator = $this->createMock(ValidatorInterface::class);\n        $this->validateProvider = new ValidateProvider($this->decorated, $this->validator);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(ValidateProvider::class, $this->validateProvider);\n    }\n\n    public function testItReturnsDataWhenResponseIsReturned(): void\n    {\n        $operation = new Create();\n        $context = new Context();\n        $response = new Response();\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($response);\n\n        $this->validator->expects($this->never())->method('validate');\n\n        $result = $this->validateProvider->provide($operation, $context);\n\n        $this->assertSame($response, $result);\n    }\n\n    public function testItReturnsDataWhenOperationIsNotCreateOrUpdate(): void\n    {\n        $operation = new Index();\n        $context = new Context();\n        $data = new \\stdClass();\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->validator->expects($this->never())->method('validate');\n\n        $result = $this->validateProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItReturnsDataWhenValidationIsDisabled(): void\n    {\n        $operation = new Create(validate: false);\n        $context = new Context();\n        $data = new \\stdClass();\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->validator->expects($this->never())->method('validate');\n\n        $result = $this->validateProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItValidatesDataForNonHtmlFormatWithoutViolations(): void\n    {\n        $operation = new Create();\n        $data = new \\stdClass();\n        $request = new Request();\n        $request->setRequestFormat('json');\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->validator\n            ->expects($this->once())\n            ->method('validate')\n            ->with($data, null, null)\n            ->willReturn(new ConstraintViolationList());\n\n        $result = $this->validateProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItThrowsValidationExceptionForNonHtmlFormatWithViolations(): void\n    {\n        $operation = new Create();\n        $data = new \\stdClass();\n        $request = new Request();\n        $request->setRequestFormat('json');\n\n        $context = new Context(new RequestOption($request));\n\n        $violation = new ConstraintViolation(\n            'This value should not be blank.',\n            null,\n            [],\n            $data,\n            'name',\n            null,\n        );\n        $violations = new ConstraintViolationList([$violation]);\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->validator\n            ->expects($this->once())\n            ->method('validate')\n            ->with($data, null, null)\n            ->willReturn($violations);\n\n        $this->expectException(ValidationException::class);\n\n        $this->validateProvider->provide($operation, $context);\n    }\n\n    public function testItValidatesDataWithValidationGroups(): void\n    {\n        $operation = new Create(validationContext: ['groups' => ['Default', 'create']]);\n        $data = new \\stdClass();\n        $request = new Request();\n        $request->setRequestFormat('json');\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->validator\n            ->expects($this->once())\n            ->method('validate')\n            ->with($data, null, ['Default', 'create'])\n            ->willReturn(new ConstraintViolationList());\n\n        $result = $this->validateProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItReturnsDataWhenNoFormExistsForHtmlFormat(): void\n    {\n        $operation = new Create();\n        $data = new \\stdClass();\n        $request = new Request();\n        $request->setRequestFormat('html');\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->validator->expects($this->never())->method('validate');\n\n        $result = $this->validateProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItValidatesDataWhenNoRequestExists(): void\n    {\n        $operation = new Create();\n        $context = new Context();\n        $data = new \\stdClass();\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->validator\n            ->expects($this->once())\n            ->method('validate')\n            ->with($data, null, null)\n            ->willReturn(new ConstraintViolationList());\n\n        $result = $this->validateProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItHandlesValidFormForHtmlFormat(): void\n    {\n        $operation = new Create();\n        $formData = new \\stdClass();\n        $request = Request::create('/test', 'POST');\n        $request->setRequestFormat('html');\n\n        $form = $this->createMock(FormInterface::class);\n        $form->expects($this->once())->method('isSubmitted')->willReturn(true);\n        $form->expects($this->once())->method('isValid')->willReturn(true);\n        $form->expects($this->once())->method('getData')->willReturn($formData);\n\n        $request->attributes->set('form', $form);\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn(new \\stdClass());\n\n        $this->validator->expects($this->never())->method('validate');\n\n        $result = $this->validateProvider->provide($operation, $context);\n\n        $this->assertSame($formData, $result);\n        $this->assertTrue($request->attributes->get('is_valid'));\n    }\n\n    public function testItHandlesInvalidFormForHtmlFormat(): void\n    {\n        $operation = new Create();\n        $data = new \\stdClass();\n        $request = Request::create('/test', 'POST');\n        $request->setRequestFormat('html');\n\n        $form = $this->createMock(FormInterface::class);\n        $form->expects($this->once())->method('isSubmitted')->willReturn(true);\n        $form->expects($this->once())->method('isValid')->willReturn(false);\n        $form->expects($this->never())->method('getData');\n\n        $request->attributes->set('form', $form);\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->validator->expects($this->never())->method('validate');\n\n        $result = $this->validateProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n        $this->assertFalse($request->attributes->get('is_valid'));\n    }\n\n    public function testItHandlesSafeMethodForHtmlFormat(): void\n    {\n        $operation = new Create();\n        $data = new \\stdClass();\n        $request = Request::create('/test', 'GET');\n        $request->setRequestFormat('html');\n\n        $form = $this->createMock(FormInterface::class);\n        $form->expects($this->never())->method('isSubmitted');\n        $form->expects($this->never())->method('isValid');\n        $form->expects($this->never())->method('getData');\n\n        $request->attributes->set('form', $form);\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->validator->expects($this->never())->method('validate');\n\n        $result = $this->validateProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n        $this->assertFalse($request->attributes->get('is_valid'));\n    }\n\n    public function testItValidatesUpdateOperation(): void\n    {\n        $operation = new Update();\n        $data = new \\stdClass();\n        $request = new Request();\n        $request->setRequestFormat('json');\n\n        $context = new Context(new RequestOption($request));\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('provide')\n            ->with($operation, $context)\n            ->willReturn($data);\n\n        $this->validator\n            ->expects($this->once())\n            ->method('validate')\n            ->with($data, null, null)\n            ->willReturn(new ConstraintViolationList());\n\n        $result = $this->validateProvider->provide($operation, $context);\n\n        $this->assertSame($data, $result);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Symfony/Workflow/OperationStateMachineTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Symfony\\Workflow;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\StateMachineAwareOperationInterface;\nuse Sylius\\Resource\\Symfony\\Workflow\\OperationStateMachine;\nuse Symfony\\Component\\Workflow\\Marking;\nuse Symfony\\Component\\Workflow\\Registry;\nuse Symfony\\Component\\Workflow\\Workflow;\n\nfinal class OperationStateMachineTest extends TestCase\n{\n    private Registry $registry;\n\n    private OperationStateMachine $operationStateMachine;\n\n    protected function setUp(): void\n    {\n        $this->markAsSkippedIfSymfonyWorkflowIsNotAvailable();\n\n        $this->registry = $this->createMock(Registry::class);\n        $this->operationStateMachine = new OperationStateMachine($this->registry);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(OperationStateMachine::class, $this->operationStateMachine);\n    }\n\n    public function testItReturnsIfTransitionIsPossible(): void\n    {\n        $data = new \\stdClass();\n        $operation = new Create(stateMachineTransition: 'publish');\n        $workflow = $this->createMock(Workflow::class);\n\n        $this->registry->method('get')->with($data, null)->willReturn($workflow);\n        $workflow->method('can')->with($data, 'publish')->willReturn(true);\n\n        $result = $this->operationStateMachine->can($data, $operation, new Context());\n\n        $this->assertTrue($result);\n    }\n\n    public function testItAppliesTransition(): void\n    {\n        $data = new \\stdClass();\n        $operation = new Create(stateMachineTransition: 'publish');\n        $workflow = $this->createMock(Workflow::class);\n        $marking = $this->createMock(Marking::class);\n\n        $this->registry->method('get')->with($data, null)->willReturn($workflow);\n        $workflow->expects($this->once())->method('apply')->with($data, 'publish')->willReturn($marking);\n\n        $this->operationStateMachine->apply($data, $operation, new Context());\n    }\n\n    public function testItThrowsAnExceptionWhenOperationHasNoDefinedTransition(): void\n    {\n        $data = new \\stdClass();\n        $operation = new Create(name: 'app_dummy_create');\n        $workflow = $this->createMock(Workflow::class);\n\n        $this->registry->method('get')->with($data, null)->willReturn($workflow);\n\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage('No State machine transition was found on operation \"app_dummy_create\".');\n\n        $this->operationStateMachine->can($data, $operation, new Context());\n    }\n\n    public function testItThrowsAnExceptionWhenSymfonyWorkflowIsNotAvailable(): void\n    {\n        $operationStateMachine = new OperationStateMachine(null);\n\n        $data = new \\stdClass();\n        $operation = new Create(stateMachineTransition: 'publish');\n\n        $this->expectException(\\LogicException::class);\n        $this->expectExceptionMessage('You can not use the \"state-machine\" if Symfony workflow is not available. Try running \"composer require symfony/workflow\".');\n\n        $operationStateMachine->can($data, $operation, new Context());\n    }\n\n    public function testItThrowsAnExceptionWhenOperationDoesNotImplementAStateMachine(): void\n    {\n        $data = new \\stdClass();\n        $operation = new Index();\n\n        $this->expectException(\\LogicException::class);\n        $this->expectExceptionMessage(sprintf('Expected an instance of %s. Got: %s', StateMachineAwareOperationInterface::class, Index::class));\n\n        $this->operationStateMachine->can($data, $operation, new Context());\n    }\n\n    private function markAsSkippedIfSymfonyWorkflowIsNotAvailable(): void\n    {\n        if (!class_exists(Registry::class)) {\n            $this->markTestSkipped('Symfony Workflow is not available.');\n        }\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Translation/Provider/ImmutableTranslationLocaleProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Translation\\Provider;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Translation\\Provider\\ImmutableTranslationLocaleProvider;\nuse Sylius\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface;\n\nfinal class ImmutableTranslationLocaleProviderTest extends TestCase\n{\n    private ImmutableTranslationLocaleProvider $localeProvider;\n\n    protected function setUp(): void\n    {\n        $this->localeProvider = new ImmutableTranslationLocaleProvider(['pl_PL', 'en_US'], 'pl_PL');\n    }\n\n    public function testItImplementsTranslationLocaleProviderInterface(): void\n    {\n        $this->assertInstanceOf(TranslationLocaleProviderInterface::class, $this->localeProvider);\n    }\n\n    public function testItReturnsDefinedLocalesCodes(): void\n    {\n        $this->assertSame(['pl_PL', 'en_US'], $this->localeProvider->getDefinedLocalesCodes());\n    }\n\n    public function testItReturnsTheDefaultLocaleCode(): void\n    {\n        $this->assertSame('pl_PL', $this->localeProvider->getDefaultLocaleCode());\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Translation/TranslatableEntityLocaleAssignerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Translation;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Model\\TranslatableInterface;\nuse Sylius\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface;\nuse Sylius\\Resource\\Translation\\TranslatableEntityLocaleAssigner;\nuse Sylius\\Resource\\Translation\\TranslatableEntityLocaleAssignerInterface;\n\nfinal class TranslatableEntityLocaleAssignerTest extends TestCase\n{\n    private TranslationLocaleProviderInterface $translationLocaleProvider;\n\n    private TranslatableEntityLocaleAssigner $localeAssigner;\n\n    protected function setUp(): void\n    {\n        $this->translationLocaleProvider = $this->createMock(TranslationLocaleProviderInterface::class);\n        $this->localeAssigner = new TranslatableEntityLocaleAssigner($this->translationLocaleProvider);\n    }\n\n    public function testItImplementsTranslatableEntityLocaleAssignerInterface(): void\n    {\n        $this->assertInstanceOf(TranslatableEntityLocaleAssignerInterface::class, $this->localeAssigner);\n    }\n\n    public function testItAssignsCurrentAndDefaultLocaleToGivenTranslatableEntity(): void\n    {\n        $translatableEntity = $this->createMock(TranslatableInterface::class);\n\n        $this->translationLocaleProvider\n            ->method('getDefaultLocaleCode')\n            ->willReturn('en_US');\n\n        $translatableEntity->expects($this->once())\n            ->method('setCurrentLocale')\n            ->with('en_US');\n\n        $translatableEntity->expects($this->once())\n            ->method('setFallbackLocale')\n            ->with('en_US');\n\n        $this->localeAssigner->assignLocale($translatableEntity);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Twig/Context/Factory/ContextFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Twig\\Context\\Factory;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Psr\\Container\\ContainerInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Twig\\Context\\Factory\\ContextFactory;\nuse Sylius\\Resource\\Twig\\Context\\Factory\\ContextFactoryInterface;\n\nfinal class ContextFactoryTest extends TestCase\n{\n    private ContextFactory $contextFactory;\n\n    private ContainerInterface|MockObject $locator;\n\n    protected function setUp(): void\n    {\n        $this->locator = $this->createMock(ContainerInterface::class);\n        $this->contextFactory = new ContextFactory($this->locator);\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(ContextFactory::class, $this->contextFactory);\n    }\n\n    public function testItCreatesTwigContextFromOperationTwigContextFactoryAsCallable(): void\n    {\n        $data = new \\stdClass();\n        $twigContextFactory = [TwigContextFactoryCallable::class, 'create'];\n        $operation = new Show(twigContextFactory: $twigContextFactory);\n        $context = new Context();\n\n        $result = $this->contextFactory->create($data, $operation, $context);\n\n        $this->assertSame(['foo' => 'bar'], $result);\n    }\n\n    public function testItCreatesTwigContextFromOperationTwigContextFactoryAsString(): void\n    {\n        $data = new \\stdClass();\n        $twigContextFactory = $this->createMock(ContextFactoryInterface::class);\n        $operation = new Show(twigContextFactory: $twigContextFactory::class);\n        $context = new Context();\n\n        $this->locator->method('has')->with($twigContextFactory::class)->willReturn(true);\n        $this->locator->method('get')->with($twigContextFactory::class)->willReturn($twigContextFactory);\n\n        $twigContextFactory->method('create')->with($data, $operation, $context)->willReturn(['foo' => 'bar']);\n\n        $result = $this->contextFactory->create($data, $operation, $context);\n\n        $this->assertSame(['foo' => 'bar'], $result);\n    }\n\n    public function testItThrowsExceptionWhenTwigContextFactoryNotFoundOnLocator(): void\n    {\n        $this->expectException(\\RuntimeException::class);\n        $this->expectExceptionMessage(sprintf('Twig context factory \"%s\" not found on operation \"app_dummy_show\"', ContextFactoryInterface::class));\n\n        $data = new \\stdClass();\n        $operation = new Show(name: 'app_dummy_show', twigContextFactory: ContextFactoryInterface::class);\n        $context = new Context();\n\n        $this->locator->method('has')->with(ContextFactoryInterface::class)->willReturn(false);\n\n        $this->contextFactory->create($data, $operation, $context);\n    }\n}\n\nfinal class TwigContextFactoryCallable\n{\n    public static function create(mixed $data, Operation $operation, Context $context): array\n    {\n        return ['foo' => 'bar'];\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Twig/Context/Factory/DefaultContextFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Twig\\Context\\Factory;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Twig\\Context\\Factory\\DefaultContextFactory;\n\nfinal class DefaultContextFactoryTest extends TestCase\n{\n    private DefaultContextFactory $defaultContextFactory;\n\n    protected function setUp(): void\n    {\n        $this->defaultContextFactory = new DefaultContextFactory();\n    }\n\n    public function testItIsInitializable(): void\n    {\n        $this->assertInstanceOf(DefaultContextFactory::class, $this->defaultContextFactory);\n    }\n\n    public function testItCreatesTwigContextForResource(): void\n    {\n        $data = new \\stdClass();\n        $resourceMetadata = new ResourceMetadata(alias: 'app.dummy', name: 'dummy');\n        $operation = (new Show())->withResource($resourceMetadata);\n        $context = new Context();\n\n        $result = $this->defaultContextFactory->create($data, $operation, $context);\n\n        $this->assertSame([\n            'operation' => $operation,\n            'resource_metadata' => $resourceMetadata,\n            'resource' => $data,\n            'dummy' => $data,\n        ], $result);\n    }\n\n    public function testItCreatesTwigContextForResourceCollection(): void\n    {\n        $data = new \\stdClass();\n        $resourceMetadata = new ResourceMetadata(alias: 'app.dummy', pluralName: 'dummies');\n        $operation = (new Index())->withResource($resourceMetadata);\n        $context = new Context();\n\n        $result = $this->defaultContextFactory->create($data, $operation, $context);\n\n        $this->assertSame([\n            'operation' => $operation,\n            'resource_metadata' => $resourceMetadata,\n            'resources' => $data,\n            'dummies' => $data,\n        ], $result);\n    }\n}\n"
  },
  {
    "path": "src/Component/tests/Winzou/StateMachine/OperationStateMachineTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Resource\\Tests\\Winzou\\StateMachine;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse SM\\Factory\\Factory;\nuse SM\\StateMachine\\StateMachineInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\StateMachineAwareOperationInterface;\nuse Sylius\\Resource\\Winzou\\StateMachine\\OperationStateMachine;\nuse winzou\\Bundle\\StateMachineBundle\\winzouStateMachineBundle;\n\nfinal class OperationStateMachineTest extends TestCase\n{\n    private OperationStateMachine $operationStateMachine;\n\n    private Factory|MockObject $factory;\n\n    protected function setUp(): void\n    {\n        $this->markAsSkippedIfWinzouStateMachineIsNotAvailable();\n\n        $this->factory = $this->createMock(Factory::class);\n        $this->operationStateMachine = new OperationStateMachine($this->factory);\n    }\n\n    public function testItReturnsIfTransitionIsPossible(): void\n    {\n        $data = new \\stdClass();\n        $operation = new Create(stateMachineTransition: 'publish');\n        $stateMachine = $this->createMock(StateMachineInterface::class);\n\n        $this->factory->method('get')->with($data, 'default')->willReturn($stateMachine);\n        $stateMachine->method('can')->with('publish')->willReturn(true);\n\n        $result = $this->operationStateMachine->can($data, $operation, new Context());\n\n        $this->assertTrue($result);\n    }\n\n    public function testItAppliesTransition(): void\n    {\n        $data = new \\stdClass();\n        $operation = new Create(stateMachineTransition: 'publish');\n        $stateMachine = $this->createMock(StateMachineInterface::class);\n\n        $this->factory->method('get')->with($data, 'default')->willReturn($stateMachine);\n        $stateMachine->method('apply')->with('publish')->willReturn(true);\n\n        $this->operationStateMachine->apply($data, $operation, new Context());\n\n        $this->assertTrue(true);\n    }\n\n    public function testItThrowsAnExceptionWhenOperationHasNoDefinedTransition(): void\n    {\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage('No State machine transition was found on operation \"app_dummy_create\".');\n\n        $data = new \\stdClass();\n        $operation = new Create(name: 'app_dummy_create');\n        $stateMachine = $this->createMock(StateMachineInterface::class);\n\n        $this->factory->method('get')->with($data, 'default')->willReturn($stateMachine);\n\n        $this->operationStateMachine->can($data, $operation, new Context());\n    }\n\n    public function testItThrowsAnExceptionWhenWinzouStateMachineIsNotAvailable(): void\n    {\n        $this->expectException(\\LogicException::class);\n        $this->expectExceptionMessage('You can not use the \"state-machine\" if Winzou State Machine is not available. Try running \"composer require winzou/state-machine-bundle\".');\n\n        $operationStateMachine = new OperationStateMachine(null);\n        $data = new \\stdClass();\n        $operation = new Create(stateMachineTransition: 'publish');\n\n        $operationStateMachine->can($data, $operation, new Context());\n    }\n\n    public function testItThrowsAnExceptionWhenOperationDoesNotImplementAStateMachine(): void\n    {\n        $this->expectException(\\LogicException::class);\n        $this->expectExceptionMessage(sprintf('Expected an instance of %s. Got: %s', StateMachineAwareOperationInterface::class, Index::class));\n\n        $data = new \\stdClass();\n        $operation = new Index();\n\n        $this->operationStateMachine->can($data, $operation, new Context());\n    }\n\n    private function markAsSkippedIfWinzouStateMachineIsNotAvailable(): void\n    {\n        if (!class_exists(winzouStateMachineBundle::class)) {\n            $this->markTestSkipped('Winzou State machine is not available.');\n        }\n    }\n}\n"
  },
  {
    "path": "tests/ApiTestCase.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Tests;\n\nuse Coduo\\PHPMatcher\\PHPUnit\\PHPMatcherAssertions;\nuse PHPUnit\\Framework\\Attributes\\Before;\nuse Symfony\\Bundle\\FrameworkBundle\\KernelBrowser;\nuse Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase;\n\nabstract class ApiTestCase extends WebTestCase\n{\n    use PHPMatcherAssertions;\n\n    protected KernelBrowser $client;\n\n    #[Before]\n    protected function _createClient(): void\n    {\n        $this->client = self::createClient();\n    }\n\n    protected function assertResponseMatchesPattern(string $pattern): void\n    {\n        $response = $this->client->getResponse();\n        $content = $response->getContent();\n\n        self::assertMatchesPattern($pattern, $content);\n    }\n}\n"
  },
  {
    "path": "tests/Application/.gitignore",
    "content": "###> symfony/framework-bundle ###\n/.env.*.local\n/.env.local\n/.env.local.php\n/public/bundles\n/var/\n/vendor/\n###< symfony/framework-bundle ###\n\nconfig/db.sql\n"
  },
  {
    "path": "tests/Application/bin/console",
    "content": "#!/usr/bin/env php\n<?php\n\nuse App\\Kernel;\nuse Symfony\\Bundle\\FrameworkBundle\\Console\\Application;\nuse Symfony\\Component\\Console\\Input\\ArgvInput;\nuse Symfony\\Component\\Debug\\Debug;\n\nset_time_limit(0);\n\nrequire dirname(__DIR__, 3) . '/vendor/autoload.php';\n\nif (!class_exists(Application::class)) {\n    throw new RuntimeException('You need to add \"symfony/framework-bundle\" as a Composer dependency.');\n}\n\n$input = new ArgvInput();\nif (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {\n    putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);\n}\n\nif ($input->hasParameterOption('--no-debug', true)) {\n    putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');\n}\n\nrequire dirname(__DIR__) . '/config/bootstrap.php';\n\nif ($_SERVER['APP_DEBUG']) {\n    umask(0000);\n\n    if (class_exists(Debug::class)) {\n        Debug::enable();\n    }\n}\n\n$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);\n$application = new Application($kernel);\n$application->run($input);\n"
  },
  {
    "path": "tests/Application/composer.json",
    "content": "{\n    \"name\": \"example/test-application\"\n}\n"
  },
  {
    "path": "tests/Application/config/bootstrap.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nuse Symfony\\Component\\Dotenv\\Dotenv;\n\nrequire dirname(__DIR__, 3) . '/vendor/autoload.php';\n\n// Load cached env vars if the .env.local.php file exists\n// Run \"composer dump-env prod\" to create it (requires symfony/flex >=1.2)\nif (is_array($env = @include dirname(__DIR__) . '/.env.local.php')) {\n    $_SERVER += $env;\n    $_ENV += $env;\n} elseif (!class_exists(Dotenv::class)) {\n    throw new RuntimeException('Please run \"composer require symfony/dotenv\" to load the \".env\" files configuring the application.');\n} else {\n    // load all the .env files\n    (new Dotenv())->loadEnv(dirname(__DIR__) . '/.env');\n}\n\n$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'test';\n$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];\n$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], \\FILTER_VALIDATE_BOOLEAN) ? '1' : '0';\n"
  },
  {
    "path": "tests/Application/config/bundles.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nuse BabDev\\PagerfantaBundle\\BabDevPagerfantaBundle;\nuse Bazinga\\Bundle\\HateoasBundle\\BazingaHateoasBundle;\nuse Doctrine\\Bundle\\DoctrineBundle\\DoctrineBundle;\nuse FOS\\RestBundle\\FOSRestBundle;\nuse JMS\\SerializerBundle\\JMSSerializerBundle;\nuse Sylius\\Bundle\\GridBundle\\SyliusGridBundle;\nuse Sylius\\Bundle\\ResourceBundle\\SyliusResourceBundle;\nuse Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle;\nuse Symfony\\Bundle\\SecurityBundle\\SecurityBundle;\nuse Symfony\\Bundle\\TwigBundle\\TwigBundle;\nuse winzou\\Bundle\\StateMachineBundle\\winzouStateMachineBundle;\n\n$bundles = [\n    FrameworkBundle::class => ['all' => true],\n    SecurityBundle::class => ['all' => true],\n    DoctrineBundle::class => ['all' => true],\n    SyliusResourceBundle::class => ['all' => true],\n    BabDevPagerfantaBundle::class => ['all' => true],\n    TwigBundle::class => ['all' => true, 'test_without_twig' => false],\n    SyliusGridBundle::class => ['all' => true, 'test_without_twig' => false],\n    Zenstruck\\Foundry\\ZenstruckFoundryBundle::class => ['dev' => true, 'test' => true],\n];\n\nif (class_exists(BazingaHateoasBundle::class)) {\n    $bundles[BazingaHateoasBundle::class] = ['all' => true, 'test_with_attributes' => false];\n}\n\nif (class_exists(FOSRestBundle::class)) {\n    $bundles[FOSRestBundle::class] = ['all' => true];\n}\n\nif (class_exists(JMSSerializerBundle::class)) {\n    $bundles[JMSSerializerBundle::class] = ['all' => true];\n}\n\nif (class_exists(winzouStateMachineBundle::class)) {\n    $bundles[winzouStateMachineBundle::class] = ['all' => true];\n}\n\nreturn $bundles;\n"
  },
  {
    "path": "tests/Application/config/integration/fos_rest.yaml",
    "content": "fos_rest:\n    view:\n        formats:\n            json: true\n        empty_content: 204\n    format_listener:\n        rules:\n            - { path: '^/admin/*', priorities: ['html'], fallback_format: html }\n            - { path: '^/science-books/*', priorities: ['html'], fallback_format: html }\n            - { path: '^/', priorities: ['json'], fallback_format: json, prefer_extension: true }\n    exception:\n        enabled: false\n"
  },
  {
    "path": "tests/Application/config/integration/jms_serializer.yaml",
    "content": "jms_serializer:\n    visitors:\n        xml_serialization:\n            format_output: '%kernel.debug%'\n"
  },
  {
    "path": "tests/Application/config/integration/symfony_workflow.yaml",
    "content": "framework:\n    workflows:\n        pull_request:\n            type: 'state_machine'\n            marking_store:\n                type: 'method'\n                property: 'currentPlace'\n            supports:\n                - App\\Entity\\PullRequest\n            initial_marking: start\n            places:\n                - start\n                - coding\n                - test\n                - review\n                - merged\n                - closed\n            transitions:\n                submit:\n                    from: start\n                    to: test\n                update:\n                    from: [coding, test, review]\n                    to: test\n                wait_for_review:\n                    from: test\n                    to: review\n                request_change:\n                    from: review\n                    to: coding\n                accept:\n                    from: review\n                    to: merged\n                reject:\n                    from: review\n                    to: closed\n                reopen:\n                    from: closed\n                    to: review\n        blog_publishing:\n            type: 'workflow'\n            marking_store:\n                type: 'method'\n                property: 'currentPlace'\n            supports:\n                - App\\Entity\\BlogPost\n            initial_marking: draft\n            places:\n                - draft\n                - reviewed\n                - rejected\n                - published\n            transitions:\n                to_review:\n                    from: draft\n                    to: reviewed\n                publish:\n                    from: reviewed\n                    to: published\n                reject:\n                    from: reviewed\n                    to: rejected\n        subscription:\n            type: 'state_machine'\n            marking_store:\n                type: 'method'\n                property: 'state'\n            supports:\n                - App\\Subscription\\Entity\\Subscription\n            initial_marking: new\n            places:\n                - new\n                - accepted\n                - rejected\n            transitions:\n                accept:\n                    from: new\n                    to: accepted\n                reject:\n                    from: new\n                    to: rejected\n"
  },
  {
    "path": "tests/Application/config/integration/winzou_state_machine.yaml",
    "content": "winzou_state_machine:\n    pull_request:\n        class: App\\Entity\\PullRequest\n        property_path: currentPlace\n        graph: pull_request\n        states:\n            - start\n            - coding\n            - test\n            - review\n            - merged\n            - closed\n        transitions:\n            submit:\n                from: [ start ]\n                to: test\n            update:\n                from: [ coding, test, review ]\n                to: test\n            wait_for_review:\n                from: [ test ]\n                to: review\n            request_change:\n                from: [ review ]\n                to: coding\n            accept:\n                from: [ review ]\n                to: merged\n            reject:\n                from: [ review ]\n                to: closed\n            reopen:\n                from: [ closed ]\n                to: review\n    subscription:\n        class: App\\Subscription\\Entity\\Subscription\n        property_path: state\n        graph: subscription\n        states:\n            - new\n            - accepted\n            - rejected\n        transitions:\n            accept:\n                from: [ new ]\n                to: accepted\n            reject:\n                from: [ new ]\n                to: rejected\n"
  },
  {
    "path": "tests/Application/config/packages/doctrine.yaml",
    "content": "doctrine:\n    dbal:\n        driver: \"%database_driver%\"\n        path: \"%database_path%\"\n        charset: UTF8\n    orm:\n        naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware\n        auto_mapping: true\n        mappings:\n            App:\n                is_bundle: false\n                type: attribute\n                dir: '%kernel.project_dir%/src/Entity'\n                prefix: 'App\\Entity'\n                alias: App\n            BoardGameBlog:\n                is_bundle: false\n                type: attribute\n                dir: '%kernel.project_dir%/src/BoardGameBlog/Domain'\n                prefix: 'App\\BoardGameBlog\\Domain'\n            Conference:\n                is_bundle: false\n                type: attribute\n                dir: '%kernel.project_dir%/src/Conference/Entity'\n                prefix: 'App\\Conference\\Entity'\n            Subscription:\n                is_bundle: false\n                type: attribute\n                dir: '%kernel.project_dir%/src/Subscription/Entity'\n                prefix: 'App\\Subscription\\Entity'\n"
  },
  {
    "path": "tests/Application/config/packages/framework.yaml",
    "content": "framework:\n    assets: false\n    translator:\n        default_path: '%kernel.project_dir%/translations'\n        fallbacks: [\"en_US\"]\n    secret: \"%secret%\"\n    form: ~\n    csrf_protection: true\n    default_locale: \"en_US\"\n    session:\n        handler_id: ~\n        storage_factory_id: session.storage.factory.mock_file\n    http_method_override: true\n    test: ~\n    serializer:\n        enabled: true\n"
  },
  {
    "path": "tests/Application/config/packages/messenger.yaml",
    "content": "framework:\n    messenger:\n        default_bus: command.bus\n        buses:\n            command.bus: ~\n            query.bus: ~\n        transports:\n            sync: 'sync://'\n        routing:\n            'App\\Shared\\Application\\Query\\QueryInterface': 'sync'\n            'App\\Shared\\Application\\Command\\CommandInterface': 'sync'\n"
  },
  {
    "path": "tests/Application/config/packages/routing.yaml",
    "content": "framework:\n    router:\n        utf8: true\n"
  },
  {
    "path": "tests/Application/config/packages/security.yaml",
    "content": "security:\n    # https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords\n    password_hashers:\n        Symfony\\Component\\Security\\Core\\User\\PasswordAuthenticatedUserInterface: 'auto'\n    # https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider\n    providers:\n        users_in_memory: { memory: null }\n    firewalls:\n        dev:\n            pattern: ^/(_(profiler|wdt)|css|images|js)/\n            security: false\n        main:\n            lazy: true\n            provider: users_in_memory\n\n            # activate different ways to authenticate\n            # https://symfony.com/doc/current/security.html#the-firewall\n\n            # https://symfony.com/doc/current/security/impersonating_user.html\n            # switch_user: true\n\n    # Easy way to control access for large sections of your site\n    # Note: Only the *first* access control that matches will be used\n    access_control:\n        # - { path: ^/admin, roles: ROLE_ADMIN }\n        # - { path: ^/profile, roles: ROLE_USER }\n\nwhen@test:\n    security:\n        password_hashers:\n            # By default, password hashers are resource intensive and take time. This is\n            # important to generate secure password hashes. In tests however, secure hashes\n            # are not important, waste resources and increase test times. The following\n            # reduces the work factor to the lowest possible values.\n            Symfony\\Component\\Security\\Core\\User\\PasswordAuthenticatedUserInterface:\n                algorithm: auto\n                cost: 4 # Lowest possible value for bcrypt\n                time_cost: 3 # Lowest possible value for argon\n                memory_cost: 10 # Lowest possible value for argon\n"
  },
  {
    "path": "tests/Application/config/packages/test/grids.yaml",
    "content": "sylius_grid:\n    grids:\n        science_book_grid:\n            driver:\n                options:\n                    class: '%app.model.science_book.class%'\n            sorting:\n                title: asc\n            fields:\n                title:\n                    type: string\n                    sortable: ~\n                authorFirstName:\n                    type: string\n                    sortable: author.firstName\n                authorLastName:\n                    type: string\n                    sortable: author.firstName\n            filters:\n                search:\n                    type: string\n                    options:\n                        fields: [title, author.firstName, author.lastName]\n"
  },
  {
    "path": "tests/Application/config/packages/test/sylius_grid.yaml",
    "content": "sylius_grid:\n    templates:\n        action:\n            apply_transition: 'grid/action/apply_transition.html.twig'\n            delete: 'grid/action/delete.html.twig'\n            show: 'grid/action/show.html.twig'\n            update: 'grid/action/update.html.twig'\n        bulk_action:\n            apply_transition: 'grid/bulk_action/apply_transition.html.twig'\n            delete: 'grid/bulk_action/delete.html.twig'\n"
  },
  {
    "path": "tests/Application/config/packages/test/twig.yaml",
    "content": "twig:\n    debug: \"%kernel.debug%\"\n    strict_variables: \"%kernel.debug%\"\n    paths: ['%kernel.project_dir%/templates']\n"
  },
  {
    "path": "tests/Application/config/packages/test_with_attributes/sylius_resource.yaml",
    "content": "sylius_resource:\n    mapping:\n        paths: ['%kernel.project_dir%/src/Entity']\n"
  },
  {
    "path": "tests/Application/config/packages/test_without_fosrest/grids.yaml",
    "content": "imports:\n    - { resource: '../test/grids.yaml' }\n"
  },
  {
    "path": "tests/Application/config/packages/test_without_fosrest/sylius_grid.yaml",
    "content": "imports:\n    - { resource: '../test/sylius_grid.yaml' }\n"
  },
  {
    "path": "tests/Application/config/packages/test_without_fosrest/twig.yaml",
    "content": "imports:\n    - { resource: '../test/twig.yaml' }\n"
  },
  {
    "path": "tests/Application/config/packages/test_without_hateoas/fos_rest.yaml",
    "content": "imports:\n    - { resource: '../test/fos_rest.yaml' }\n"
  },
  {
    "path": "tests/Application/config/packages/test_without_hateoas/grids.yaml",
    "content": "imports:\n    - { resource: '../test/grids.yaml' }\n"
  },
  {
    "path": "tests/Application/config/packages/test_without_hateoas/jms_serializer.yaml",
    "content": "imports:\n    - { resource: '../test/jms_serializer.yaml' }\n"
  },
  {
    "path": "tests/Application/config/packages/test_without_hateoas/sylius_grid.yaml",
    "content": "imports:\n    - { resource: '../test/sylius_grid.yaml' }\n"
  },
  {
    "path": "tests/Application/config/packages/test_without_hateoas/twig.yaml",
    "content": "imports:\n    - { resource: '../test/twig.yaml' }\n"
  },
  {
    "path": "tests/Application/config/routes/sylius_resource.yaml",
    "content": "sylius_crud_routes:\n    resource: 'sylius.routing.loader.crud_routes_attributes'\n    type: service\n\nsylius_resource_routes:\n    resource: 'sylius.symfony.routing.loader.resource'\n    type: service\n"
  },
  {
    "path": "tests/Application/config/routes.yaml",
    "content": "app_blog_post:\n    resource: |\n        alias: app.blog_post\n    type: sylius.resource_api\n\napp_blog_post_apply_transition:\n    path: /blog-posts/{id}/{transition}\n    methods: [PUT]\n    defaults:\n        _controller: app.controller.blog_post::applyStateMachineTransitionAction\n        _sylius:\n            csrf_protection: false\n            state_machine:\n                graph: blog_publishing\n                transition: $transition\n\napp_book:\n    resource: |\n        alias: app.book\n    type: sylius.resource_api\n\napp_gedmo:\n    resource: |\n        alias: app.gedmo\n    type: sylius.resource_api\n\napp_pull_request:\n    resource: |\n        alias: app.pull_request\n    type: sylius.resource_api\n\napp_pull_request_apply_transition:\n    path: /pull-requests/{id}/{transition}\n    methods: [PUT]\n    defaults:\n        _controller: app.controller.pull_request::applyStateMachineTransitionAction\n        _sylius:\n            csrf_protection: false\n            state_machine:\n                graph: pull_request\n                transition: $transition\n\napp_book_sortable_index:\n    path: /sortable-books/\n    methods: [GET]\n    defaults:\n        _controller: App\\Controller\\BookController::indexAction\n        _sylius:\n            sortable: true\n\napp_book_filterable_index:\n    path: /filterable-books/\n    methods: [GET]\n    defaults:\n        _controller: app.controller.book::indexAction\n        _sylius:\n            filterable: true\n\napp_versioned_book:\n    resource: \"versioned_routing.yaml\"\n    prefix: /v{version}\n\napp_create_book_with_custom_factory:\n    path: /create-custom-book\n    methods: [POST]\n    defaults:\n        _controller: app.controller.book::createAction\n        _sylius:\n            factory:\n                method: [\"expr:service('test.custom_book_factory')\", \"createCustom\"]\n\napp_index_books_with_custom_repository:\n    path: /find-custom-books\n    methods: [GET]\n    defaults:\n        _controller: app.controller.book::indexAction\n        _sylius:\n            repository:\n                method: [\"expr:service('test.custom_book_repository')\", \"findCustomBooks\"]\n\napp_show_book_with_custom_repository:\n    path: /find-custom-book\n    methods: [GET]\n    defaults:\n        _controller: app.controller.book::showAction\n        _sylius:\n            repository:\n                method: [\"expr:service('test.custom_book_repository')\", \"findCustomBook\"]\n                arguments: [\"J.R.R. Tolkien\"]\n\napp_science_book:\n    resource: |\n        alias: app.science_book\n        templates: 'ScienceBook'\n        grid: science_book_grid\n    type: sylius.resource\n"
  },
  {
    "path": "tests/Application/config/services/integration/gedmo.yaml",
    "content": "services:\n    _defaults:\n        public: false\n\n    gedmo_doctrine_extensions.mapping.driver.attribute:\n        class: Gedmo\\Mapping\\Driver\\AttributeReader\n\n    gedmo.listener.sortable:\n        class: Gedmo\\Sortable\\SortableListener\n        tags:\n            - { name: doctrine.event_listener, event: 'onFlush' }\n            - { name: doctrine.event_listener, event: 'loadClassMetadata' }\n            - { name: doctrine.event_listener, event: 'prePersist' }\n            - { name: doctrine.event_listener, event: 'postPersist' }\n            - { name: doctrine.event_listener, event: 'preUpdate' }\n            - { name: doctrine.event_listener, event: 'postRemove' }\n            - { name: doctrine.event_listener, event: 'postFlush' }\n        calls:\n            - [ setAnnotationReader, [ \"@gedmo_doctrine_extensions.mapping.driver.attribute\" ] ]\n"
  },
  {
    "path": "tests/Application/config/services.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nuse App\\Service\\FirstAutowiredService;\nuse App\\Service\\NoInterfaceAutowiredService;\nuse App\\Service\\SecondAutowiredService;\nuse Symfony\\Component\\DependencyInjection\\Definition;\nuse Symfony\\Component\\DependencyInjection\\Reference;\n\nif (method_exists($container, 'registerAliasForArgument')) {\n    $container->autowire(FirstAutowiredService::class)->setPublic(true);\n    $container->autowire(SecondAutowiredService::class)->setPublic(true);\n    $container->autowire(NoInterfaceAutowiredService::class)->setPublic(true);\n} else {\n    $container->setDefinition(FirstAutowiredService::class, (new Definition(FirstAutowiredService::class, [\n        new Reference('app.factory.book'),\n        new Reference('app.repository.book'),\n        new Reference('app.manager.book'),\n    ]))->setPublic(true));\n\n    $container->setDefinition(SecondAutowiredService::class, (new Definition(SecondAutowiredService::class, [\n        new Reference('app.factory.book'),\n        new Reference('app.repository.book'),\n        new Reference('app.manager.book'),\n    ]))->setPublic(true));\n\n    $container->setDefinition(NoInterfaceAutowiredService::class, (new Definition(NoInterfaceAutowiredService::class, [\n        new Reference('app.factory.book'),\n        new Reference('app.repository.book'),\n        new Reference('app.factory.comic_book'),\n        new Reference('app.repository.comic_book'),\n    ]))->setPublic(true));\n}\n"
  },
  {
    "path": "tests/Application/config/services.yaml",
    "content": "imports:\n    - { resource: \"sylius/resources.yaml\" }\n\nparameters:\n    database_driver: pdo_sqlite\n    database_path: \"%kernel.project_dir%/config/db.sql\"\n\n    secret: \"Three can keep a secret, if two of them are dead.\"\n\nservices:\n    # Gets rid of \"[error] Uncaught PHP Exception Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException\"\n    # errors in PHPUnit output when testing 404 errors.\n    Psr\\Log\\NullLogger: ~\n    logger: '@Psr\\Log\\NullLogger'\n\n    # Default configuration for services in *this* file\n    _defaults:\n        # Automatically injects dependencies in your services\n        autowire: true\n\n        # Automatically registers your services as commands, event subscribers, etc.\n        autoconfigure: true\n\n        # Allows optimizing the container by removing unused services; this also means\n        # fetching services directly from the container via $container->get() won't work\n        public: false\n\n    # Controllers are imported separately to make sure services can be injected\n    # as action arguments even if you don't extend any base controller class\n    App\\Controller\\:\n        resource: '../src/Controller'\n        tags: ['controller.service_arguments']\n\n    test.translation_locale_provider:\n        class: Sylius\\Component\\Resource\\Translation\\Provider\\ImmutableTranslationLocaleProvider\n        arguments:\n            - [\"pl_PL\", \"en_US\", \"de_DE\"]\n            - \"en_US\"\n\n    test.custom_book_factory:\n        class: App\\Factory\\CustomBookFactory\n        public: true\n        arguments:\n            - \"%app.model.book.class%\"\n            - \"@test.translation_locale_provider\"\n\n    test.custom_book_repository:\n        class: App\\Repository\\CustomBookRepository\n        public: true\n        arguments:\n            - \"@app.repository.book\"\n\n    app.form.type.book:\n        class: App\\Form\\Type\\BookType\n        arguments:\n            - '%app.model.book.class%'\n        tags: ['form.type']\n\n    app.form.type.science_book:\n        class: App\\Form\\Type\\ScienceBookType\n        arguments:\n            - '%app.model.science_book.class%'\n            - ['sylius']\n        tags: [ 'form.type' ]\n\n    app.form.type.book_translation:\n        class: App\\Form\\Type\\BookTranslationType\n        arguments:\n            - '%app.model.book_translation.class%'\n        tags: ['form.type']\n\n    App\\Repository\\ComicBookRepository: null\n    App\\Repository\\LegacyBookRepository: null\n\n    App\\Shared\\:\n        resource: '../src/Shared'\n\n    app.service.legacy_autowired_repository:\n        class: App\\Service\\LegacyAutowiredRepositoryService\n        autowire: true\n\n    app.service.legacy_autowired_factory:\n        class: App\\Service\\LegacyAutowiredFactoryService\n        autowire: true\n\n    app.service.legacy_autowired_translatable_factory:\n        class: App\\Service\\LegacyAutowiredTranslatableFactoryService\n        autowire: true\n\n# Grid-dependent namespaces are loaded differently depending on environment\nwhen@test:\n    services:\n        App\\BoardGameBlog\\:\n            resource: '../src/BoardGameBlog'\n            autowire: true\n            autoconfigure: true\n\n        App\\Conference\\:\n            resource: '../src/Conference'\n            autowire: true\n            autoconfigure: true\n\n        App\\Subscription\\:\n            resource: '../src/Subscription'\n            autowire: true\n            autoconfigure: true\n\n        App\\Subscription\\Factory\\SubscriptionFactory:\n            decorates: 'app.factory.subscription'\n"
  },
  {
    "path": "tests/Application/config/sylius/resources/imports/speaker.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nuse App\\Conference\\Entity\\Speaker;\nuse App\\Conference\\Form\\SpeakerType;\nuse App\\Conference\\Grid\\SpeakerGrid;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Delete;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\Update;\n\nreturn (new ResourceMetadata())\n    ->withRoutePrefix('/admin')\n    ->withClass(Speaker::class)\n    ->withSection('admin')\n    ->withTemplatesDir('crud')\n    ->withFormType(SpeakerType::class)\n    ->withOperations(new Operations([\n        new Create(),\n        new Update(),\n        new Delete(),\n        new Index(grid: SpeakerGrid::class),\n    ]))\n;\n"
  },
  {
    "path": "tests/Application/config/sylius/resources.yaml",
    "content": "sylius_resource:\n    mapping:\n        imports:\n            - '%kernel.project_dir%/config/sylius/resources/imports'\n        paths:\n            - '%kernel.project_dir%/src/BoardGameBlog/Infrastructure/Sylius/Resource'\n            - '%kernel.project_dir%/src/Subscription/Entity'\n\n    translation:\n        locale_provider: test.translation_locale_provider\n\n    resources:\n        app.blog_post:\n            classes:\n                model: App\\Entity\\BlogPost\n                form: App\\Form\\Type\\BlogPostType\n\n        app.book:\n            classes:\n                model: App\\Entity\\Book\n                factory: App\\Factory\\BookFactory\n                controller: App\\Controller\\BookController\n                repository: App\\Repository\\BookRepository\n                form: App\\Form\\Type\\BookType\n            translation:\n                classes:\n                    model: App\\Entity\\BookTranslation\n                    interface: App\\Entity\\BookTranslationInterface\n                    form: App\\Form\\Type\\BookTranslationType\n\n        app.comic_book:\n            classes:\n                model: App\\Entity\\ComicBook\n\n        app.legacy_book:\n            classes:\n                model: App\\Entity\\LegacyBook\n                factory: App\\Factory\\LegacyBookFactory\n            translation:\n                classes:\n                    model: App\\Entity\\LegacyBookTranslation\n\n        app.science_book:\n            classes:\n                model: App\\Entity\\ScienceBook\n                form: App\\Form\\Type\\ScienceBookType\n\n        app.gedmo:\n            classes:\n                model: App\\Entity\\GedmoExtendedExample\n\n        app.pull_request:\n            classes:\n                model: App\\Entity\\PullRequest\n                form: App\\Form\\Type\\PullRequestType\n\n        app.speaker:\n            classes:\n                model: App\\Conference\\Entity\\Speaker\n\n        app.zone:\n            classes:\n                model: App\\Entity\\Zone\\Zone\n                interface: App\\Entity\\Zone\\ZoneInterface\n\n        app.zone_member:\n            classes:\n                model: App\\Entity\\Zone\\ZoneMember\n                interface: App\\Entity\\Zone\\ZoneMemberInterface\n"
  },
  {
    "path": "tests/Application/config/validator/validation.yaml",
    "content": "App\\Entity\\ScienceBook:\n    properties:\n        title:\n            - NotBlank:\n                  groups: [sylius]\n        author:\n            - Valid: ~\n\nApp\\Entity\\Author:\n    properties:\n        firstName:\n            - NotBlank:\n                  groups: [sylius]\n        lastName:\n            - NotBlank:\n                  groups: [sylius]\n"
  },
  {
    "path": "tests/Application/config/versioned_routing.yaml",
    "content": "app_comic_book:\n    resource: |\n        alias: app.comic_book\n        serialization_version: $version\n    type: sylius.resource_api\n"
  },
  {
    "path": "tests/Application/public/index.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nuse App\\Kernel;\nuse Symfony\\Bundle\\FrameworkBundle\\Console\\Application;\nuse Symfony\\Component\\Console\\Input\\ArgvInput;\nuse Symfony\\Component\\ErrorHandler\\Debug;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nrequire dirname(__DIR__, 3) . '/vendor/autoload.php';\n\nif (!class_exists(Application::class)) {\n    throw new RuntimeException('You need to add \"symfony/framework-bundle\" as a Composer dependency.');\n}\n\n$input = new ArgvInput();\nif (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {\n    putenv('APP_ENV=' . $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);\n}\n\nif ($input->hasParameterOption('--no-debug', true)) {\n    putenv('APP_DEBUG=' . $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');\n}\n\nrequire dirname(__DIR__) . '/config/bootstrap.php';\n\nif ($_SERVER['APP_DEBUG']) {\n    umask(0000);\n\n    if (class_exists(Debug::class)) {\n        Debug::enable();\n    }\n}\n\n$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);\n$request = Request::createFromGlobals();\n$response = $kernel->handle($request);\n$response->send();\n$kernel->terminate($request, $response);\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Application/Command/CreateBoardGameCommand.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Application\\Command;\n\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameName;\nuse App\\Shared\\Application\\Command\\CommandInterface;\n\nfinal class CreateBoardGameCommand implements CommandInterface\n{\n    public function __construct(\n        public BoardGameName $name,\n    ) {\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Application/Command/CreateBoardGameCommandHandler.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Application\\Command;\n\nuse App\\BoardGameBlog\\Domain\\Model\\BoardGame;\nuse App\\BoardGameBlog\\Domain\\Repository\\BoardGameRepositoryInterface;\nuse App\\Shared\\Application\\Command\\CommandHandlerInterface;\n\nfinal class CreateBoardGameCommandHandler implements CommandHandlerInterface\n{\n    public function __construct(private BoardGameRepositoryInterface $boardGameRepository)\n    {\n    }\n\n    public function __invoke(CreateBoardGameCommand $command): BoardGame\n    {\n        $boardGame = new BoardGame(\n            $command->name,\n        );\n\n        $this->boardGameRepository->save($boardGame);\n\n        return $boardGame;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Application/Command/DeleteBoardGameCommand.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Application\\Command;\n\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameId;\nuse App\\Shared\\Application\\Command\\CommandInterface;\n\nfinal class DeleteBoardGameCommand implements CommandInterface\n{\n    public function __construct(\n        public BoardGameId $id,\n    ) {\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Application/Command/DeleteBoardGameCommandHandler.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Application\\Command;\n\nuse App\\BoardGameBlog\\Domain\\Repository\\BoardGameRepositoryInterface;\nuse App\\Shared\\Application\\Command\\CommandHandlerInterface;\n\nfinal class DeleteBoardGameCommandHandler implements CommandHandlerInterface\n{\n    public function __construct(private BoardGameRepositoryInterface $boardGameRepository)\n    {\n    }\n\n    public function __invoke(DeleteBoardGameCommand $command): void\n    {\n        if (null === $boardGame = $this->boardGameRepository->ofId($command->id)) {\n            return;\n        }\n\n        $this->boardGameRepository->remove($boardGame);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Application/Command/UpdateBoardGameCommand.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Application\\Command;\n\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameId;\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameName;\nuse App\\Shared\\Application\\Command\\CommandInterface;\n\nfinal class UpdateBoardGameCommand implements CommandInterface\n{\n    public function __construct(\n        public BoardGameId $id,\n        public ?BoardGameName $name = null,\n    ) {\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Application/Command/UpdateBoardGameCommandHandler.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Application\\Command;\n\nuse App\\BoardGameBlog\\Domain\\Exception\\MissingBoardGameException;\nuse App\\BoardGameBlog\\Domain\\Model\\BoardGame;\nuse App\\BoardGameBlog\\Domain\\Repository\\BoardGameRepositoryInterface;\nuse App\\Shared\\Application\\Command\\CommandHandlerInterface;\n\nfinal class UpdateBoardGameCommandHandler implements CommandHandlerInterface\n{\n    public function __construct(private BoardGameRepositoryInterface $boardGameRepository)\n    {\n    }\n\n    public function __invoke(UpdateBoardGameCommand $command): BoardGame\n    {\n        $boardGame = $this->boardGameRepository->ofId($command->id);\n        if (null === $boardGame) {\n            throw new MissingBoardGameException($command->id);\n        }\n\n        $boardGame->update(\n            name: $command->name,\n        );\n\n        $this->boardGameRepository->save($boardGame);\n\n        return $boardGame;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Application/Query/FindBoardGameQuery.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Application\\Query;\n\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameId;\nuse App\\Shared\\Application\\Query\\QueryInterface;\n\nfinal class FindBoardGameQuery implements QueryInterface\n{\n    public function __construct(\n        public BoardGameId $id,\n    ) {\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Application/Query/FindBoardGameQueryHandler.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Application\\Query;\n\nuse App\\BoardGameBlog\\Domain\\Model\\BoardGame;\nuse App\\BoardGameBlog\\Domain\\Repository\\BoardGameRepositoryInterface;\nuse App\\Shared\\Application\\Query\\QueryHandlerInterface;\n\nfinal class FindBoardGameQueryHandler implements QueryHandlerInterface\n{\n    public function __construct(private BoardGameRepositoryInterface $repository)\n    {\n    }\n\n    public function __invoke(FindBoardGameQuery $query): ?BoardGame\n    {\n        return $this->repository->ofId($query->id);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Domain/Exception/MissingBoardGameException.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Domain\\Exception;\n\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameId;\n\nfinal class MissingBoardGameException extends \\RuntimeException\n{\n    public function __construct(BoardGameId $id, int $code = 0, ?\\Throwable $previous = null)\n    {\n        parent::__construct(sprintf('Cannot find board game with id %s', (string) $id), $code, $previous);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Domain/Model/BoardGame.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Domain\\Model;\n\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameId;\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameName;\nuse Doctrine\\ORM\\Mapping as ORM;\n\n#[ORM\\Entity]\nclass BoardGame\n{\n    #[ORM\\Embedded(columnPrefix: false)]\n    private BoardGameId $id;\n\n    public function __construct(\n        #[ORM\\Embedded(columnPrefix: false)]\n        private BoardGameName $name,\n    ) {\n        $this->id = new BoardGameId();\n    }\n\n    public function update(\n        ?BoardGameName $name = null,\n    ): void {\n        $this->name = $name ?? $this->name;\n    }\n\n    public function id(): BoardGameId\n    {\n        return $this->id;\n    }\n\n    public function name(): BoardGameName\n    {\n        return $this->name;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Domain/Repository/BoardGameRepositoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Domain\\Repository;\n\nuse App\\BoardGameBlog\\Domain\\Model\\BoardGame;\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameId;\nuse App\\Shared\\Domain\\Repository\\RepositoryInterface;\n\n/**\n * @extends RepositoryInterface<BoardGame>\n */\ninterface BoardGameRepositoryInterface extends RepositoryInterface\n{\n    public function save(BoardGame $boardGame): void;\n\n    public function remove(BoardGame $boardGame): void;\n\n    public function ofId(BoardGameId $id): ?BoardGame;\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Domain/ValueObject/BoardGameId.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Domain\\ValueObject;\n\nuse App\\Shared\\Domain\\ValueObject\\AggregateRootId;\nuse Doctrine\\ORM\\Mapping as ORM;\n\n#[ORM\\Embeddable]\nfinal class BoardGameId implements \\Stringable\n{\n    use AggregateRootId;\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Domain/ValueObject/BoardGameName.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Domain\\ValueObject;\n\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Webmozart\\Assert\\Assert;\n\n#[ORM\\Embeddable]\nfinal class BoardGameName implements \\Stringable\n{\n    #[ORM\\Column(name: 'name', length: 255)]\n    public string $value;\n\n    public function __construct(string $value)\n    {\n        Assert::lengthBetween($value, 1, 255);\n\n        $this->value = $value;\n    }\n\n    public function __toString(): string\n    {\n        return $this->value;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Infrastructure/Doctrine/DoctrineBoardGameRepository.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Infrastructure\\Doctrine;\n\nuse App\\BoardGameBlog\\Domain\\Model\\BoardGame;\nuse App\\BoardGameBlog\\Domain\\Repository\\BoardGameRepositoryInterface;\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameId;\nuse Doctrine\\Bundle\\DoctrineBundle\\Repository\\ServiceEntityRepository;\nuse Doctrine\\Persistence\\ManagerRegistry;\n\nfinal class DoctrineBoardGameRepository extends ServiceEntityRepository implements BoardGameRepositoryInterface\n{\n    public function __construct(ManagerRegistry $registry)\n    {\n        parent::__construct($registry, BoardGame::class);\n    }\n\n    public function save(BoardGame $boardGame): void\n    {\n        $this->getEntityManager()->persist($boardGame);\n        $this->getEntityManager()->flush();\n        $this->getEntityManager()->refresh($boardGame);\n    }\n\n    public function remove(BoardGame $boardGame): void\n    {\n        $this->getEntityManager()->remove($boardGame);\n        $this->getEntityManager()->flush();\n    }\n\n    public function ofId(BoardGameId $id): ?BoardGame\n    {\n        return $this->find($id->value);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Infrastructure/Foundry/Factory/BoardGameFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Infrastructure\\Foundry\\Factory;\n\nuse App\\BoardGameBlog\\Domain\\Model\\BoardGame;\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameName;\nuse Zenstruck\\Foundry\\Persistence\\PersistentObjectFactory;\n\n/**\n * @extends PersistentObjectFactory<BoardGame>\n */\nfinal class BoardGameFactory extends PersistentObjectFactory\n{\n    public static function class(): string\n    {\n        return BoardGame::class;\n    }\n\n    public function withName(BoardGameName $name): self\n    {\n        return $this->with(['name' => $name]);\n    }\n\n    protected function defaults(): array\n    {\n        return [\n            'name' => new BoardGameName(ucfirst(self::faker()->words(2, true))),\n        ];\n    }\n\n    protected function initialize(): static\n    {\n        return parent::instantiateWith(function (array $attributes): BoardGame {\n            return new BoardGame(...$attributes);\n        });\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Infrastructure/Sylius/Grid/BoardGameGrid.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Infrastructure\\Sylius\\Grid;\n\nuse App\\BoardGameBlog\\Domain\\Model\\BoardGame;\nuse Sylius\\Bundle\\GridBundle\\Builder\\Action\\CreateAction;\nuse Sylius\\Bundle\\GridBundle\\Builder\\Action\\DeleteAction;\nuse Sylius\\Bundle\\GridBundle\\Builder\\Action\\ShowAction;\nuse Sylius\\Bundle\\GridBundle\\Builder\\Action\\UpdateAction;\nuse Sylius\\Bundle\\GridBundle\\Builder\\ActionGroup\\ItemActionGroup;\nuse Sylius\\Bundle\\GridBundle\\Builder\\ActionGroup\\MainActionGroup;\nuse Sylius\\Bundle\\GridBundle\\Builder\\Field\\StringField;\nuse Sylius\\Bundle\\GridBundle\\Builder\\GridBuilderInterface;\nuse Sylius\\Bundle\\GridBundle\\Grid\\AbstractGrid;\nuse Sylius\\Bundle\\GridBundle\\Grid\\ResourceAwareGridInterface;\n\nfinal class BoardGameGrid extends AbstractGrid implements ResourceAwareGridInterface\n{\n    public static function getName(): string\n    {\n        return 'app_board_game';\n    }\n\n    public function buildGrid(GridBuilderInterface $gridBuilder): void\n    {\n        $gridBuilder\n            ->orderBy('name', 'asc')\n            ->addField(\n                StringField::create('name')\n                    ->setPath('name.value')\n                    ->setLabel('Name')\n                    ->setSortable(true, 'name.value'),\n            )\n            ->addActionGroup(\n                MainActionGroup::create(\n                    CreateAction::create(),\n                ),\n            )\n            ->addActionGroup(\n                ItemActionGroup::create(\n                    ShowAction::create(),\n                    UpdateAction::create(),\n                    DeleteAction::create(),\n                ),\n            )\n        ;\n    }\n\n    public function getResourceClass(): string\n    {\n        return BoardGame::class;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Infrastructure/Sylius/Resource/BoardGameResource.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Infrastructure\\Sylius\\Resource;\n\nuse App\\BoardGameBlog\\Domain\\Model\\BoardGame;\nuse App\\BoardGameBlog\\Infrastructure\\Sylius\\State\\Http\\Processor\\DeleteBoardGameProcessor;\nuse App\\BoardGameBlog\\Infrastructure\\Sylius\\State\\Http\\Processor\\UpdateBoardGameProcessor;\nuse App\\BoardGameBlog\\Infrastructure\\Sylius\\State\\Http\\Provider\\BoardGameCollectionProvider;\nuse App\\BoardGameBlog\\Infrastructure\\Sylius\\State\\Http\\Provider\\BoardGameItemProvider;\nuse App\\BoardGameBlog\\Infrastructure\\Symfony\\Form\\Type\\BoardGameType;\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Delete;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\Uid\\AbstractUid;\nuse Symfony\\Component\\Validator\\Constraints as Assert;\n\n#[AsResource(\n    alias: 'app.board_game',\n    section: 'admin',\n    formType: BoardGameType::class,\n    routePrefix: '/admin',\n    driver: false,\n)]\n#[Create]\n#[Update(\n    provider: BoardGameItemProvider::class,\n    processor: UpdateBoardGameProcessor::class,\n)]\n#[Index(\n    provider: BoardGameCollectionProvider::class,\n    grid: 'app_board_game',\n)]\n#[Show(\n    template: 'board_game/show.html.twig',\n    provider: BoardGameItemProvider::class,\n)]\n#[Delete(\n    provider: BoardGameItemProvider::class,\n    processor: DeleteBoardGameProcessor::class,\n)]\nfinal class BoardGameResource implements ResourceInterface\n{\n    public function __construct(\n        public ?AbstractUid $id = null,\n\n        #[Assert\\NotNull]\n        #[Assert\\Length(min: 1, max: 255)]\n        public ?string $name = null,\n    ) {\n    }\n\n    public static function fromModel(BoardGame $boardGame): static\n    {\n        return new self(\n            $boardGame->id()->value,\n            $boardGame->name()->value,\n        );\n    }\n\n    public function getId(): ?string\n    {\n        return $this->id?->__toString();\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Infrastructure/Sylius/Resource/Mutator/BoardGameTemplatesDirMutator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Infrastructure\\Sylius\\Resource\\Mutator;\n\nuse App\\BoardGameBlog\\Infrastructure\\Sylius\\Resource\\BoardGameResource;\nuse Sylius\\Resource\\Metadata\\AsResourceMutator;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Sylius\\Resource\\Metadata\\ResourceMutatorInterface;\n\n#[AsResourceMutator(BoardGameResource::class)]\nfinal class BoardGameTemplatesDirMutator implements ResourceMutatorInterface\n{\n    public function __invoke(ResourceMetadata $resource): ResourceMetadata\n    {\n        return $resource->withTemplatesDir('crud');\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Infrastructure/Sylius/Resource/Mutator/CreateBoardGameProcessorMutator.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Infrastructure\\Sylius\\Resource\\Mutator;\n\nuse App\\BoardGameBlog\\Infrastructure\\Sylius\\State\\Http\\Processor\\CreateBoardGameProcessor;\nuse Sylius\\Resource\\Metadata\\AsOperationMutator;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Metadata\\OperationMutatorInterface;\n\n#[AsOperationMutator('app_admin_board_game_create')]\nfinal class CreateBoardGameProcessorMutator implements OperationMutatorInterface\n{\n    public function __invoke(Operation $operation): Operation\n    {\n        return $operation->withProcessor(CreateBoardGameProcessor::class);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Infrastructure/Sylius/State/Http/Processor/CreateBoardGameProcessor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Infrastructure\\Sylius\\State\\Http\\Processor;\n\nuse App\\BoardGameBlog\\Application\\Command\\CreateBoardGameCommand;\nuse App\\BoardGameBlog\\Domain\\Model\\BoardGame;\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameName;\nuse App\\BoardGameBlog\\Infrastructure\\Sylius\\Resource\\BoardGameResource;\nuse App\\Shared\\Application\\Command\\CommandBusInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Webmozart\\Assert\\Assert;\n\nfinal class CreateBoardGameProcessor implements ProcessorInterface\n{\n    public function __construct(\n        private CommandBusInterface $commandBus,\n    ) {\n    }\n\n    /**\n     * @param BoardGameResource|mixed $data\n     */\n    public function process(mixed $data, Operation $operation, Context $context): BoardGameResource\n    {\n        Assert::isInstanceOf($data, BoardGameResource::class);\n\n        Assert::notNull($data->name);\n\n        $command = new CreateBoardGameCommand(\n            new BoardGameName($data->name),\n        );\n\n        /** @var BoardGame $model */\n        $model = $this->commandBus->dispatch($command);\n\n        return BoardGameResource::fromModel($model);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Infrastructure/Sylius/State/Http/Processor/DeleteBoardGameProcessor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Infrastructure\\Sylius\\State\\Http\\Processor;\n\nuse App\\BoardGameBlog\\Application\\Command\\DeleteBoardGameCommand;\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameId;\nuse App\\BoardGameBlog\\Infrastructure\\Sylius\\Resource\\BoardGameResource;\nuse App\\Shared\\Application\\Command\\CommandBusInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Webmozart\\Assert\\Assert;\n\nfinal class DeleteBoardGameProcessor implements ProcessorInterface\n{\n    public function __construct(\n        private CommandBusInterface $commandBus,\n    ) {\n    }\n\n    public function process(mixed $data, Operation $operation, Context $context): mixed\n    {\n        Assert::isInstanceOf($data, BoardGameResource::class);\n\n        $this->commandBus->dispatch(new DeleteBoardGameCommand(new BoardGameId($data->id)));\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Infrastructure/Sylius/State/Http/Processor/UpdateBoardGameProcessor.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Infrastructure\\Sylius\\State\\Http\\Processor;\n\nuse App\\BoardGameBlog\\Application\\Command\\UpdateBoardGameCommand;\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameId;\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameName;\nuse App\\BoardGameBlog\\Infrastructure\\Sylius\\Resource\\BoardGameResource;\nuse App\\Shared\\Application\\Command\\CommandBusInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ProcessorInterface;\nuse Webmozart\\Assert\\Assert;\n\nfinal class UpdateBoardGameProcessor implements ProcessorInterface\n{\n    public function __construct(\n        private CommandBusInterface $commandBus,\n    ) {\n    }\n\n    /**\n     * @param BoardGameResource|mixed $data\n     */\n    public function process(mixed $data, Operation $operation, Context $context): mixed\n    {\n        Assert::isInstanceOf($data, BoardGameResource::class);\n\n        $command = new UpdateBoardGameCommand(\n            new BoardGameId($data->id),\n            null !== $data->name ? new BoardGameName($data->name) : null,\n        );\n\n        $model = $this->commandBus->dispatch($command);\n\n        return BoardGameResource::fromModel($model);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Infrastructure/Sylius/State/Http/Provider/BoardGameCollectionProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Infrastructure\\Sylius\\State\\Http\\Provider;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Grid\\State\\RequestGridProvider;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ProviderInterface;\n\nfinal class BoardGameCollectionProvider implements ProviderInterface\n{\n    public function __construct(private RequestGridProvider $requestGridProvider)\n    {\n    }\n\n    public function provide(Operation $operation, Context $context): object|array|null\n    {\n        return $this->requestGridProvider->provide($operation, $context);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Infrastructure/Sylius/State/Http/Provider/BoardGameItemProvider.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Infrastructure\\Sylius\\State\\Http\\Provider;\n\nuse App\\BoardGameBlog\\Application\\Query\\FindBoardGameQuery;\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameId;\nuse App\\BoardGameBlog\\Infrastructure\\Sylius\\Resource\\BoardGameResource;\nuse App\\Shared\\Application\\Query\\QueryBusInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\RequestOption;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\State\\ProviderInterface;\nuse Symfony\\Component\\Uid\\Uuid;\nuse Webmozart\\Assert\\Assert;\n\nfinal class BoardGameItemProvider implements ProviderInterface\n{\n    public function __construct(\n        private QueryBusInterface $queryBus,\n    ) {\n    }\n\n    public function provide(Operation $operation, Context $context): object|array|null\n    {\n        $request = $context->get(RequestOption::class)?->request();\n        Assert::notNull($request);\n\n        $id = (string) $request->attributes->get('id');\n\n        $model = $this->queryBus->ask(new FindBoardGameQuery(new BoardGameId(Uuid::fromString($id))));\n\n        return null !== $model ? BoardGameResource::fromModel($model) : null;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/BoardGameBlog/Infrastructure/Symfony/Form/Type/BoardGameType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\BoardGameBlog\\Infrastructure\\Symfony\\Form\\Type;\n\nuse App\\BoardGameBlog\\Infrastructure\\Sylius\\Resource\\BoardGameResource;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolver;\n\nfinal class BoardGameType extends AbstractType\n{\n    public function buildForm(FormBuilderInterface $builder, array $options): void\n    {\n        $builder\n            ->add('name')\n        ;\n    }\n\n    public function configureOptions(OptionsResolver $resolver): void\n    {\n        $resolver->setDefaults([\n            'data_class' => BoardGameResource::class,\n        ]);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Conference/Entity/Speaker.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Conference\\Entity;\n\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\Validator\\Constraints\\NotBlank;\n\n#[ORM\\Entity]\nclass Speaker implements ResourceInterface\n{\n    public function __construct(\n        #[ORM\\Id]\n        #[ORM\\Column(type: 'integer', unique: true)]\n        #[ORM\\GeneratedValue(strategy: 'AUTO')]\n        public ?int $id = null,\n        #[NotBlank]\n        #[ORM\\Column]\n        public ?string $firstName = null,\n        #[NotBlank]\n        #[ORM\\Column]\n        public ?string $lastName = null,\n    ) {\n    }\n\n    public function getId(): ?int\n    {\n        return $this->id;\n    }\n\n    public function getFullName(): ?string\n    {\n        return $this->firstName . ' ' . $this->lastName;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Conference/Factory/SpeakerFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Conference\\Factory;\n\nuse App\\Conference\\Entity\\Speaker;\nuse Zenstruck\\Foundry\\Persistence\\PersistentObjectFactory;\n\n/**\n * @extends PersistentObjectFactory<Speaker>\n */\nfinal class SpeakerFactory extends PersistentObjectFactory\n{\n    public static function class(): string\n    {\n        return Speaker::class;\n    }\n\n    public function withFirstName(string $firstName): self\n    {\n        return $this->with(['firstName' => $firstName]);\n    }\n\n    public function withLastName(string $lastName): self\n    {\n        return $this->with(['lastName' => $lastName]);\n    }\n\n    protected function defaults(): array\n    {\n        return [\n            'firstName' => self::faker()->firstName(),\n            'lastName' => self::faker()->lastName(),\n        ];\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Conference/Form/SpeakerType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Conference\\Form;\n\nuse App\\Conference\\Entity\\Speaker;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolver;\n\nfinal class SpeakerType extends AbstractType\n{\n    public function buildForm(FormBuilderInterface $builder, array $options): void\n    {\n        $builder\n            ->add('firstName')\n            ->add('lastName')\n        ;\n    }\n\n    public function configureOptions(OptionsResolver $resolver): void\n    {\n        $resolver->setDefaults([\n            'data_class' => Speaker::class,\n        ]);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Conference/Grid/SpeakerGrid.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Conference\\Grid;\n\nuse App\\Conference\\Entity\\Speaker;\nuse Sylius\\Bundle\\GridBundle\\Builder\\Action\\CreateAction;\nuse Sylius\\Bundle\\GridBundle\\Builder\\Action\\DeleteAction;\nuse Sylius\\Bundle\\GridBundle\\Builder\\Action\\UpdateAction;\nuse Sylius\\Bundle\\GridBundle\\Builder\\ActionGroup\\ItemActionGroup;\nuse Sylius\\Bundle\\GridBundle\\Builder\\ActionGroup\\MainActionGroup;\nuse Sylius\\Bundle\\GridBundle\\Builder\\Field\\StringField;\nuse Sylius\\Bundle\\GridBundle\\Builder\\GridBuilderInterface;\nuse Sylius\\Bundle\\GridBundle\\Grid\\AbstractGrid;\nuse Sylius\\Bundle\\GridBundle\\Grid\\ResourceAwareGridInterface;\n\nfinal class SpeakerGrid extends AbstractGrid implements ResourceAwareGridInterface\n{\n    public static function getName(): string\n    {\n        return 'app_speaker';\n    }\n\n    public function buildGrid(GridBuilderInterface $gridBuilder): void\n    {\n        $gridBuilder\n            ->orderBy('fullName', 'asc')\n            ->setLimits([10, 25, 50])\n            ->addField(\n                StringField::create('fullName')\n                    ->setLabel('Name')\n                    ->setSortable(true, 'firstName'),\n            )\n            ->addActionGroup(\n                MainActionGroup::create(\n                    CreateAction::create(),\n                ),\n            )\n            ->addActionGroup(\n                ItemActionGroup::create(\n                    UpdateAction::create(),\n                    DeleteAction::create(),\n                ),\n            )\n        ;\n    }\n\n    public function getResourceClass(): string\n    {\n        return Speaker::class;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Controller/BookController.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Controller;\n\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceController;\n\nfinal class BookController extends ResourceController\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Author.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity;\n\nuse Doctrine\\ORM\\Mapping as ORM;\nuse JMS\\Serializer\\Annotation as Serializer;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[ORM\\Embeddable]\nfinal class Author\n{\n    #[Serializer\\Expose]\n    #[Serializer\\Type(name: 'string')]\n    #[ORM\\Column(name: 'first_name', length: 255)]\n    private ?string $firstName = null;\n\n    #[Serializer\\Expose]\n    #[Serializer\\Type(name: 'string')]\n    #[ORM\\Column(name: 'last_name', length: 255)]\n    private ?string $lastName = null;\n\n    public function getFirstName(): ?string\n    {\n        return $this->firstName;\n    }\n\n    public function setFirstName(?string $firstName): void\n    {\n        $this->firstName = $firstName;\n    }\n\n    public function getLastName(): ?string\n    {\n        return $this->lastName;\n    }\n\n    public function setLastName(?string $lastName): void\n    {\n        $this->lastName = $lastName;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/BlogPost.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity;\n\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\n#[ORM\\Entity]\n#[ORM\\MappedSuperclass]\n#[ORM\\Table(name: 'app_blog_post')]\nclass BlogPost implements ResourceInterface\n{\n    #[ORM\\Id]\n    #[ORM\\GeneratedValue]\n    #[ORM\\Column]\n    private ?int $id = null;\n\n    #[ORM\\Column]\n    private array $currentPlace = ['draft' => 1];\n\n    public function getId(): ?int\n    {\n        return $this->id;\n    }\n\n    public function getCurrentPlace(): array\n    {\n        return $this->currentPlace;\n    }\n\n    public function setCurrentPlace(array $currentPlace)\n    {\n        $this->currentPlace = $currentPlace;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Book.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity;\n\nuse Doctrine\\ORM\\Mapping as ORM;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Sylius\\Resource\\Model\\TranslatableInterface;\nuse Sylius\\Resource\\Model\\TranslatableTrait;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[ORM\\Entity]\n#[ORM\\MappedSuperclass]\n#[ORM\\Table(name: 'app_book')]\nclass Book implements ResourceInterface, TranslatableInterface\n{\n    use TranslatableTrait {\n        __construct as private initializeTranslationsCollection;\n    }\n\n    #[Serializer\\Expose]\n    #[Serializer\\Type(name: 'integer')]\n    #[Serializer\\XmlAttribute]\n    #[ORM\\Id]\n    #[ORM\\GeneratedValue]\n    #[ORM\\Column]\n    private ?int $id = null;\n\n    #[Serializer\\Expose]\n    #[Serializer\\Type(name: 'string')]\n    #[ORM\\Column(length: 255)]\n    private ?string $author = null;\n\n    public function getId(): ?int\n    {\n        return $this->id;\n    }\n\n    #[Serializer\\VirtualProperty]\n    #[Serializer\\SerializedName(name: 'title')]\n    public function getTitle(): ?string\n    {\n        return $this->getTranslation()->getTitle();\n    }\n\n    public function setTitle(?string $title): void\n    {\n        $this->getTranslation()->setTitle($title);\n    }\n\n    public function getAuthor(): ?string\n    {\n        return $this->author;\n    }\n\n    public function setAuthor(?string $author): void\n    {\n        $this->author = $author;\n    }\n\n    protected function createTranslation(): BookTranslation\n    {\n        return new BookTranslation();\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/BookTranslation.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity;\n\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Sylius\\Resource\\Model\\AbstractTranslation;\n\n#[ORM\\Entity]\n#[ORM\\MappedSuperclass]\n#[ORM\\Table(name: 'app_book_translation')]\nclass BookTranslation extends AbstractTranslation implements BookTranslationInterface\n{\n    #[ORM\\Id]\n    #[ORM\\GeneratedValue]\n    #[ORM\\Column]\n    protected ?int $id = null;\n\n    #[ORM\\Column(length: 255)]\n    protected ?string $title = null;\n\n    public function getId(): ?int\n    {\n        return $this->id;\n    }\n\n    public function getTitle(): ?string\n    {\n        return $this->title;\n    }\n\n    public function setTitle(?string $title): void\n    {\n        $this->title = $title;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/BookTranslationInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity;\n\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\ninterface BookTranslationInterface extends ResourceInterface\n{\n    public function getTitle(): ?string;\n\n    public function setTitle(?string $title): void;\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/ComicBook.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity;\n\nuse App\\Repository\\ComicBookRepository;\nuse Doctrine\\ORM\\Mapping as ORM;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[ORM\\Entity(repositoryClass: ComicBookRepository::class)]\n#[ORM\\MappedSuperclass]\n#[ORM\\Table(name: 'app_comic_book')]\nclass ComicBook implements ResourceInterface\n{\n    #[Serializer\\Expose]\n    #[Serializer\\Type(name: 'integer')]\n    #[Serializer\\XmlAttribute]\n    #[ORM\\Id]\n    #[ORM\\GeneratedValue]\n    #[ORM\\Column]\n    private ?int $id = null;\n\n    #[Serializer\\Expose]\n    #[Serializer\\Until(version: '1.1')]\n    #[ORM\\Embedded]\n    private ?Author $author = null;\n\n    #[Serializer\\Expose]\n    #[Serializer\\Type(name: 'string')]\n    #[ORM\\Column(length: 255)]\n    private ?string $title = null;\n\n    public function getId(): ?int\n    {\n        return $this->id;\n    }\n\n    public function getTitle(): ?string\n    {\n        return $this->title;\n    }\n\n    public function setTitle(?string $title): void\n    {\n        $this->title = $title;\n    }\n\n    #[Serializer\\VirtualProperty]\n    #[Serializer\\Since(version: '1.1')]\n    public function getAuthorFirstName(): ?string\n    {\n        return $this->author?->getFirstName();\n    }\n\n    #[Serializer\\VirtualProperty]\n    #[Serializer\\Since(version: '1.1')]\n    public function getAuthorLastName(): ?string\n    {\n        return $this->author?->getLastName();\n    }\n\n    public function getAuthor(): ?Author\n    {\n        return $this->author;\n    }\n\n    public function setAuthor(?Author $author): void\n    {\n        $this->author = $author;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/CrudRoutes/BookWithAlias.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\CrudRoutes;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusCrudRoutes;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusCrudRoutes(\n    alias: 'app.book',\n)]\nclass BookWithAlias extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/CrudRoutes/BookWithCriteria.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\CrudRoutes;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusCrudRoutes;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusCrudRoutes(\n    alias: 'app.book',\n    section: 'criteria',\n    criteria: ['library' => '$libraryId'],\n)]\nclass BookWithCriteria extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/CrudRoutes/BookWithExcept.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\CrudRoutes;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusCrudRoutes;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusCrudRoutes(\n    alias: 'app.book',\n    section: 'except',\n    except: ['show', 'create'],\n)]\nclass BookWithExcept extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/CrudRoutes/BookWithGrid.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\CrudRoutes;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusCrudRoutes;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusCrudRoutes(\n    alias: 'app.book',\n    section: 'grid',\n    grid: 'app_book',\n)]\nclass BookWithGrid extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/CrudRoutes/BookWithLegacyAttribute.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\CrudRoutes;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Component\\Resource\\Annotation\\SyliusCrudRoutes;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusCrudRoutes(\n    alias: 'app.book',\n    section: 'legacy_attribute',\n)]\nclass BookWithLegacyAttribute extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/CrudRoutes/BookWithOnly.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\CrudRoutes;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusCrudRoutes;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusCrudRoutes(\n    alias: 'app.book',\n    section: 'only',\n    only: ['index', 'update'],\n)]\nclass BookWithOnly extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/CrudRoutes/BookWithPermission.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\CrudRoutes;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusCrudRoutes;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusCrudRoutes(\n    alias: 'app.book',\n    section: 'permission',\n    permission: true,\n)]\nclass BookWithPermission extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/CrudRoutes/BookWithRedirect.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\CrudRoutes;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusCrudRoutes;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusCrudRoutes(\n    alias: 'app.book',\n    section: 'redirect',\n    redirect: 'update',\n)]\nclass BookWithRedirect extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/CrudRoutes/BookWithSection.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\CrudRoutes;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusCrudRoutes;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusCrudRoutes(\n    alias: 'app.book',\n    section: 'admin',\n)]\nclass BookWithSection extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/CrudRoutes/BookWithTemplate.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\CrudRoutes;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusCrudRoutes;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusCrudRoutes(\n    alias: 'app.book',\n    section: 'template',\n    templates: 'backend/crud',\n)]\nclass BookWithTemplate extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/CrudRoutes/BookWithVars.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\CrudRoutes;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusCrudRoutes;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusCrudRoutes(\n    alias: 'app.book',\n    section: 'vars',\n    vars: [\n        'all' => [\n            'subheader' => 'app.ui.manage_your_books',\n        ],\n        'index' => [\n            'icon' => 'book',\n        ],\n    ],\n)]\nclass BookWithVars extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/GedmoBaseExample.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity;\n\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Gedmo\\Mapping\\Annotation as Gedmo;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\n#[ORM\\MappedSuperclass]\nclass GedmoBaseExample implements ResourceInterface\n{\n    #[ORM\\Id]\n    #[ORM\\GeneratedValue]\n    #[ORM\\Column]\n    private ?int $id = null;\n\n    #[ORM\\Column]\n    #[Gedmo\\SortablePosition]\n    private ?int $position = null;\n\n    public function getId(): ?int\n    {\n        return $this->id;\n    }\n\n    public function getPosition(): ?int\n    {\n        return $this->position;\n    }\n\n    public function setPosition(?int $position): void\n    {\n        $this->position = $position;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/GedmoExtendedExample.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity;\n\nuse Doctrine\\ORM\\Mapping as ORM;\n\n#[ORM\\Entity]\nclass GedmoExtendedExample extends GedmoBaseExample\n{\n    #[ORM\\Column(length: 255)]\n    private ?string $extra = null;\n\n    public function getExtra(): ?string\n    {\n        return $this->extra;\n    }\n\n    public function setExtra(?string $extra): void\n    {\n        $this->extra = $extra;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/LegacyBook.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity;\n\nuse App\\Repository\\LegacyBookRepository;\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Sylius\\Component\\Resource\\Model\\ResourceInterface;\nuse Sylius\\Component\\Resource\\Model\\TranslatableInterface;\nuse Sylius\\Component\\Resource\\Model\\TranslatableTrait;\n\n#[ORM\\Entity(repositoryClass: LegacyBookRepository::class)]\n#[ORM\\MappedSuperclass]\n#[ORM\\Table(name: 'app_legacy_book')]\nclass LegacyBook implements ResourceInterface, TranslatableInterface\n{\n    use TranslatableTrait {\n        __construct as private initializeTranslationsCollection;\n    }\n\n    #[ORM\\Id]\n    #[ORM\\GeneratedValue]\n    #[ORM\\Column]\n    private ?int $id = null;\n\n    public function getId(): ?int\n    {\n        return $this->id;\n    }\n\n    protected function createTranslation(): LegacyBookTranslation\n    {\n        return new LegacyBookTranslation();\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/LegacyBookTranslation.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity;\n\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Sylius\\Component\\Resource\\Model\\AbstractTranslation;\nuse Sylius\\Component\\Resource\\Model\\ResourceInterface;\n\n#[ORM\\Entity]\n#[ORM\\MappedSuperclass]\n#[ORM\\Table(name: 'app_legacy_book_translation')]\nclass LegacyBookTranslation extends AbstractTranslation implements ResourceInterface\n{\n    #[ORM\\Id]\n    #[ORM\\GeneratedValue]\n    #[ORM\\Column]\n    protected ?int $id = null;\n\n    #[ORM\\Column(length: 255)]\n    protected ?string $title = null;\n\n    public function getId(): ?int\n    {\n        return $this->id;\n    }\n\n    public function getTitle(): ?string\n    {\n        return $this->title;\n    }\n\n    public function setTitle(?string $title): void\n    {\n        $this->title = $title;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/PullRequest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity;\n\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\n#[ORM\\Entity]\n#[ORM\\MappedSuperclass]\n#[ORM\\Table(name: 'app_pull_request')]\nclass PullRequest implements ResourceInterface\n{\n    #[ORM\\Id]\n    #[ORM\\GeneratedValue]\n    #[ORM\\Column]\n    private ?int $id = null;\n\n    #[ORM\\Column(length: 255)]\n    private string $currentPlace = 'start';\n\n    public function getId(): ?int\n    {\n        return $this->id;\n    }\n\n    public function getCurrentPlace(): string\n    {\n        return $this->currentPlace;\n    }\n\n    public function setCurrentPlace(string $currentPlace): void\n    {\n        $this->currentPlace = $currentPlace;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/PublishBook.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusRoute(\n    name: 'publish_book',\n    path: '/books/{id}',\n    methods: ['PATCH'],\n    controller: 'app.controller.book::applyStateMachineTransitionAction',\n    stateMachine: ['graph' => 'app_book', 'transition' => 'publish'],\n)]\nclass PublishBook extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/RegisterUserWithForm.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\User;\nuse App\\Form\\Type\\RegisterType;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[SyliusRoute(\n    name: 'register_user_with_form',\n    path: '/users/register',\n    methods: ['GET', 'POST'],\n    controller: 'app.controller.user:createAction',\n    form: RegisterType::class,\n)]\nfinal class RegisterUserWithForm extends User\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/RegisterUserWithFormOptions.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\User;\nuse App\\Form\\Type\\RegisterType;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[SyliusRoute(\n    name: 'register_user_with_form_options',\n    path: '/users/register',\n    methods: ['GET', 'POST'],\n    controller: 'app.controller.user:createAction',\n    form: [\n        'type' => RegisterType::class,\n        'options' => [\n            'validation_groups' => ['sylius', 'my_custom_group'],\n        ],\n    ],\n)]\nfinal class RegisterUserWithFormOptions extends User\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBook.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusRoute(\n    name: 'show_book',\n    path: '/book/{id}',\n    controller: 'app.controller.book::showAction',\n)]\nclass ShowBook extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithCriteria.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusRoute(\n    name: 'show_book_with_criteria',\n    path: '/library/{libraryId}/book/{id}',\n    controller: 'app.controller.book::showAction',\n    criteria: ['library' => '$libraryId'],\n)]\nclass ShowBookWithCriteria extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithCsrfProtection.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[SyliusRoute(\n    name: 'show_book_with_csrf_protection',\n    path: '/books/{id}',\n    methods: ['GET', 'POST'],\n    controller: 'app.controller.book::showAction',\n    csrfProtection: false,\n)]\nfinal class ShowBookWithCsrfProtection extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithGrid.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[SyliusRoute(\n    name: 'show_book_with_grid',\n    path: '/books/{id}',\n    methods: ['GET', 'POST'],\n    controller: 'app.controller.book::showAction',\n    grid: 'book',\n)]\nfinal class ShowBookWithGrid extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithHost.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusRoute(\n    name: 'show_book_with_host',\n    path: '/book/{id}',\n    controller: 'app.controller.book::showAction',\n    host: 'm.example.com',\n)]\nclass ShowBookWithHost extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithLegacyAttribute.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Component\\Resource\\Annotation\\SyliusRoute;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusRoute(\n    name: 'show_book_with_legacy_attribute',\n    path: '/book/{id}',\n    controller: 'app.controller.book::showAction',\n)]\nclass ShowBookWithLegacyAttribute extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithMethods.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusRoute(\n    name: 'show_book_with_methods',\n    path: '/book/{id}',\n    controller: 'app.controller.book::showAction',\n    methods: ['GET'],\n)]\nclass ShowBookWithMethods extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithOptions.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusRoute(\n    name: 'show_book_with_options',\n    path: '/book/{id}',\n    controller: 'app.controller.book::showAction',\n    options: ['utf8' => true],\n)]\nclass ShowBookWithOptions extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithPermission.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[SyliusRoute(\n    name: 'show_book_with_permission',\n    path: '/books/{id}',\n    methods: ['GET', 'POST'],\n    controller: 'app.controller.book::showAction',\n    permission: true,\n)]\nfinal class ShowBookWithPermission extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithPriority.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusRoute(\n    name: 'show_book_without_priority',\n    path: '/book/{id}',\n    controller: 'app.controller.book::showAction',\n)]\n#[SyliusRoute(\n    name: 'show_book_with_priority',\n    path: '/book/{id}',\n    controller: 'app.controller.book::showAction',\n    priority: 2,\n)]\nclass ShowBookWithPriority extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithRepository.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusRoute(\n    name: 'show_book_with_repository',\n    path: '/book/{id}',\n    controller: 'app.controller.book::showAction',\n    repository: [\n        'method' => 'findOneNewestByAuthor',\n        'arguments' => '[$author]',\n    ],\n)]\nclass ShowBookWithRepository extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithRequirements.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusRoute(\n    name: 'show_book_with_requirements',\n    path: '/book/{id}',\n    controller: 'app.controller.book::showAction',\n    requirements: ['id' => '\\d+'],\n)]\nclass ShowBookWithRequirements extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithSchemes.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusRoute(\n    name: 'show_book_with_schemes',\n    path: '/book/{id}',\n    controller: 'app.controller.book::showAction',\n    schemes: ['https'],\n)]\nclass ShowBookWithSchemes extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithSection.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[SyliusRoute(\n    name: 'show_book_with_section',\n    path: '/books/{id}',\n    methods: ['GET', 'POST'],\n    controller: 'app.controller.book::showAction',\n    section: 'admin',\n)]\nfinal class ShowBookWithSection extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithSerializationGroups.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusRoute(\n    name: 'show_book_with_serialization_groups',\n    path: '/book/{id}',\n    controller: 'app.controller.book::showAction',\n    serializationGroups: ['sylius'],\n)]\nclass ShowBookWithSerializationGroups extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithSerializationVersion.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusRoute(\n    name: 'show_book_with_serialization_version',\n    path: '/book/{id}',\n    controller: 'app.controller.book::showAction',\n    serializationVersion: '1.0',\n)]\nclass ShowBookWithSerializationVersion extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithTemplate.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusRoute(\n    name: 'show_book_with_template',\n    path: '/book/{id}',\n    controller: 'app.controller.book::showAction',\n    template: 'book/show.html.twig',\n)]\nclass ShowBookWithTemplate extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/ShowBookWithVars.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse JMS\\Serializer\\Annotation as Serializer;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[Serializer\\ExclusionPolicy(policy: 'ALL')]\n#[SyliusRoute(\n    name: 'show_book_with_vars',\n    path: '/book/{id}',\n    controller: 'app.controller.book::showAction',\n    vars: ['foo' => 'bar'],\n)]\nclass ShowBookWithVars extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/UpdateBookWithCustomEventName.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[SyliusRoute(\n    name: 'update_book_with_custom_event_name',\n    path: '/books/{id}',\n    methods: ['GET', 'PUT'],\n    controller: 'app.controller.book::updateAction',\n    event: 'customer_update',\n)]\nfinal class UpdateBookWithCustomEventName extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/UpdateBookWithRedirect.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[SyliusRoute(\n    name: 'update_book_with_redirect',\n    path: '/books/{id}',\n    methods: ['GET', 'POST'],\n    controller: 'app.controller.book::showAction',\n    redirect: 'referer',\n)]\nfinal class UpdateBookWithRedirect extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/UpdateBookWithRedirectOptions.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[SyliusRoute(\n    name: 'update_book_with_redirect_options',\n    path: '/genre/{genreId}/books/{id}',\n    methods: ['GET', 'PUT'],\n    controller: 'app.controller.book::updateAction',\n    redirect: [\n        'route' => 'app_genre_show',\n        'parameters' => ['id' => '$genreId'],\n    ],\n)]\nfinal class UpdateBookWithRedirectOptions extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Route/UpdateBookWithReturnContent.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Route;\n\nuse App\\Entity\\Book;\nuse Sylius\\Resource\\Annotation\\SyliusRoute;\n\n#[SyliusRoute(\n    name: 'update_book_with_return_content',\n    path: '/books/{id}',\n    methods: ['GET', 'PUT'],\n    controller: 'app.controller.book::updateAction',\n    returnContent: true,\n)]\nfinal class UpdateBookWithReturnContent extends Book\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/ScienceBook.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity;\n\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\n#[ORM\\Entity]\n#[ORM\\MappedSuperclass]\n#[ORM\\Table(name: 'app_science_book')]\nclass ScienceBook implements ResourceInterface\n{\n    #[ORM\\Id]\n    #[ORM\\GeneratedValue]\n    #[ORM\\Column]\n    private ?int $id = null;\n\n    #[ORM\\Embedded]\n    private ?Author $author = null;\n\n    #[ORM\\Column(length: 255)]\n    private ?string $title = null;\n\n    public function getId(): ?int\n    {\n        return $this->id;\n    }\n\n    public function getTitle(): ?string\n    {\n        return $this->title;\n    }\n\n    public function setTitle(?string $title): void\n    {\n        $this->title = $title;\n    }\n\n    public function getAuthorFirstName(): ?string\n    {\n        return $this->author?->getFirstName();\n    }\n\n    public function getAuthorLastName(): ?string\n    {\n        return $this->author?->getLastName();\n    }\n\n    public function getAuthor(): ?Author\n    {\n        return $this->author;\n    }\n\n    public function setAuthor(?Author $author): void\n    {\n        $this->author = $author;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/User.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity;\n\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\n#[ORM\\Entity]\n#[ORM\\MappedSuperclass]\n#[ORM\\Table(name: 'app_user')]\nclass User implements ResourceInterface\n{\n    #[ORM\\Id]\n    #[ORM\\GeneratedValue]\n    #[ORM\\Column]\n    private ?int $id = null;\n\n    #[ORM\\Column(length: 255)]\n    private ?string $username = null;\n\n    #[ORM\\Column(length: 255)]\n    private ?string $password = null;\n\n    public function getId(): ?int\n    {\n        return $this->id;\n    }\n\n    public function getUsername(): ?string\n    {\n        return $this->username;\n    }\n\n    public function setUsername(?string $username): void\n    {\n        $this->username = $username;\n    }\n\n    public function getPassword(): ?string\n    {\n        return $this->password;\n    }\n\n    public function setPassword(?string $password): void\n    {\n        $this->password = $password;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Zone/Zone.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Zone;\n\nuse Doctrine\\Common\\Collections\\Collection;\nuse Doctrine\\ORM\\Mapping as ORM;\n\n#[ORM\\Entity]\nclass Zone implements ZoneInterface\n{\n    #[ORM\\Id]\n    #[ORM\\GeneratedValue]\n    #[ORM\\Column]\n    private ?int $id = null;\n\n    #[ORM\\Column(length: 255)]\n    public ?string $code = null;\n\n    #[ORM\\Column(length: 255)]\n    public ?string $name = null;\n\n    #[Orm\\OneToMany(mappedBy: 'belongsTo', targetEntity: ZoneMemberInterface::class, orphanRemoval: true)]\n    public Collection $members;\n\n    public function getId(): ?int\n    {\n        return $this->id;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Zone/ZoneInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Zone;\n\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\ninterface ZoneInterface extends ResourceInterface\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Zone/ZoneMember.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Zone;\n\nuse Doctrine\\ORM\\Mapping as ORM;\n\n#[ORM\\Entity]\nclass ZoneMember implements ZoneMemberInterface\n{\n    #[ORM\\Id]\n    #[ORM\\GeneratedValue]\n    #[ORM\\Column]\n    private ?int $id = null;\n\n    #[ORM\\Column(length: 255)]\n    public ?string $code = null;\n\n    #[ORM\\ManyToOne(targetEntity: ZoneInterface::class, inversedBy: 'members')]\n    public ZoneInterface $belongsTo;\n\n    public function getId(): ?int\n    {\n        return $this->id;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Entity/Zone/ZoneMemberInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Entity\\Zone;\n\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\ninterface ZoneMemberInterface extends ResourceInterface\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Factory/BookFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Factory;\n\nuse Sylius\\Resource\\Exception\\UnexpectedTypeException;\nuse Sylius\\Resource\\Factory\\FactoryInterface;\nuse Sylius\\Resource\\Factory\\TranslatableFactoryInterface;\nuse Sylius\\Resource\\Model\\TranslatableInterface;\nuse Sylius\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface;\n\nfinal class BookFactory implements TranslatableFactoryInterface\n{\n    private FactoryInterface $factory;\n\n    private TranslationLocaleProviderInterface $localeProvider;\n\n    public function __construct(FactoryInterface $factory, TranslationLocaleProviderInterface $localeProvider)\n    {\n        $this->factory = $factory;\n        $this->localeProvider = $localeProvider;\n    }\n\n    public function createNew()\n    {\n        $book = $this->factory->createNew();\n\n        if (!$book instanceof TranslatableInterface) {\n            throw new UnexpectedTypeException($book, TranslatableInterface::class);\n        }\n\n        $book->setCurrentLocale($this->localeProvider->getDefaultLocaleCode());\n        $book->setFallbackLocale($this->localeProvider->getDefaultLocaleCode());\n\n        return $book;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Factory/BookFactoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Factory;\n\nuse Sylius\\Resource\\Factory\\TranslatableFactoryInterface;\n\ninterface BookFactoryInterface extends TranslatableFactoryInterface\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Factory/CustomBookFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Factory;\n\nuse App\\Entity\\Book;\nuse Sylius\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface;\n\nfinal class CustomBookFactory\n{\n    private string $className;\n\n    private TranslationLocaleProviderInterface $localeProvider;\n\n    public function __construct(string $className, TranslationLocaleProviderInterface $localeProvider)\n    {\n        $this->className = $className;\n        $this->localeProvider = $localeProvider;\n    }\n\n    public function createCustom(): Book\n    {\n        /** @var Book $book */\n        $book = new $this->className();\n\n        $book->setCurrentLocale($this->localeProvider->getDefaultLocaleCode());\n        $book->setFallbackLocale($this->localeProvider->getDefaultLocaleCode());\n\n        return $book;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Factory/LegacyBookFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Factory;\n\nuse Sylius\\Component\\Resource\\Exception\\UnexpectedTypeException;\nuse Sylius\\Component\\Resource\\Factory\\FactoryInterface;\nuse Sylius\\Component\\Resource\\Model\\TranslatableInterface;\nuse Sylius\\Component\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface;\n\nfinal class LegacyBookFactory implements BookFactoryInterface\n{\n    private FactoryInterface $factory;\n\n    private TranslationLocaleProviderInterface $localeProvider;\n\n    public function __construct(FactoryInterface $factory, TranslationLocaleProviderInterface $localeProvider)\n    {\n        $this->factory = $factory;\n        $this->localeProvider = $localeProvider;\n    }\n\n    public function createNew()\n    {\n        $book = $this->factory->createNew();\n\n        if (!$book instanceof TranslatableInterface) {\n            throw new UnexpectedTypeException($book, TranslatableInterface::class);\n        }\n\n        $book->setCurrentLocale($this->localeProvider->getDefaultLocaleCode());\n        $book->setFallbackLocale($this->localeProvider->getDefaultLocaleCode());\n\n        return $book;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Form/Type/AuthorType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Form\\Type;\n\nuse App\\Entity\\Author;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolver;\n\nfinal class AuthorType extends AbstractType\n{\n    public function buildForm(FormBuilderInterface $builder, array $options): void\n    {\n        $builder\n            ->add('firstName', TextType::class)\n            ->add('lastName', TextType::class)\n        ;\n    }\n\n    public function configureOptions(OptionsResolver $resolver): void\n    {\n        $resolver->setDefault('data_class', Author::class);\n        $resolver->setDefault('validation_groups', ['sylius']);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Form/Type/BlogPostType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Form\\Type;\n\nuse App\\Entity\\BlogPost;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolver;\n\nfinal class BlogPostType extends AbstractType\n{\n    public function buildForm(FormBuilderInterface $builder, array $options): void\n    {\n    }\n\n    public function configureOptions(OptionsResolver $resolver): void\n    {\n        $resolver\n            ->setDefaults([\n                'data_class' => BlogPost::class,\n            ])\n        ;\n    }\n\n    public function getBlockPrefix(): string\n    {\n        return 'app_blog_post';\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Form/Type/BookTranslationType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Form\\Type;\n\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\AbstractResourceType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\n\nfinal class BookTranslationType extends AbstractResourceType\n{\n    public function buildForm(FormBuilderInterface $builder, array $options): void\n    {\n        $builder->add('title', TextType::class);\n    }\n\n    public function getBlockPrefix(): string\n    {\n        return 'app_book_translation';\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Form/Type/BookType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Form\\Type;\n\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\AbstractResourceType;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\ResourceTranslationsType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\n\nfinal class BookType extends AbstractResourceType\n{\n    public function buildForm(FormBuilderInterface $builder, array $options): void\n    {\n        $builder\n            ->add('translations', ResourceTranslationsType::class, [\n                'entry_type' => BookTranslationType::class,\n                'label' => 'title',\n            ])\n            ->add('author', TextType::class)\n        ;\n    }\n\n    public function getBlockPrefix(): string\n    {\n        return 'app_book';\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Form/Type/PullRequestType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Form\\Type;\n\nuse App\\Entity\\PullRequest;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolver;\n\nfinal class PullRequestType extends AbstractType\n{\n    public function buildForm(FormBuilderInterface $builder, array $options): void\n    {\n    }\n\n    public function configureOptions(OptionsResolver $resolver): void\n    {\n        $resolver\n            ->setDefaults([\n                'data_class' => PullRequest::class,\n            ])\n        ;\n    }\n\n    public function getBlockPrefix(): string\n    {\n        return 'app_pull_request';\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Form/Type/RegisterType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Form\\Type;\n\nuse Symfony\\Component\\Form\\AbstractType;\n\nfinal class RegisterType extends AbstractType\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Form/Type/ScienceBookType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Form\\Type;\n\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\AbstractResourceType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\n\nfinal class ScienceBookType extends AbstractResourceType\n{\n    public function buildForm(FormBuilderInterface $builder, array $options): void\n    {\n        $builder\n            ->add('title', TextType::class)\n            ->add('author', AuthorType::class)\n        ;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Foundry/Factory/AuthorFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Foundry\\Factory;\n\nuse App\\Entity\\Author;\nuse Zenstruck\\Foundry\\ObjectFactory;\n\n/**\n * @extends ObjectFactory<Author>\n */\nfinal class AuthorFactory extends ObjectFactory\n{\n    public static function class(): string\n    {\n        return Author::class;\n    }\n\n    public function withFirstName(string $firstName): self\n    {\n        return $this->with(['firstName' => $firstName]);\n    }\n\n    public function withLastName(string $lastName): self\n    {\n        return $this->with(['lastName' => $lastName]);\n    }\n\n    protected function defaults(): array\n    {\n        return [\n            'firstName' => self::faker()->firstName(),\n            'lastName' => self::faker()->lastName(),\n        ];\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Foundry/Factory/BlogPostFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Foundry\\Factory;\n\nuse App\\Entity\\BlogPost;\nuse Zenstruck\\Foundry\\Persistence\\PersistentObjectFactory;\n\n/**\n * @extends PersistentObjectFactory<BlogPost>\n */\nfinal class BlogPostFactory extends PersistentObjectFactory\n{\n    public static function class(): string\n    {\n        return BlogPost::class;\n    }\n\n    public function onDraft(): self\n    {\n        return $this->with(['currentPlace' => ['draft' => 1]]);\n    }\n\n    public function reviewed(): self\n    {\n        return $this->with(['currentPlace' => ['reviewed' => 1]]);\n    }\n\n    protected function defaults(): array\n    {\n        return [];\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Foundry/Factory/BookFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Foundry\\Factory;\n\nuse App\\Entity\\Book;\nuse Zenstruck\\Foundry\\Persistence\\PersistentObjectFactory;\n\n/**\n * @extends PersistentObjectFactory<Book>\n */\nfinal class BookFactory extends PersistentObjectFactory\n{\n    public static function class(): string\n    {\n        return Book::class;\n    }\n\n    public function withTranslations(array $translations): self\n    {\n        return $this->with(['translations' => $translations]);\n    }\n\n    public function withTitle(string $title): self\n    {\n        return $this->with(['title' => $title]);\n    }\n\n    public function withAuthor(string $author): self\n    {\n        return $this->with(['author' => $author]);\n    }\n\n    protected function defaults(): array\n    {\n        return [\n            'fallbackLocale' => 'en_US',\n            'currentLocale' => 'en_US',\n            'author' => self::faker()->firstName() . ' ' . self::faker()->lastName(),\n        ];\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Foundry/Factory/BookTranslationFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Foundry\\Factory;\n\nuse App\\Entity\\BookTranslation;\nuse Zenstruck\\Foundry\\Persistence\\PersistentObjectFactory;\n\n/**\n * @extends PersistentObjectFactory<BookTranslation>\n */\nfinal class BookTranslationFactory extends PersistentObjectFactory\n{\n    public static function class(): string\n    {\n        return BookTranslation::class;\n    }\n\n    public function withLocale(string $locale): self\n    {\n        return $this->with(['locale' => $locale]);\n    }\n\n    public function withTitle(string $title): self\n    {\n        return $this->with(['title' => $title]);\n    }\n\n    protected function defaults(): array\n    {\n        return [\n            'locale' => self::faker()->locale(),\n            'title' => ucfirst(self::faker()->words(2, true)),\n        ];\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Foundry/Factory/ComicBookFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Foundry\\Factory;\n\nuse App\\Entity\\Author;\nuse App\\Entity\\ComicBook;\nuse Doctrine\\Persistence\\Proxy;\nuse Zenstruck\\Foundry\\LazyValue;\nuse Zenstruck\\Foundry\\Persistence\\PersistentObjectFactory;\n\n/**\n * @extends PersistentObjectFactory<ComicBook>\n */\nfinal class ComicBookFactory extends PersistentObjectFactory\n{\n    public static function class(): string\n    {\n        return ComicBook::class;\n    }\n\n    public function withTitle(string $title): self\n    {\n        return $this->with(['title' => $title]);\n    }\n\n    /**\n     * @param AuthorFactory|Proxy<Author> $author\n     */\n    public function withAuthor(AuthorFactory|Proxy $author): self\n    {\n        return $this->with(['author' => $author]);\n    }\n\n    protected function defaults(): array\n    {\n        $author = LazyValue::memoize(fn () => AuthorFactory::createOne());\n\n        return [\n            'title' => ucfirst(self::faker()->words(2, true)),\n            'author' => $author,\n        ];\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Foundry/Factory/PullRequestFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Foundry\\Factory;\n\nuse App\\Entity\\PullRequest;\nuse Zenstruck\\Foundry\\Persistence\\PersistentObjectFactory;\n\n/**\n * @extends PersistentObjectFactory<PullRequest>\n */\nfinal class PullRequestFactory extends PersistentObjectFactory\n{\n    public static function class(): string\n    {\n        return PullRequest::class;\n    }\n\n    public function withCurrentPlace(string $currentPlace): self\n    {\n        return $this->with(['currentPlace' => $currentPlace]);\n    }\n\n    protected function defaults(): array\n    {\n        return [\n            'currentPlace' => self::faker()->randomElement([\n                'start',\n                'coding',\n                'test',\n                'review',\n                'merged',\n                'closed',\n            ]),\n        ];\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Foundry/Factory/ScienceBookFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Foundry\\Factory;\n\nuse App\\Entity\\Author;\nuse App\\Entity\\ScienceBook;\nuse Doctrine\\Persistence\\Proxy;\nuse function Zenstruck\\Foundry\\lazy;\nuse Zenstruck\\Foundry\\Persistence\\PersistentObjectFactory;\n\n/**\n * @extends PersistentObjectFactory<ScienceBook>\n */\nfinal class ScienceBookFactory extends PersistentObjectFactory\n{\n    public static function class(): string\n    {\n        return ScienceBook::class;\n    }\n\n    public function withTitle(string $title): self\n    {\n        return $this->with(['title' => $title]);\n    }\n\n    /**\n     * @param AuthorFactory|Proxy<Author> $author\n     */\n    public function withAuthor(AuthorFactory|Proxy $author): self\n    {\n        return $this->with(['author' => $author]);\n    }\n\n    protected function defaults(): array\n    {\n        return [\n            'title' => ucfirst(self::faker()->words(2, true)),\n            'author' => lazy(fn () => AuthorFactory::new()),\n        ];\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Foundry/Story/DefaultBooksStory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Foundry\\Story;\n\nuse App\\Foundry\\Factory\\BookFactory;\nuse App\\Foundry\\Factory\\BookTranslationFactory;\nuse Zenstruck\\Foundry\\Story;\n\nfinal class DefaultBooksStory extends Story\n{\n    public function build(): void\n    {\n        BookFactory::new()\n            ->withTranslations([\n                BookTranslationFactory::new()\n                    ->withLocale('en_US')\n                    ->withTitle('Lord of The Rings'),\n                BookTranslationFactory::new()\n                    ->withLocale('pl_PL')\n                    ->withTitle('Władca Pierścieni'),\n            ])\n            ->withAuthor('J.R.R. Tolkien')\n            ->create()\n        ;\n\n        BookFactory::new()\n            ->withTitle('Game of Thrones')\n            ->withAuthor('George R. R. Martin')\n            ->create()\n        ;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Foundry/Story/DefaultComicBooksStory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Foundry\\Story;\n\nuse App\\Foundry\\Factory\\AuthorFactory;\nuse App\\Foundry\\Factory\\ComicBookFactory;\nuse Zenstruck\\Foundry\\Story;\n\nfinal class DefaultComicBooksStory extends Story\n{\n    public function build(): void\n    {\n        ComicBookFactory::new()\n            ->withTitle('Old Man Logan')\n            ->withAuthor(\n                AuthorFactory::new()\n                ->withFirstName('Andrea')\n                ->withLastName('Sorrentino'),\n            )\n            ->create()\n        ;\n\n        ComicBookFactory::new()\n            ->withTitle('Civil War II')\n            ->withAuthor(\n                AuthorFactory::new()\n                ->withFirstName('Brian Michael')\n                ->withLastName('Bendis'),\n            )\n            ->create()\n        ;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Foundry/Story/MoreBooksStory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Foundry\\Story;\n\nuse App\\Foundry\\Factory\\BookFactory;\nuse Zenstruck\\Foundry\\Story;\n\nfinal class MoreBooksStory extends Story\n{\n    public function build(): void\n    {\n        BookFactory::createSequence(\n            function () {\n                foreach (range(1, 22) as $number) {\n                    yield ['title' => 'Book ' . $number];\n                }\n            },\n        );\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Kernel.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App;\n\nuse App\\Shared\\Application\\Command\\CommandHandlerInterface;\nuse App\\Shared\\Application\\Query\\QueryHandlerInterface;\nuse FOS\\RestBundle\\FOSRestBundle;\nuse Gedmo\\Sluggable\\Util\\Urlizer;\nuse JMS\\SerializerBundle\\JMSSerializerBundle;\nuse Symfony\\Bundle\\FrameworkBundle\\Kernel\\MicroKernelTrait;\nuse Symfony\\Component\\Config\\FileLocator;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Loader\\YamlFileLoader;\nuse Symfony\\Component\\HttpKernel\\Kernel as BaseKernel;\nuse Symfony\\Component\\Workflow\\Registry;\nuse winzou\\Bundle\\StateMachineBundle\\winzouStateMachineBundle;\n\nclass Kernel extends BaseKernel\n{\n    use MicroKernelTrait;\n\n    protected function build(ContainerBuilder $container): void\n    {\n        $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../config'));\n\n        $container->registerForAutoconfiguration(QueryHandlerInterface::class)\n            ->addTag('messenger.message_handler', ['bus' => 'query.bus'])\n        ;\n\n        $container->registerForAutoconfiguration(CommandHandlerInterface::class)\n            ->addTag('messenger.message_handler', ['bus' => 'command.bus'])\n        ;\n\n        if (self::MAJOR_VERSION < 7) {\n            $container->prependExtensionConfig('security', [\n                'enable_authenticator_manager' => true,\n            ]);\n        }\n\n        if (class_exists(Urlizer::class)) {\n            $this->configureAppWithGedmoDoctrineExtensions($loader);\n        }\n\n        if (class_exists(FosRestBundle::class)) {\n            $this->configureAppWithFosRestBundle($loader);\n        }\n\n        if (class_exists(JMSSerializerBundle::class)) {\n            $this->configureAppWithJmsSerializerBundle($loader);\n        }\n\n        if (class_exists(winzouStateMachineBundle::class)) {\n            $this->configureAppWithWinzouStateMachine($loader, $container);\n        }\n\n        if (class_exists(Registry::class)) {\n            $this->configureAppWithSymfonyWorkflow($loader, $container);\n        }\n    }\n\n    private function configureAppWithGedmoDoctrineExtensions(YamlFileLoader $loader): void\n    {\n        $loader->load('services/integration/gedmo.yaml');\n    }\n\n    private function configureAppWithFosRestBundle(YamlFileLoader $loader): void\n    {\n        $loader->load('integration/fos_rest.yaml');\n    }\n\n    private function configureAppWithJmsSerializerBundle(YamlFileLoader $loader): void\n    {\n        $loader->load('integration/jms_serializer.yaml');\n    }\n\n    private function configureAppWithWinzouStateMachine(YamlFileLoader $loader, ContainerBuilder $container): void\n    {\n        $container->prependExtensionConfig('sylius_resource', [\n            'settings' => [\n                'state_machine_component' => 'winzou',\n            ],\n        ]);\n\n        $loader->load('integration/winzou_state_machine.yaml');\n    }\n\n    private function configureAppWithSymfonyWorkflow(YamlFileLoader $loader, ContainerBuilder $container): void\n    {\n        $container->prependExtensionConfig('sylius_resource', [\n            'settings' => [\n                'state_machine_component' => 'symfony',\n            ],\n        ]);\n\n        $loader->load('integration/symfony_workflow.yaml');\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Repository/BookRepository.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Repository;\n\nuse App\\Entity\\Book;\nuse Doctrine\\Bundle\\DoctrineBundle\\Repository\\ServiceEntityRepository;\nuse Doctrine\\Persistence\\ManagerRegistry;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\ResourceRepositoryTrait;\n\nfinal class BookRepository extends ServiceEntityRepository implements BookRepositoryInterface\n{\n    use ResourceRepositoryTrait;\n\n    public function __construct(ManagerRegistry $registry)\n    {\n        parent::__construct($registry, Book::class);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Repository/BookRepositoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Repository;\n\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\n\ninterface BookRepositoryInterface extends RepositoryInterface\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Repository/ComicBookRepository.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Repository;\n\nuse App\\Entity\\ComicBook;\nuse Doctrine\\Bundle\\DoctrineBundle\\Repository\\ServiceEntityRepository;\nuse Doctrine\\Persistence\\ManagerRegistry;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\ResourceRepositoryTrait;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\n\nfinal class ComicBookRepository extends ServiceEntityRepository implements RepositoryInterface\n{\n    use ResourceRepositoryTrait;\n\n    public function __construct(ManagerRegistry $registry)\n    {\n        parent::__construct($registry, ComicBook::class);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Repository/CustomBookRepository.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Repository;\n\nuse App\\Entity\\Book;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\n\nfinal class CustomBookRepository\n{\n    private RepositoryInterface $repository;\n\n    public function __construct(RepositoryInterface $repository)\n    {\n        $this->repository = $repository;\n    }\n\n    public function findCustomBook(string $author): ?Book\n    {\n        return $this->repository->findOneBy(['author' => $author]);\n    }\n\n    public function findCustomBooks(): iterable\n    {\n        return $this->repository->createPaginator();\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Repository/LegacyBookRepository.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Repository;\n\nuse App\\Entity\\LegacyBook;\nuse Doctrine\\Bundle\\DoctrineBundle\\Repository\\ServiceEntityRepository;\nuse Doctrine\\Persistence\\ManagerRegistry;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\ResourceRepositoryTrait;\nuse Sylius\\Component\\Resource\\Repository\\RepositoryInterface;\n\nfinal class LegacyBookRepository extends ServiceEntityRepository implements RepositoryInterface\n{\n    use ResourceRepositoryTrait;\n\n    public function __construct(ManagerRegistry $registry)\n    {\n        parent::__construct($registry, LegacyBook::class);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Repository/Tests/Tmp/.gitignore",
    "content": "Entity\n"
  },
  {
    "path": "tests/Application/src/Service/FirstAutowiredService.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Service;\n\nuse Doctrine\\Persistence\\ObjectManager;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Factory\\FactoryInterface;\n\nfinal class FirstAutowiredService\n{\n    public FactoryInterface $bookFactory;\n\n    public RepositoryInterface $bookRepository;\n\n    public ObjectManager $bookManager;\n\n    public function __construct(\n        FactoryInterface $bookFactory,\n        RepositoryInterface $bookRepository,\n        ObjectManager $bookManager,\n    ) {\n        $this->bookFactory = $bookFactory;\n        $this->bookRepository = $bookRepository;\n        $this->bookManager = $bookManager;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Service/LegacyAutowiredFactoryService.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Service;\n\nuse Sylius\\Component\\Resource\\Factory\\FactoryInterface;\n\nfinal class LegacyAutowiredFactoryService\n{\n    public function __construct(\n        private FactoryInterface $legacyBookFactory,\n    ) {\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Service/LegacyAutowiredRepositoryService.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Service;\n\nuse Sylius\\Component\\Resource\\Repository\\RepositoryInterface;\n\nfinal class LegacyAutowiredRepositoryService\n{\n    public function __construct(\n        private RepositoryInterface $legacyBookRepository,\n    ) {\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Service/LegacyAutowiredTranslatableFactoryService.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Service;\n\nuse Sylius\\Component\\Resource\\Factory\\TranslatableFactoryInterface;\n\nfinal class LegacyAutowiredTranslatableFactoryService\n{\n    public function __construct(\n        private TranslatableFactoryInterface $legacyBookFactory,\n    ) {\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Service/NoInterfaceAutowiredService.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Service;\n\nuse App\\Factory\\BookFactory;\nuse App\\Repository\\BookRepository;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\EntityRepository;\nuse Sylius\\Resource\\Factory\\Factory;\n\nfinal class NoInterfaceAutowiredService\n{\n    private BookFactory $bookFactory;\n\n    private BookRepository $bookRepository;\n\n    private Factory $comicBookFactory;\n\n    private EntityRepository $comicBookRepository;\n\n    public function __construct(\n        BookFactory $bookFactory,\n        BookRepository $bookRepository,\n        Factory $comicBookFactory,\n        EntityRepository $comicBookRepository,\n    ) {\n        $this->bookFactory = $bookFactory;\n        $this->bookRepository = $bookRepository;\n        $this->comicBookFactory = $comicBookFactory;\n        $this->comicBookRepository = $comicBookRepository;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Service/SecondAutowiredService.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Service;\n\nuse App\\Factory\\BookFactoryInterface;\nuse App\\Repository\\BookRepositoryInterface;\nuse Doctrine\\ORM\\EntityManagerInterface;\n\nfinal class SecondAutowiredService\n{\n    public BookFactoryInterface $bookFactory;\n\n    public BookRepositoryInterface $bookRepository;\n\n    public EntityManagerInterface $bookManager;\n\n    public function __construct(\n        BookFactoryInterface $bookFactory,\n        BookRepositoryInterface $bookRepository,\n        EntityManagerInterface $bookManager,\n    ) {\n        $this->bookFactory = $bookFactory;\n        $this->bookRepository = $bookRepository;\n        $this->bookManager = $bookManager;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Shared/Application/Command/CommandBusInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Shared\\Application\\Command;\n\ninterface CommandBusInterface\n{\n    public function dispatch(CommandInterface $command): mixed;\n}\n"
  },
  {
    "path": "tests/Application/src/Shared/Application/Command/CommandHandlerInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Shared\\Application\\Command;\n\ninterface CommandHandlerInterface\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Shared/Application/Command/CommandInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Shared\\Application\\Command;\n\ninterface CommandInterface\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Shared/Application/Query/QueryBusInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Shared\\Application\\Query;\n\ninterface QueryBusInterface\n{\n    public function ask(QueryInterface $query): mixed;\n}\n"
  },
  {
    "path": "tests/Application/src/Shared/Application/Query/QueryHandlerInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Shared\\Application\\Query;\n\ninterface QueryHandlerInterface\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Shared/Application/Query/QueryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Shared\\Application\\Query;\n\ninterface QueryInterface\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Shared/Domain/Repository/RepositoryInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Shared\\Domain\\Repository;\n\ninterface RepositoryInterface\n{\n}\n"
  },
  {
    "path": "tests/Application/src/Shared/Domain/ValueObject/AggregateRootId.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Shared\\Domain\\ValueObject;\n\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Symfony\\Component\\Uid\\AbstractUid;\nuse Symfony\\Component\\Uid\\Uuid;\n\ntrait AggregateRootId\n{\n    #[ORM\\Id]\n    #[ORM\\Column(name: 'id', type: 'uuid')]\n    public AbstractUid $value;\n\n    final public function __construct(?AbstractUid $value = null)\n    {\n        $this->value = $value ?? Uuid::v4();\n    }\n\n    public function __toString(): string\n    {\n        return (string) $this->value;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Shared/Infrastructure/Symfony/Messenger/MessengerCommandBus.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Shared\\Infrastructure\\Symfony\\Messenger;\n\nuse App\\Shared\\Application\\Command\\CommandBusInterface;\nuse App\\Shared\\Application\\Command\\CommandInterface;\nuse Symfony\\Component\\Messenger\\Exception\\HandlerFailedException;\nuse Symfony\\Component\\Messenger\\HandleTrait;\nuse Symfony\\Component\\Messenger\\MessageBusInterface;\n\nfinal class MessengerCommandBus implements CommandBusInterface\n{\n    use HandleTrait;\n\n    public function __construct(MessageBusInterface $commandBus)\n    {\n        $this->messageBus = $commandBus;\n    }\n\n    public function dispatch(CommandInterface $command): mixed\n    {\n        try {\n            return $this->handle($command);\n        } catch (HandlerFailedException $e) {\n            /** @var array{0: \\Throwable} $exceptions */\n            $exceptions = $e->getWrappedExceptions();\n\n            throw reset($exceptions);\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Shared/Infrastructure/Symfony/Messenger/MessengerQueryBus.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Shared\\Infrastructure\\Symfony\\Messenger;\n\nuse App\\Shared\\Application\\Query\\QueryBusInterface;\nuse App\\Shared\\Application\\Query\\QueryInterface;\nuse Symfony\\Component\\Messenger\\Exception\\HandlerFailedException;\nuse Symfony\\Component\\Messenger\\HandleTrait;\nuse Symfony\\Component\\Messenger\\MessageBusInterface;\n\nfinal class MessengerQueryBus implements QueryBusInterface\n{\n    use HandleTrait;\n\n    public function __construct(MessageBusInterface $queryBus)\n    {\n        $this->messageBus = $queryBus;\n    }\n\n    public function ask(QueryInterface $query): mixed\n    {\n        try {\n            return $this->handle($query);\n        } catch (HandlerFailedException $e) {\n            /** @var array{0: \\Throwable} $exceptions */\n            $exceptions = $e->getWrappedExceptions();\n\n            throw reset($exceptions);\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Shared/Infrastructure/Twig/SyliusStateMachineExtension.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Shared\\Infrastructure\\Twig;\n\nuse SM\\Factory\\FactoryInterface;\nuse Symfony\\Component\\Workflow\\Registry;\nuse Twig\\Extension\\AbstractExtension;\nuse Twig\\TwigFunction;\n\nfinal class SyliusStateMachineExtension extends AbstractExtension\n{\n    public function __construct(\n        private ?Registry $workflowRegistry = null,\n        private ?FactoryInterface $factory = null,\n    ) {\n    }\n\n    public function getFunctions(): array\n    {\n        return [\n            new TwigFunction('sylius_state_machine_can', $this->canTransition(...)),\n        ];\n    }\n\n    public function canTransition(object $subject, string $transitionName, ?string $name = null): bool\n    {\n        if (null !== $this->factory) {\n            return $this->factory->get($subject, $name ?? 'default')->can($transitionName);\n        }\n\n        if (null !== $this->workflowRegistry) {\n            return $this->workflowRegistry->get($subject, $name)->can($subject, $transitionName);\n        }\n\n        return false;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Subscription/Entity/Subscription.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Subscription\\Entity;\n\nuse App\\Subscription\\Form\\Type\\SubscriptionType;\nuse App\\Subscription\\Twig\\Context\\Factory\\ShowSubscriptionContextFactory;\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Sylius\\Resource\\Metadata\\Api;\nuse Sylius\\Resource\\Metadata\\ApplyStateMachineTransition;\nuse Sylius\\Resource\\Metadata\\AsResource;\nuse Sylius\\Resource\\Metadata\\BulkDelete;\nuse Sylius\\Resource\\Metadata\\BulkUpdate;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Delete;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Show;\nuse Sylius\\Resource\\Metadata\\Update;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\Serializer\\Attribute\\Groups;\nuse Symfony\\Component\\Validator\\Constraints as Assert;\n\n#[AsResource(\n    section: 'admin',\n    formType: SubscriptionType::class,\n    templatesDir: 'crud',\n    routePrefix: '/admin',\n)]\n#[Index(grid: 'app_subscription')]\n#[Index(shortName: 'withoutGrid', template: 'crud/index.html.twig')]\n#[Create]\n#[Update]\n#[Delete]\n#[BulkDelete]\n#[ApplyStateMachineTransition(stateMachineTransition: 'accept', stateMachineGraph: 'subscription')]\n#[ApplyStateMachineTransition(stateMachineTransition: 'reject', stateMachineGraph: 'subscription')]\n#[BulkUpdate(\n    shortName: 'bulk_accept',\n    stateMachineTransition: 'accept',\n    stateMachineGraph: 'subscription',\n)]\n#[Show(\n    template: 'subscription/show.html.twig',\n    twigContextFactory: ShowSubscriptionContextFactory::class,\n)]\n\n#[AsResource(\n    alias: 'app.subscription',\n    section: 'ajax',\n    routePrefix: '/ajax',\n    normalizationContext: ['groups' => 'subscription:read'],\n    denormalizationContext: ['groups' => 'subscription:write'],\n)]\n#[Api\\GetCollection]\n#[Api\\Post]\n#[Api\\Put]\n#[Api\\Delete]\n#[Api\\Get]\n\n#[ORM\\Entity(repositoryClass: SubscriptionRepository::class)]\nclass Subscription implements ResourceInterface\n{\n    #[ORM\\Column(type: 'string')]\n    #[Groups(['subscription:read'])]\n    public string $state = 'new';\n\n    public function __construct(\n        #[ORM\\Id]\n        #[ORM\\Column(type: 'integer', unique: true)]\n        #[ORM\\GeneratedValue(strategy: 'AUTO')]\n        public ?int $id = null,\n\n        #[Assert\\NotBlank]\n        #[Assert\\Email]\n        #[ORM\\Column(name: 'name', nullable: false)]\n        #[Groups(['subscription:read', 'subscription:write'])]\n        public ?string $email = null,\n    ) {\n    }\n\n    public function getId(): ?int\n    {\n        return $this->id;\n    }\n\n    public function getState(): string\n    {\n        return $this->state;\n    }\n\n    public function setState(string $currentState): void\n    {\n        $this->state = $currentState;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Subscription/Entity/SubscriptionRepository.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Subscription\\Entity;\n\nuse Doctrine\\Bundle\\DoctrineBundle\\Repository\\ServiceEntityRepository;\nuse Doctrine\\Persistence\\ManagerRegistry;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\CreatePaginatorTrait;\n\nfinal class SubscriptionRepository extends ServiceEntityRepository\n{\n    use CreatePaginatorTrait;\n\n    public function __construct(\n        public readonly ManagerRegistry $registry,\n    ) {\n        parent::__construct($this->registry, Subscription::class);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Subscription/EventSubscriber/SmokeSubscriptionEventsSubscriber.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Subscription\\EventSubscriber;\n\nuse Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\GenericEvent;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\OperationEvent;\nuse Symfony\\Component\\EventDispatcher\\EventSubscriberInterface;\nuse Symfony\\Component\\EventDispatcher\\GenericEvent as SymfonyGenericEvent;\n\nfinal class SmokeSubscriptionEventsSubscriber implements EventSubscriberInterface\n{\n    public static function getSubscribedEvents(): array\n    {\n        return [\n            'app.subscription.show' => 'smokeShowEvent',\n            'app.subscription.index' => 'smokeIndexEvent',\n            'app.subscription.pre_create' => 'smokePreEvent',\n            'app.subscription.post_create' => 'smokePostEvent',\n            'app.subscription.pre_update' => 'smokePreEvent',\n            'app.subscription.post_update' => 'smokePostEvent',\n            'app.subscription.pre_delete' => 'smokePreEvent',\n            'app.subscription.post_delete' => 'smokePostEvent',\n            'app.subscription.bulk_delete' => 'smokeBulkEvent',\n        ];\n    }\n\n    public function smokeShowEvent(SymfonyGenericEvent $event): void\n    {\n    }\n\n    public function smokeIndexEvent(ResourceControllerEvent $event): void\n    {\n    }\n\n    public function smokePreEvent(GenericEvent $event): void\n    {\n    }\n\n    public function smokePostEvent(OperationEvent $event): void\n    {\n    }\n\n    public function smokeBulkEvent(OperationEvent $event): void\n    {\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Subscription/Factory/SubscriptionFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Subscription\\Factory;\n\nuse App\\Subscription\\Entity\\Subscription;\nuse Sylius\\Resource\\Factory\\FactoryInterface;\n\nfinal class SubscriptionFactory implements FactoryInterface\n{\n    public function createNew(): Subscription\n    {\n        return new Subscription(email: 'new@example.com');\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Subscription/Form/Type/SubscriptionType.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Subscription\\Form\\Type;\n\nuse App\\Subscription\\Entity\\Subscription;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolver;\n\nfinal class SubscriptionType extends AbstractType\n{\n    public function buildForm(FormBuilderInterface $builder, array $options): void\n    {\n        $builder\n            ->add('email')\n        ;\n    }\n\n    public function configureOptions(OptionsResolver $resolver): void\n    {\n        $resolver->setDefaults([\n            'data_class' => Subscription::class,\n        ]);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Subscription/Foundry/Factory/SubscriptionFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Subscription\\Foundry\\Factory;\n\nuse App\\Subscription\\Entity\\Subscription;\nuse Zenstruck\\Foundry\\Persistence\\PersistentObjectFactory;\n\n/**\n * @extends PersistentObjectFactory<Subscription>\n */\nfinal class SubscriptionFactory extends PersistentObjectFactory\n{\n    public static function class(): string\n    {\n        return Subscription::class;\n    }\n\n    public function withEmail(string $email): self\n    {\n        return $this->with(['email' => $email]);\n    }\n\n    public function accepted(): self\n    {\n        return $this->with(['state' => 'accepted']);\n    }\n\n    protected function defaults(): array\n    {\n        return [\n            'email' => self::faker()->email(),\n        ];\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Subscription/Foundry/Story/DefaultSubscriptionsStory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Subscription\\Foundry\\Story;\n\nuse App\\Subscription\\Foundry\\Factory\\SubscriptionFactory;\nuse function Zenstruck\\Foundry\\Persistence\\flush_after;\nuse Zenstruck\\Foundry\\Story;\n\nfinal class DefaultSubscriptionsStory extends Story\n{\n    public function build(): void\n    {\n        flush_after(function () {\n            SubscriptionFactory::new()\n                ->withEmail('marty.mcfly@bttf.com')\n                ->create()\n            ;\n\n            SubscriptionFactory::new()\n                ->withEmail('doc.brown@bttf.com')\n                ->create()\n            ;\n\n            SubscriptionFactory::new()\n                ->withEmail('biff.tannen@bttf.com')\n                ->accepted()\n                ->create()\n            ;\n\n            SubscriptionFactory::new()\n                ->withEmail('lorraine.baines@bttf.com')\n                ->create()\n            ;\n\n            SubscriptionFactory::new()\n                ->withEmail('george.mcfly@bttf.com')\n                ->create()\n            ;\n\n            SubscriptionFactory::new()\n                ->withEmail('jennifer.parker@bttf.com')\n                ->create()\n            ;\n        });\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Subscription/Grid/SubscriptionGrid.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Subscription\\Grid;\n\nuse App\\Subscription\\Entity\\Subscription;\nuse Sylius\\Bundle\\GridBundle\\Builder\\Action\\Action;\nuse Sylius\\Bundle\\GridBundle\\Builder\\Action\\CreateAction;\nuse Sylius\\Bundle\\GridBundle\\Builder\\Action\\DeleteAction;\nuse Sylius\\Bundle\\GridBundle\\Builder\\Action\\ShowAction;\nuse Sylius\\Bundle\\GridBundle\\Builder\\Action\\UpdateAction;\nuse Sylius\\Bundle\\GridBundle\\Builder\\ActionGroup\\BulkActionGroup;\nuse Sylius\\Bundle\\GridBundle\\Builder\\ActionGroup\\ItemActionGroup;\nuse Sylius\\Bundle\\GridBundle\\Builder\\ActionGroup\\MainActionGroup;\nuse Sylius\\Bundle\\GridBundle\\Builder\\Field\\StringField;\nuse Sylius\\Bundle\\GridBundle\\Builder\\GridBuilderInterface;\nuse Sylius\\Bundle\\GridBundle\\Grid\\AbstractGrid;\nuse Sylius\\Bundle\\GridBundle\\Grid\\ResourceAwareGridInterface;\n\nfinal class SubscriptionGrid extends AbstractGrid implements ResourceAwareGridInterface\n{\n    public static function getName(): string\n    {\n        return 'app_subscription';\n    }\n\n    public function buildGrid(GridBuilderInterface $gridBuilder): void\n    {\n        $gridBuilder\n            ->orderBy('email', 'asc')\n            ->setLimits([5, 3, 10])\n            ->addField(\n                StringField::create('email')\n                    ->setLabel('Email')\n                    ->setSortable(true),\n            )\n            ->addActionGroup(\n                MainActionGroup::create(\n                    CreateAction::create(),\n                ),\n            )\n            ->addActionGroup(\n                ItemActionGroup::create(\n                    ShowAction::create(),\n                    UpdateAction::create(),\n                    DeleteAction::create(),\n                    Action::create('accept', 'apply_transition')\n                        ->setLabel('Accept')\n                        ->setOptions([\n                            'link' => [\n                                'route' => 'app_admin_subscription_accept',\n                                'parameters' => [\n                                    'id' => 'resource.id',\n                                ],\n                            ],\n                            'class' => 'green',\n                            'transition' => 'accept',\n                            'graph' => 'subscription',\n                        ]),\n                ),\n            )\n            ->addActionGroup(\n                BulkActionGroup::create(\n                    DeleteAction::create(),\n                    Action::create('accept', 'apply_transition')\n                        ->setLabel('Bulk accept')\n                        ->setOptions([\n                            'link' => [\n                                'route' => 'app_admin_subscription_bulk_accept',\n                            ],\n                            'class' => 'green',\n                            'transition' => 'accept',\n                            'graph' => 'subscription',\n                        ]),\n                ),\n            )\n        ;\n    }\n\n    public function getResourceClass(): string\n    {\n        return Subscription::class;\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Subscription/Twig/Context/Factory/ShowSubscriptionContextFactory.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Subscription\\Twig\\Context\\Factory;\n\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Twig\\Context\\Factory\\ContextFactoryInterface;\n\nfinal class ShowSubscriptionContextFactory implements ContextFactoryInterface\n{\n    public function __construct(private ContextFactoryInterface $decorated)\n    {\n    }\n\n    public function create(mixed $data, Operation $operation, Context $context): array\n    {\n        return array_merge($this->decorated->create($data, $operation, $context), [\n            'foo' => 'bar',\n        ]);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Tests/Controller/BlogPostApiTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Tests\\Controller;\n\nuse App\\Foundry\\Factory\\BlogPostFactory;\nuse FOS\\RestBundle\\FOSRestBundle;\nuse PHPUnit\\Framework\\Attributes\\Test;\nuse Sylius\\Bundle\\ResourceBundle\\ResourceBundleInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Tests\\ApiTestCase;\nuse Zenstruck\\Foundry\\Attribute\\ResetDatabase;\n\n#[ResetDatabase]\nfinal class BlogPostApiTest extends ApiTestCase\n{\n    protected function setUp(): void\n    {\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n    }\n\n    #[Test]\n    public function it_allows_creating_a_blog_post(): void\n    {\n        $this->markAsSkippedIfBcLayerIsEnabled();\n        $this->markAsSkippedIfCurrentStateMachineIsNotTheSymfonyOne();\n\n        $this->client->request('POST', 'blog-posts', [], [], ['CONTENT_TYPE' => 'application/json'], '{}');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_CREATED);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"current_place\": {\n                    \"draft\": 1\n                }\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_creating_a_blog_post_with_bc_layer(): void\n    {\n        $this->markAsSkippedIfBcLayerIsNotEnabled();\n        $this->markAsSkippedIfCurrentStateMachineIsNotTheSymfonyOne();\n\n        $this->client->request('POST', '/blog-posts/', [], [], ['CONTENT_TYPE' => 'application/json'], '{}');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_CREATED);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"current_place\": {\n                    \"draft\": 1\n                }\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_reviewing_a_blog_post(): void\n    {\n        $this->markAsSkippedIfCurrentStateMachineIsNotTheSymfonyOne();\n\n        $blogPost = BlogPostFactory::new()\n            ->onDraft()\n            ->create()\n        ;\n\n        $this->client->request('PUT', '/blog-posts/' . $blogPost->getId() . '/to_review', [], [], ['CONTENT_TYPE' => 'application/json'], '{}');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"current_place\": {\n                    \"reviewed\": 1\n                }\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_publishing_a_blog_post(): void\n    {\n        $this->markAsSkippedIfCurrentStateMachineIsNotTheSymfonyOne();\n\n        $blogPost = BlogPostFactory::new()\n            ->reviewed()\n            ->create()\n        ;\n\n        $this->client->request('PUT', '/blog-posts/' . $blogPost->getId() . '/publish', [], [], ['CONTENT_TYPE' => 'application/json'], '{}');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"current_place\": {\n                    \"published\": 1\n                }\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_rejecting_a_blog_post(): void\n    {\n        $this->markAsSkippedIfCurrentStateMachineIsNotTheSymfonyOne();\n\n        $blogPost = BlogPostFactory::new()\n            ->reviewed()\n            ->create()\n        ;\n\n        $this->client->request('PUT', '/blog-posts/' . $blogPost->getId() . '/reject', [], [], ['CONTENT_TYPE' => 'application/json'], '{}');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"current_place\": {\n                    \"rejected\": 1\n                }\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_does_not_allow_to_publish_a_blog_post_with_draft_status(): void\n    {\n        $this->markAsSkippedIfCurrentStateMachineIsNotTheSymfonyOne();\n\n        $blogPost = BlogPostFactory::new()\n            ->onDraft()\n            ->create()\n        ;\n\n        $this->client->request('PUT', '/blog-posts/' . $blogPost->getId() . '/publish', [], [], ['CONTENT_TYPE' => 'application/json'], '{}');\n\n        $this->assertResponseStatusCodeSame(Response::HTTP_BAD_REQUEST);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n    }\n\n    #[Test]\n    public function it_does_not_allow_to_reject_a_blog_post_with_draft_status(): void\n    {\n        $this->markAsSkippedIfCurrentStateMachineIsNotTheSymfonyOne();\n\n        $blogPost = BlogPostFactory::new()\n            ->onDraft()\n            ->create()\n        ;\n\n        $this->client->request('PUT', '/blog-posts/' . $blogPost->getId() . '/reject', [], [], ['CONTENT_TYPE' => 'application/json'], '{}');\n\n        $this->assertResponseStatusCodeSame(Response::HTTP_BAD_REQUEST);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n    }\n\n    private function markAsSkippedIfCurrentStateMachineIsNotTheSymfonyOne(): void\n    {\n        $container = self::getContainer();\n\n        $stateMachine = $container->getParameter('sylius.resource.settings')['state_machine_component'];\n\n        if (ResourceBundleInterface::STATE_MACHINE_SYMFONY !== $stateMachine) {\n            $this->markTestSkipped();\n        }\n    }\n\n    private function markAsSkippedIfFosRestBundleIsNotAvailable(): void\n    {\n        if (!class_exists(FOSRestBundle::class)) {\n            $this->markTestSkipped('FriendsOfSymfony Rest Bundle is not installed.');\n        }\n    }\n\n    private function isRoutingPathBcLayerEnabled(): bool\n    {\n        return (bool) $this->getContainer()->getParameter('sylius.routing_path_bc_layer');\n    }\n\n    private function markAsSkippedIfBcLayerIsEnabled(): void\n    {\n        if ($this->isRoutingPathBcLayerEnabled()) {\n            $this->markTestSkipped('This test requires The BC layer to be disabled.');\n        }\n    }\n\n    private function markAsSkippedIfBcLayerIsNotEnabled(): void\n    {\n        if (!$this->isRoutingPathBcLayerEnabled()) {\n            $this->markTestSkipped('This test requires The BC layer to be enabled.');\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Tests/Controller/BoardGameUiTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Tests\\Controller;\n\nuse App\\BoardGameBlog\\Domain\\Model\\BoardGame;\nuse App\\BoardGameBlog\\Domain\\Repository\\BoardGameRepositoryInterface;\nuse App\\BoardGameBlog\\Domain\\ValueObject\\BoardGameName;\nuse App\\BoardGameBlog\\Infrastructure\\Foundry\\Factory\\BoardGameFactory;\nuse PHPUnit\\Framework\\Attributes\\Test;\nuse Symfony\\Bundle\\FrameworkBundle\\KernelBrowser;\nuse Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Zenstruck\\Foundry\\Attribute\\ResetDatabase;\nuse function Zenstruck\\Foundry\\Persistence\\refresh;\n\n#[ResetDatabase]\nfinal class BoardGameUiTest extends WebTestCase\n{\n    private KernelBrowser $client;\n\n    protected function setUp(): void\n    {\n        $this->client = self::createClient();\n    }\n\n    #[Test]\n    public function it_allows_showing_a_board_game(): void\n    {\n        $boardGame = BoardGameFactory::new()\n            ->withName(new BoardGameName('Ticket to Ride'))\n            ->create()\n        ;\n\n        $this->client->request('GET', '/admin/board-games/' . $boardGame->id());\n        $response = $this->client->getResponse();\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $content = $response->getContent();\n        $this->assertStringContainsString(sprintf('ID: %s', $boardGame->id()), $content);\n        $this->assertStringContainsString('Name: Ticket to Ride', $content);\n    }\n\n    #[Test]\n    public function it_allows_browsing_board_games(): void\n    {\n        $stoneAgeBoardGame = BoardGameFactory::new()\n            ->withName(new BoardGameName('Stone Age'))\n            ->create()\n        ;\n\n        $ticketToRideBoardGame = BoardGameFactory::new()\n            ->withName(new BoardGameName('Ticket to Ride'))\n            ->create()\n        ;\n\n        $this->client->request('GET', '/admin/board-games');\n        $response = $this->client->getResponse();\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $content = $response->getContent();\n\n        $this->assertStringContainsString('<td>Stone Age</td>', $content);\n        $this->assertStringContainsString(sprintf('<a href=\"/admin/board-games/%s\">Show</a>', $stoneAgeBoardGame->id()), $content);\n        $this->assertStringContainsString(sprintf('<a href=\"/admin/board-games/%s/edit\">Edit</a>', $stoneAgeBoardGame->id()), $content);\n        $this->assertStringContainsString(sprintf('<form action=\"/admin/board-games/%s/delete\" method=\"post\">', $stoneAgeBoardGame->id()), $content);\n\n        $this->assertStringContainsString('<td>Ticket to Ride</td>', $content);\n        $this->assertStringContainsString(sprintf('<a href=\"/admin/board-games/%s\">Show</a>', $ticketToRideBoardGame->id()), $content);\n        $this->assertStringContainsString(sprintf('<a href=\"/admin/board-games/%s/edit\">Edit</a>', $ticketToRideBoardGame->id()), $content);\n        $this->assertStringContainsString(sprintf('<form action=\"/admin/board-games/%s/delete\" method=\"post\">', $ticketToRideBoardGame->id()), $content);\n    }\n\n    #[Test]\n    public function it_allows_accessing_board_game_creation_page(): void\n    {\n        $this->client->request('GET', '/admin/board-games/new');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n    }\n\n    #[Test]\n    public function it_allows_creating_a_board_game(): void\n    {\n        $this->client->request('GET', '/admin/board-games/new');\n        $this->client->submitForm('Create', [\n            'board_game[name]' => 'Puerto Rico',\n        ]);\n\n        $this->assertResponseRedirects(null, expectedCode: Response::HTTP_FOUND);\n\n        /** @var BoardGame $boardGame */\n        $boardGame = static::getContainer()->get(BoardGameRepositoryInterface::class)->findOneBy(['name.value' => 'Puerto Rico']);\n\n        $this->assertNotNull($boardGame);\n        $this->assertSame('Puerto Rico', (string) $boardGame->name());\n    }\n\n    #[Test]\n    public function it_does_not_allow_to_create_a_board_game_if_there_is_a_validation_error(): void\n    {\n        $this->client->request('GET', '/admin/board-games/new');\n        $this->client->submitForm('Create', [\n            'board_game[name]' => null,\n        ]);\n\n        $this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);\n    }\n\n    #[Test]\n    public function it_allows_updating_a_board_game(): void\n    {\n        $boardGame = BoardGameFactory::createOne();\n\n        $this->client->request('GET', '/admin/board-games/' . $boardGame->id() . '/edit');\n        $this->client->submitForm('Save changes', [\n            'board_game[name]' => 'Puerto Rico',\n        ]);\n\n        $this->assertResponseRedirects(null, expectedCode: Response::HTTP_FOUND);\n\n        $boardGame = refresh($boardGame);\n        $this->assertSame('Puerto Rico', (string) $boardGame->name());\n    }\n\n    #[Test]\n    public function it_does_not_allow_to_update_a_board_game_if_there_is_a_validation_error(): void\n    {\n        $boardGame = BoardGameFactory::createOne();\n\n        $this->client->request('GET', '/admin/board-games/' . $boardGame->id() . '/edit');\n        $this->client->submitForm('Save changes', [\n            'board_game[name]' => null,\n        ]);\n\n        $this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);\n    }\n\n    #[Test]\n    public function it_allows_deleting_a_board_game(): void\n    {\n        BoardGameFactory::createOne();\n\n        $this->client->request('GET', '/admin/board-games');\n        $this->client->submitForm('Delete');\n\n        $this->assertResponseRedirects(null, expectedCode: Response::HTTP_FOUND);\n\n        /** @var BoardGame[] $boardGames */\n        $boardGames = static::getContainer()->get(BoardGameRepositoryInterface::class)->findAll();\n\n        $this->assertEmpty($boardGames);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Tests/Controller/BookApiTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Tests\\Controller;\n\nuse App\\Entity\\BookTranslation;\nuse App\\Foundry\\Factory\\BookFactory;\nuse App\\Foundry\\Factory\\BookTranslationFactory;\nuse App\\Foundry\\Story\\DefaultBooksStory;\nuse App\\Foundry\\Story\\MoreBooksStory;\nuse Bazinga\\Bundle\\HateoasBundle\\BazingaHateoasBundle;\nuse FOS\\RestBundle\\FOSRestBundle;\nuse PHPUnit\\Framework\\Attributes\\Test;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Tests\\ApiTestCase;\nuse Zenstruck\\Foundry\\Attribute\\ResetDatabase;\nuse function Zenstruck\\Foundry\\Persistence\\refresh;\n\n#[ResetDatabase]\nfinal class BookApiTest extends ApiTestCase\n{\n    protected function setUp(): void\n    {\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n    }\n\n    #[Test]\n    public function it_allows_creating_a_book(): void\n    {\n        $this->markAsSkippedIfBcLayerIsEnabled();\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        $data =\n<<<EOT\n        {\n            \"translations\": {\n                \"en_US\": {\n                    \"title\": \"Star Wars: Dark Disciple\"\n                }\n            },\n            \"author\": \"Christie Golden\"\n        }\nEOT;\n\n        $this->client->request('POST', '/books', [], [], ['CONTENT_TYPE' => 'application/json'], $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_CREATED);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"title\":\"Star Wars: Dark Disciple\", \n                \"author\":\"Christie Golden\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_creating_a_book_with_bc_layer(): void\n    {\n        $this->markAsSkippedIfBcLayerIsNotEnabled();\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        $data =\n            <<<EOT\n        {\n            \"translations\": {\n                \"en_US\": {\n                    \"title\": \"Star Wars: Dark Disciple\"\n                }\n            },\n            \"author\": \"Christie Golden\"\n        }\nEOT;\n\n        $this->client->request('POST', '/books/', [], [], ['CONTENT_TYPE' => 'application/json'], $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_CREATED);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"title\":\"Star Wars: Dark Disciple\", \n                \"author\":\"Christie Golden\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_updating_a_book(): void\n    {\n        $book = BookFactory::createOne();\n\n        $data =\n            <<<EOT\n            {\n                 \"translations\": {\n                    \"en_US\": {\n                        \"title\": \"Star Wars: Dark Disciple\"\n                    },\n                    \"pl_PL\": {\n                        \"title\": \"Gwiezdne Wojny: Mroczny Uczeń\"\n                    }\n                },\n                \"author\": \"Christie Golden\"\n            }\n            EOT;\n\n        $this->client->request('PUT', '/books/' . $book->getId(), [], [], ['CONTENT_TYPE' => 'application/json'], $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_NO_CONTENT);\n\n        $book = refresh($book);\n\n        $enUsTranslation = $book->getTranslation('en_US');\n        $plPLTranslation = $book->getTranslation('pl_PL');\n        $this->assertInstanceOf(BookTranslation::class, $enUsTranslation);\n        $this->assertInstanceOf(BookTranslation::class, $plPLTranslation);\n        $this->assertEquals('Star Wars: Dark Disciple', $enUsTranslation->getTitle());\n        $this->assertEquals('Gwiezdne Wojny: Mroczny Uczeń', $plPLTranslation->getTitle());\n        $this->assertEquals('Christie Golden', $book->getAuthor());\n    }\n\n    #[Test]\n    public function it_allows_updating_partial_information_about_a_book(): void\n    {\n        $book = BookFactory::createOne();\n\n        $data =\n     <<<EOT\n        {\n            \"author\": \"Christie Golden\"\n        }\n    EOT;\n\n        $this->client->request('PATCH', '/books/' . $book->getId(), [], [], ['CONTENT_TYPE' => 'application/json'], $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_NO_CONTENT);\n\n        $book = refresh($book);\n        $this->assertEquals('Christie Golden', $book->getAuthor());\n    }\n\n    #[Test]\n    public function it_allows_removing_a_book(): void\n    {\n        $book = BookFactory::createOne();\n        $bookId = $book->getId();\n\n        $this->client->request('DELETE', '/books/' . $book->getId());\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_NO_CONTENT);\n\n        $this->assertEquals(0, $this->getContainer()->get('app.repository.book')->count([]));\n    }\n\n    #[Test]\n    public function it_allows_showing_a_book(): void\n    {\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        $book = BookFactory::new()\n            ->withTranslations([\n                BookTranslationFactory::new()\n                    ->withLocale('en_US')\n                    ->withTitle('Lord of The Rings'),\n                BookTranslationFactory::new()\n                    ->withLocale('pl_PL')\n                    ->withTitle('Władca Pierścieni'),\n            ])\n            ->withAuthor('J.R.R. Tolkien')\n            ->create()\n        ;\n\n        $this->client->request('GET', '/books/' . $book->getId());\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"title\":\"Lord of The Rings\", \n                \"author\":\"J.R.R. Tolkien\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_indexing_books(): void\n    {\n        $this->markAsSkippedIfBcLayerIsEnabled();\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        DefaultBooksStory::load();\n\n        $this->client->request('GET', '/books');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesDefaultBooksIndex();\n    }\n\n    #[Test]\n    public function it_allows_indexing_books_with_bc_layer(): void\n    {\n        $this->markAsSkippedIfBcLayerIsNotEnabled();\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        DefaultBooksStory::load();\n\n        $this->client->request('GET', '/books/');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesDefaultBooksIndex();\n    }\n\n    #[Test]\n    public function it_allows_paginating_the_index_of_books(): void\n    {\n        $this->markAsSkippedIfBcLayerIsEnabled();\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        MoreBooksStory::load();\n\n        $this->client->request('GET', '/books', ['page' => 2]);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesMoreBooksIndexPage2();\n    }\n\n    #[Test]\n    public function it_allows_paginating_the_index_of_books_with_bc_layer(): void\n    {\n        $this->markAsSkippedIfBcLayerIsNotEnabled();\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        MoreBooksStory::load();\n\n        $this->client->request('GET', '/books/', ['page' => 2]);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesMoreBooksIndexPage2();\n    }\n\n    #[Test]\n    public function it_does_not_allow_showing_resource_if_it_not_exists(): void\n    {\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        $this->client->request('GET', '/books/3');\n\n        $this->assertResponseStatusCodeSame(Response::HTTP_NOT_FOUND);\n    }\n\n    #[Test]\n    public function it_does_not_apply_sorting_for_non_existing_field(): void\n    {\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        MoreBooksStory::load();\n\n        $this->client->request('GET', '/sortable-books/', ['sorting' => ['name' => 'DESC']]);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesMoreBooksIndex();\n    }\n\n    #[Test]\n    public function it_does_not_apply_filtering_for_non_existing_field(): void\n    {\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        MoreBooksStory::load();\n\n        $this->client->request('GET', '/filterable-books/', ['criteria' => ['name' => 'John']]);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesMoreBooksIndex();\n    }\n\n    #[Test]\n    public function it_applies_sorting_for_existing_field(): void\n    {\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        MoreBooksStory::load();\n\n        $this->client->request('GET', '/sortable-books/', ['sorting' => ['id' => 'DESC']]);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"page\": 1,\n                \"limit\": 10,\n                \"pages\": 3,\n                \"total\": 22,\n                 \"_links\": {\n                    \"first\": {\n                        \"href\": \"/sortable-books/?sorting%5Bid%5D=DESC&page=1&limit=10\"\n                    },\n                    \"last\": {\n                        \"href\": \"/sortable-books/?sorting%5Bid%5D=DESC&page=3&limit=10\"\n                    },\n                    \"next\": {\n                        \"href\": \"/sortable-books/?sorting%5Bid%5D=DESC&page=2&limit=10\"\n                    },\n                    \"self\": {\n                        \"href\": \"/sortable-books/?sorting%5Bid%5D=DESC&page=1&limit=10\"\n                    }\n                },\n                \"_embedded\": {\n                    \"items\": [\n                        {\n                            \"author\": \"@string@\",\n                            \"id\": @integer@,\n                            \"title\": \"Book 22\"\n                        },\n                        {\n                            \"author\": \"@string@\",\n                            \"id\": @integer@,\n                            \"title\": \"Book 21\"\n                        },\n                        {\n                            \"author\": \"@string@\",\n                            \"id\": @integer@,\n                            \"title\": \"Book 20\"\n                        },\n                        {\n                            \"author\": \"@string@\",\n                            \"id\": @integer@,\n                            \"title\": \"Book 19\"\n                        },\n                        {\n                            \"author\": \"@string@\",\n                            \"id\": @integer@,\n                            \"title\": \"Book 18\"\n                        },\n                        {\n                            \"author\": \"@string@\",\n                            \"id\": @integer@,\n                            \"title\": \"Book 17\"\n                        },\n                        {\n                            \"author\": \"@string@\",\n                            \"id\": @integer@,\n                            \"title\": \"Book 16\"\n                        },\n                        {\n                            \"author\": \"@string@\",\n                            \"id\": @integer@,\n                            \"title\": \"Book 15\"\n                        },\n                        {\n                            \"author\": \"@string@\",\n                            \"id\": @integer@,\n                            \"title\": \"Book 14\"\n                        },\n                        {\n                            \"author\": \"@string@\",\n                            \"id\": @integer@,\n                            \"title\": \"Book 13\"\n                        }\n                    ]\n                }\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_applies_filtering_for_existing_field(): void\n    {\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        MoreBooksStory::load();\n        BookFactory::new()->withAuthor('J.R.R. Tolkien')->create();\n\n        $this->client->request('GET', '/filterable-books/', ['criteria' => ['author' => 'J.R.R. Tolkien']]);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"page\": 1,\n                \"limit\": 10,\n                \"pages\": 1,\n                \"total\": 1,\n                \"_links\": {\n                    \"self\": {\n                        \"href\": \"\\/filterable-books\\/?criteria%5Bauthor%5D=J.R.R.%20Tolkien&page=1&limit=10\"\n                    },\n                    \"first\": {\n                        \"href\": \"\\/filterable-books\\/?criteria%5Bauthor%5D=J.R.R.%20Tolkien&page=1&limit=10\"\n                    },\n                    \"last\": {\n                        \"href\": \"\\/filterable-books\\/?criteria%5Bauthor%5D=J.R.R.%20Tolkien&page=1&limit=10\"\n                    }\n                },\n                \"_embedded\": {\n                    \"items\": [\n                        {\n                            \"id\": @integer@,\n                            \"author\":  \"J.R.R. Tolkien\"\n                        }\n                    ]\n                }\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_creating_a_book_via_custom_factory(): void\n    {\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        $data =\n            <<<'JSON'\n            {\n                \"translations\": {\n                    \"en_US\": {\n                        \"title\": \"Star Wars: Dark Disciple\"\n                    }\n                },\n                \"author\": \"Christie Golden\"\n            }\n            JSON\n        ;\n\n        $this->client->request('POST', '/create-custom-book', [], [], ['CONTENT_TYPE' => 'application/json'], $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_CREATED);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"title\":\"Star Wars: Dark Disciple\", \n                \"author\":\"Christie Golden\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_indexing_books_via_custom_repository(): void\n    {\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        DefaultBooksStory::load();\n\n        $this->client->request('GET', '/find-custom-books');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesDefaultBooksIndex();\n    }\n\n    #[Test]\n    public function it_allows_showing_a_book_via_custom_repository(): void\n    {\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        DefaultBooksStory::load();\n\n        $this->client->request('GET', '/find-custom-book');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"title\":\"Lord of The Rings\", \n                \"author\":\"J.R.R. Tolkien\"\n            }\n            JSON\n        );\n    }\n\n    private function assertResponseMatchesDefaultBooksIndex(): void\n    {\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"page\": 1,\n                \"limit\": 10,\n                \"pages\": 1,\n                \"total\": 2,\n                \"_links\": {\n                    \"self\": {\n                        \"href\": \"@string@\"\n                    },\n                    \"first\": {\n                        \"href\": \"@string@\"\n                    },\n                    \"last\": {\n                        \"href\": \"@string@\"\n                    }\n                },\n                \"_embedded\": {\n                    \"items\": [\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Lord of The Rings\",\n                            \"author\": \"J.R.R. Tolkien\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Game of Thrones\",\n                            \"author\": \"George R. R. Martin\"\n                        }\n                    ]\n                }\n            }\n            JSON\n        );\n    }\n\n    private function assertResponseMatchesMoreBooksIndex(): void\n    {\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"page\": 1,\n                \"limit\": 10,\n                \"pages\": 3,\n                \"total\": 22,\n                \"_links\": {\n                    \"self\": {\n                        \"href\": \"@string@\"\n                    },\n                    \"first\": {\n                        \"href\": \"@string@\"\n                    },\n                    \"last\": {\n                        \"href\": \"@string@\"\n                    },\n                    \"next\": {\n                        \"href\": \"@string@\"\n                    }\n                },\n                \"_embedded\": {\n                    \"items\": [\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 1\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 2\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 3\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 4\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 5\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 6\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 7\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 8\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 9\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 10\",\n                            \"author\": \"@string@\"\n                        }\n                    ]\n                }\n            }\n            JSON\n        );\n    }\n\n    private function assertResponseMatchesMoreBooksIndexPage2(): void\n    {\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"page\": 2,\n                \"limit\": 10,\n                \"pages\": 3,\n                \"total\": 22,\n                \"_links\": {\n                    \"self\": {\n                        \"href\": \"@string@\"\n                    },\n                    \"first\": {\n                        \"href\": \"@string@\"\n                    },\n                    \"last\": {\n                        \"href\": \"@string@\"\n                    },\n                    \"next\": {\n                        \"href\": \"@string@\"\n                    },\n                    \"previous\": {\n                        \"href\": \"@string@\"\n                    }\n                },\n                \"_embedded\": {\n                    \"items\": [\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 11\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 12\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 13\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 14\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 15\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 16\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 17\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 18\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 19\",\n                            \"author\": \"@string@\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"title\": \"Book 20\",\n                            \"author\": \"@string@\"\n                        }\n                    ]\n                }\n            }\n            JSON\n        );\n    }\n\n    private function markAsSkippedIfHateoasIsNotAvailable(): void\n    {\n        if (!class_exists(BazingaHateoasBundle::class)) {\n            $this->markTestSkipped('HateoasBundle is not installed.');\n        }\n    }\n\n    private function markAsSkippedIfFosRestBundleIsNotAvailable(): void\n    {\n        if (!class_exists(FOSRestBundle::class)) {\n            $this->markTestSkipped('FriendsOfSymfony Rest Bundle is not installed.');\n        }\n    }\n\n    private function isRoutingPathBcLayerEnabled(): bool\n    {\n        return (bool) $this->getContainer()->getParameter('sylius.routing_path_bc_layer');\n    }\n\n    private function markAsSkippedIfBcLayerIsEnabled(): void\n    {\n        if ($this->isRoutingPathBcLayerEnabled()) {\n            $this->markTestSkipped('This test requires The BC layer to be disabled.');\n        }\n    }\n\n    private function markAsSkippedIfBcLayerIsNotEnabled(): void\n    {\n        if (!$this->isRoutingPathBcLayerEnabled()) {\n            $this->markTestSkipped('This test requires The BC layer to be enabled.');\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Tests/Controller/ComicBookApiTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Tests\\Controller;\n\nuse App\\Foundry\\Factory\\AuthorFactory;\nuse App\\Foundry\\Factory\\ComicBookFactory;\nuse App\\Foundry\\Story\\DefaultComicBooksStory;\nuse Bazinga\\Bundle\\HateoasBundle\\BazingaHateoasBundle;\nuse FOS\\RestBundle\\FOSRestBundle;\nuse JMS\\SerializerBundle\\JMSSerializerBundle;\nuse PHPUnit\\Framework\\Attributes\\Test;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Tests\\ApiTestCase;\nuse Zenstruck\\Foundry\\Attribute\\ResetDatabase;\n\n#[ResetDatabase]\nfinal class ComicBookApiTest extends ApiTestCase\n{\n    protected function setUp(): void\n    {\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n        $this->markAsSkippedIfJMSSerializerBundleIsNotAvailable();\n    }\n\n    #[Test]\n    public function it_allows_creating_a_comic_book(): void\n    {\n        $this->markAsSkippedIfBcLayerIsEnabled();\n\n        $data =\n            <<<'JSON'\n            {\n                \"title\": \"Deadpool #1-69\",\n                \"author\": {\n                    \"firstName\": \"Joe\",\n                    \"lastName\": \"Kelly\"\n                }\n            }\n            JSON\n        ;\n\n        $this->client->request('POST', '/v1/comic-books', [], [], ['CONTENT_TYPE' => 'application/json'], $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_CREATED);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"author\": {\n                    \"first_name\": \"Joe\",\n                    \"last_name\": \"Kelly\"\n                },\n                \"title\": \"Deadpool #1-69\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_creating_a_comic_book_with_bc_layer(): void\n    {\n        $this->markAsSkippedIfBcLayerIsNotEnabled();\n\n        $data =\n            <<<'JSON'\n            {\n                \"title\": \"Deadpool #1-69\",\n                \"author\": {\n                    \"firstName\": \"Joe\",\n                    \"lastName\": \"Kelly\"\n                }\n            }\n            JSON\n        ;\n\n        $this->client->request('POST', '/v1/comic-books/', [], [], ['CONTENT_TYPE' => 'application/json'], $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_CREATED);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"author\": {\n                    \"first_name\": \"Joe\",\n                    \"last_name\": \"Kelly\"\n                },\n                \"title\": \"Deadpool #1-69\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_versioned_creating_a_comic_book(): void\n    {\n        $this->markAsSkippedIfBcLayerIsEnabled();\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        $data =\n            <<<'JSON'\n            {\n                \"title\": \"Deadpool #1-69\",\n                \"author\": {\n                    \"firstName\": \"Joe\",\n                    \"lastName\": \"Kelly\"\n                }\n            }\n            JSON\n        ;\n\n        $this->client->request('POST', '/v1.2/comic-books', [], [], ['CONTENT_TYPE' => 'application/json'], $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_CREATED);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"author_first_name\": \"Joe\",\n                \"author_last_name\": \"Kelly\",\n                \"title\": \"Deadpool #1-69\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_versioned_creating_a_comic_book_with_bc_layer(): void\n    {\n        $this->markAsSkippedIfBcLayerIsNotEnabled();\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        $data =\n            <<<'JSON'\n            {\n                \"title\": \"Deadpool #1-69\",\n                \"author\": {\n                    \"firstName\": \"Joe\",\n                    \"lastName\": \"Kelly\"\n                }\n            }\n            JSON\n        ;\n\n        $this->client->request('POST', '/v1.2/comic-books/', [], [], ['CONTENT_TYPE' => 'application/json'], $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_CREATED);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"author_first_name\": \"Joe\",\n                \"author_last_name\": \"Kelly\",\n                \"title\": \"Deadpool #1-69\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_updating_a_comic_book(): void\n    {\n        $comicBook = self::someComicBook()->create();\n\n        $data =\n<<<EOT\n        {\n            \"title\": \"Deadpool #1-69\",\n            \"author\": {\n                \"firstName\": \"Joe\",\n                \"lastName\": \"Kelly\"\n            }\n        }\nEOT;\n\n        $this->client->request('PUT', '/v1/comic-books/' . $comicBook->getId(), [], [], ['CONTENT_TYPE' => 'application/json'], $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_NO_CONTENT);\n    }\n\n    #[Test]\n    public function it_allows_updating_partial_information_about_a_comic_book(): void\n    {\n        $comicBook = self::someComicBook()->create();\n\n        $data =\n <<<EOT\n        {\n            \"author\": {\n                \"firstName\": \"Joe\",\n                \"lastName\": \"Kelly\"\n            }\n        }\nEOT;\n\n        $this->client->request('PATCH', '/v1/comic-books/' . $comicBook->getId(), [], [], ['CONTENT_TYPE' => 'application/json'], $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_NO_CONTENT);\n\n        $book = $this->getContainer()->get('app.repository.comic_book')->find($comicBook->getId());\n        $this->getContainer()->get('doctrine.orm.entity_manager')->refresh($book);\n\n        $this->assertEquals('Joe', $book->getAuthor()->getFirstName());\n        $this->assertEquals('Kelly', $book->getAuthor()->getLastName());\n    }\n\n    #[Test]\n    public function it_allows_removing_a_comic_book(): void\n    {\n        $comicBook = self::someComicBook()->create();\n\n        $this->client->request('DELETE', '/v1/comic-books/' . $comicBook->getId());\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_NO_CONTENT);\n    }\n\n    #[Test]\n    public function it_allows_showing_a_comic_book(): void\n    {\n        $comicBook = self::someComicBook()->create();\n\n        $this->client->request('GET', '/v1/comic-books/' . $comicBook->getId());\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"author\": {\n                    \"first_name\": \"Andrea\",\n                    \"last_name\": \"Sorrentino\"\n                },\n                \"title\": \"Old Man Logan\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_versioning_of_a_showing_comic_book_serialization(): void\n    {\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        $comicBook = self::someComicBook()->create();\n\n        $this->client->request('GET', '/v1.2/comic-books/' . $comicBook->getId());\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"author_first_name\": \"Andrea\",\n                \"author_last_name\": \"Sorrentino\",\n                \"title\": \"Old Man Logan\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_indexing_of_comic_books(): void\n    {\n        $this->markAsSkippedIfBcLayerIsEnabled();\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        DefaultComicBooksStory::load();\n\n        $this->client->request('GET', '/v1/comic-books');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"page\": 1,\n                \"limit\": 10,\n                \"pages\": 1,\n                \"total\": 2,\n                \"_links\": {\n                    \"self\": {\n                        \"href\": \"\\/v1\\/comic-books?page=1&limit=10\"\n                    },\n                    \"first\": {\n                        \"href\": \"\\/v1\\/comic-books?page=1&limit=10\"\n                    },\n                    \"last\": {\n                        \"href\": \"\\/v1\\/comic-books?page=1&limit=10\"\n                    }\n                },\n                \"_embedded\": {\n                    \"items\": [\n                        {\n                            \"id\": @integer@,\n                            \"author\": {\n                                \"first_name\": \"Andrea\",\n                                \"last_name\": \"Sorrentino\"\n                            },\n                            \"title\": \"Old Man Logan\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"author\": {\n                                \"first_name\": \"Brian Michael\",\n                                \"last_name\": \"Bendis\"\n                            },\n                            \"title\": \"Civil War II\"\n                        }\n                    ]\n                }\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_indexing_of_comic_books_with_bc_layer(): void\n    {\n        $this->markAsSkippedIfBcLayerIsNotEnabled();\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        DefaultComicBooksStory::load();\n\n        $this->client->request('GET', '/v1/comic-books/');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"page\": 1,\n                \"limit\": 10,\n                \"pages\": 1,\n                \"total\": 2,\n                \"_links\": {\n                    \"self\": {\n                        \"href\": \"\\/v1\\/comic-books\\/?page=1&limit=10\"\n                    },\n                    \"first\": {\n                        \"href\": \"\\/v1\\/comic-books\\/?page=1&limit=10\"\n                    },\n                    \"last\": {\n                        \"href\": \"\\/v1\\/comic-books\\/?page=1&limit=10\"\n                    }\n                },\n                \"_embedded\": {\n                    \"items\": [\n                        {\n                            \"id\": @integer@,\n                            \"author\": {\n                                \"first_name\": \"Andrea\",\n                                \"last_name\": \"Sorrentino\"\n                            },\n                            \"title\": \"Old Man Logan\"\n                        },\n                        {\n                            \"id\": @integer@,\n                            \"author\": {\n                                \"first_name\": \"Brian Michael\",\n                                \"last_name\": \"Bendis\"\n                            },\n                            \"title\": \"Civil War II\"\n                        }\n                    ]\n                }\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_versioned_indexing_of_comic_books(): void\n    {\n        $this->markAsSkippedIfBcLayerIsEnabled();\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        DefaultComicBooksStory::load();\n\n        $this->client->request('GET', 'v1.2/comic-books');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"page\": 1,\n                \"limit\": 10,\n                \"pages\": 1,\n                \"total\": 2,\n                \"_links\": {\n                    \"self\": {\n                        \"href\": \"\\/v1.2\\/comic-books?page=1&limit=10\"\n                    },\n                    \"first\": {\n                        \"href\": \"\\/v1.2\\/comic-books?page=1&limit=10\"\n                    },\n                    \"last\": {\n                        \"href\": \"\\/v1.2\\/comic-books?page=1&limit=10\"\n                    }\n                },\n                \"_embedded\": {\n                  \"items\": [\n                    {\n                      \"id\": @integer@,\n                      \"author_first_name\": \"Andrea\",\n                      \"author_last_name\": \"Sorrentino\",\n                      \"title\": \"Old Man Logan\"\n                    },\n                    {\n                      \"id\": @integer@,\n                      \"author_first_name\": \"Brian Michael\",\n                      \"author_last_name\": \"Bendis\",\n                      \"title\": \"Civil War II\"\n                    }\n                  ]\n                }\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_versioned_indexing_of_comic_books_with_bc_layer(): void\n    {\n        $this->markAsSkippedIfBcLayerIsNotEnabled();\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        DefaultComicBooksStory::load();\n\n        $this->client->request('GET', '/v1.2/comic-books/');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<JSON\n            {\n                \"page\": 1,\n                \"limit\": 10,\n                \"pages\": 1,\n                \"total\": 2,\n                \"_links\": {\n                    \"self\": {\n                        \"href\": \"\\/v1.2\\/comic-books\\/?page=1&limit=10\"\n                    },\n                    \"first\": {\n                        \"href\": \"\\/v1.2\\/comic-books\\/?page=1&limit=10\"\n                    },\n                    \"last\": {\n                        \"href\": \"\\/v1.2\\/comic-books\\/?page=1&limit=10\"\n                    }\n                },\n                \"_embedded\": {\n                  \"items\": [\n                    {\n                      \"id\": @integer@,\n                      \"author_first_name\": \"Andrea\",\n                      \"author_last_name\": \"Sorrentino\",\n                      \"title\": \"Old Man Logan\"\n                    },\n                    {\n                      \"id\": @integer@,\n                      \"author_first_name\": \"Brian Michael\",\n                      \"author_last_name\": \"Bendis\",\n                      \"title\": \"Civil War II\"\n                    }\n                  ]\n                }\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_does_not_allow_showing_resource_if_it_does_not_exist(): void\n    {\n        $this->client->request('GET', '/v1/comic-books/3');\n\n        $this->assertResponseStatusCodeSame(Response::HTTP_NOT_FOUND);\n    }\n\n    private static function someComicBook(): ComicBookFactory\n    {\n        return ComicBookFactory::new()\n            ->withTitle('Old Man Logan')\n            ->withAuthor(\n                AuthorFactory::new()\n                ->withFirstName('Andrea')\n                ->withLastName('Sorrentino'),\n            )\n        ;\n    }\n\n    private function isRoutingPathBcLayerEnabled(): bool\n    {\n        return (bool) $this->getContainer()->getParameter('sylius.routing_path_bc_layer');\n    }\n\n    private function markAsSkippedIfBcLayerIsEnabled(): void\n    {\n        if ($this->isRoutingPathBcLayerEnabled()) {\n            $this->markTestSkipped('This test requires The BC layer to be disabled.');\n        }\n    }\n\n    private function markAsSkippedIfBcLayerIsNotEnabled(): void\n    {\n        if (!$this->isRoutingPathBcLayerEnabled()) {\n            $this->markTestSkipped('This test requires The BC layer to be enabled.');\n        }\n    }\n\n    private function markAsSkippedIfHateoasIsNotAvailable(): void\n    {\n        if (!class_exists(BazingaHateoasBundle::class)) {\n            $this->markTestSkipped('HateoasBundle is not installed.');\n        }\n    }\n\n    private function markAsSkippedIfFosRestBundleIsNotAvailable(): void\n    {\n        if (!class_exists(FOSRestBundle::class)) {\n            $this->markTestSkipped('FriendsOfSymfony Rest Bundle is not installed.');\n        }\n    }\n\n    private function markAsSkippedIfJMSSerializerBundleIsNotAvailable(): void\n    {\n        if (!class_exists(JMSSerializerBundle::class)) {\n            $this->markTestSkipped('JMS Serializer Bundle is not installed.');\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Tests/Controller/GedmoApiTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Tests\\Controller;\n\nuse Gedmo\\Sortable\\SortableListener;\nuse PHPUnit\\Framework\\Attributes\\Test;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Tests\\ApiTestCase;\nuse Zenstruck\\Foundry\\Attribute\\ResetDatabase;\n\n#[ResetDatabase]\nfinal class GedmoApiTest extends ApiTestCase\n{\n    #[Test]\n    public function it_allows_creating_a_comic_book(): void\n    {\n        $this->markAsSkippedIfBcLayerIsEnabled();\n        $this->markAsSkippedIfGedmoDoctrineExtensionsIsNotAvailable();\n\n        $data =\n<<<EOT\n        {\n            \"extra\": \"Some info\"\n        }\nEOT;\n\n        $this->client->request('POST', '/gedmos', [], [], ['CONTENT_TYPE' => 'application/json'], $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_CREATED);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"position\": 0,\n                \"extra\": \"Some info\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_creating_a_comic_book_with_bc_layer(): void\n    {\n        $this->markAsSkippedIfBcLayerIsNotEnabled();\n        $this->markAsSkippedIfGedmoDoctrineExtensionsIsNotAvailable();\n\n        $data =\n            <<<EOT\n        {\n            \"extra\": \"Some info\"\n        }\nEOT;\n\n        $this->client->request('POST', '/gedmos/', [], [], ['CONTENT_TYPE' => 'application/json'], $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_CREATED);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"position\": 0,\n                \"extra\": \"Some info\"\n            }\n            JSON\n        );\n    }\n\n    private function isRoutingPathBcLayerEnabled(): bool\n    {\n        return (bool) $this->getContainer()->getParameter('sylius.routing_path_bc_layer');\n    }\n\n    private function markAsSkippedIfBcLayerIsEnabled(): void\n    {\n        if ($this->isRoutingPathBcLayerEnabled()) {\n            $this->markTestSkipped('This test requires The BC layer to be disabled.');\n        }\n    }\n\n    private function markAsSkippedIfBcLayerIsNotEnabled(): void\n    {\n        if (!$this->isRoutingPathBcLayerEnabled()) {\n            $this->markTestSkipped('This test requires The BC layer to be enabled.');\n        }\n    }\n\n    private function markAsSkippedIfGedmoDoctrineExtensionsIsNotAvailable(): void\n    {\n        if (!class_exists(SortableListener::class)) {\n            $this->markTestSkipped('Gedmo Doctrine Extension is not available.');\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Tests/Controller/PullRequestApiTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Tests\\Controller;\n\nuse App\\Foundry\\Factory\\PullRequestFactory;\nuse FOS\\RestBundle\\FOSRestBundle;\nuse PHPUnit\\Framework\\Attributes\\Test;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Workflow\\Registry;\nuse Tests\\ApiTestCase;\nuse winzou\\Bundle\\StateMachineBundle\\winzouStateMachineBundle;\nuse Zenstruck\\Foundry\\Attribute\\ResetDatabase;\n\n#[ResetDatabase]\nfinal class PullRequestApiTest extends ApiTestCase\n{\n    protected function setUp(): void\n    {\n        $this->markAsSkippedIfNoStateMachineIsAvailable();\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n    }\n\n    #[Test]\n    public function it_allows_creating_a_pull_request(): void\n    {\n        $this->markAsSkippedIfBcLayerIsEnabled();\n        $this->client->request('POST', '/pull-requests', [], [], ['CONTENT_TYPE' => 'application/json'], '{}');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_CREATED);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"current_place\": \"start\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_creating_a_pull_request_with_bc_layer(): void\n    {\n        $this->markAsSkippedIfBcLayerIsNotEnabled();\n        $this->client->request('POST', '/pull-requests/', [], [], ['CONTENT_TYPE' => 'application/json'], '{}');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_CREATED);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"current_place\": \"start\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_submitting_a_pull_request(): void\n    {\n        $pullRequest = PullRequestFactory::new()\n            ->withCurrentPlace('start')\n            ->create()\n        ;\n\n        $this->client->request('PUT', '/pull-requests/' . $pullRequest->getId() . '/submit', [], [], ['CONTENT_TYPE' => 'application/json'], '{}');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"current_place\": \"test\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_waiting_for_review_a_pull_request(): void\n    {\n        $pullRequest = PullRequestFactory::new()\n            ->withCurrentPlace('test')\n            ->create()\n        ;\n\n        $this->client->request('PUT', '/pull-requests/' . $pullRequest->getId() . '/wait_for_review', [], [], ['CONTENT_TYPE' => 'application/json'], '{}');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"id\": @integer@,\n                \"current_place\": \"review\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_does_not_allow_to_wait_for_review_on_pull_request_with_start_status(): void\n    {\n        $pullRequest = PullRequestFactory::new()\n            ->withCurrentPlace('start')\n            ->create()\n        ;\n\n        $this->client->request('PUT', '/pull-requests/' . $pullRequest->getId() . '/wait_for_review', [], [], ['CONTENT_TYPE' => 'application/json'], '{}');\n\n        $this->assertResponseStatusCodeSame(Response::HTTP_BAD_REQUEST);\n        $this->assertResponseHeaderSame('content-type', 'application/json');\n    }\n\n    private function isRoutingPathBcLayerEnabled(): bool\n    {\n        return (bool) $this->getContainer()->getParameter('sylius.routing_path_bc_layer');\n    }\n\n    private function markAsSkippedIfBcLayerIsEnabled(): void\n    {\n        if ($this->isRoutingPathBcLayerEnabled()) {\n            $this->markTestSkipped('This test requires The BC layer to be disabled.');\n        }\n    }\n\n    private function markAsSkippedIfBcLayerIsNotEnabled(): void\n    {\n        if (!$this->isRoutingPathBcLayerEnabled()) {\n            $this->markTestSkipped('This test requires The BC layer to be enabled.');\n        }\n    }\n\n    private function markAsSkippedIfFosRestBundleIsNotAvailable(): void\n    {\n        if (!class_exists(FOSRestBundle::class)) {\n            $this->markTestSkipped('FriendsOfSymfony Rest Bundle is not installed.');\n        }\n    }\n\n    private function markAsSkippedIfNoStateMachineIsAvailable(): void\n    {\n        if (!class_exists(Registry::class) || !class_exists(winzouStateMachineBundle::class)) {\n            $this->markTestSkipped('No state machine available.');\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Tests/Controller/ScienceBookUiTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Tests\\Controller;\n\nuse App\\Entity\\ScienceBook;\nuse App\\Foundry\\Factory\\AuthorFactory;\nuse App\\Foundry\\Factory\\ScienceBookFactory;\nuse PHPUnit\\Framework\\Attributes\\Test;\nuse Symfony\\Bundle\\FrameworkBundle\\KernelBrowser;\nuse Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Zenstruck\\Foundry\\Attribute\\ResetDatabase;\nuse function Zenstruck\\Foundry\\Persistence\\refresh;\n\n#[ResetDatabase]\nfinal class ScienceBookUiTest extends WebTestCase\n{\n    private KernelBrowser $client;\n\n    protected function setUp(): void\n    {\n        $this->client = self::createClient();\n    }\n\n    #[Test]\n    public function it_allows_showing_a_book(): void\n    {\n        $scienceBook = ScienceBookFactory::new()\n            ->withTitle('A Brief History of Time')\n            ->withAuthor(\n                AuthorFactory::new()\n                    ->withFirstName('Stephen')\n                    ->withLastName('Hawking'),\n            )\n            ->create()\n        ;\n\n        $this->client->request('GET', '/science-books/' . $scienceBook->getId());\n        $response = $this->client->getResponse();\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n\n        $content = $response->getContent();\n        $this->assertStringContainsString(sprintf('ID: %d', $scienceBook->getId()), $content);\n        $this->assertStringContainsString('Title: A Brief History of Time', $content);\n        $this->assertStringContainsString('Author: Stephen Hawking', $content);\n    }\n\n    #[Test]\n    public function it_allows_indexing_books(): void\n    {\n        $this->markAsSkippedIfBcLayerIsEnabled();\n\n        $firstBook = ScienceBookFactory::new()\n            ->withTitle('A Brief History of Time')\n            ->withAuthor(\n                AuthorFactory::new()\n                    ->withFirstName('Stephen')\n                    ->withLastName('Hawking'),\n            )\n            ->create()\n        ;\n\n        $secondBook = ScienceBookFactory::new()\n            ->withTitle('The Future of Humanity')\n            ->withAuthor(\n                AuthorFactory::new()\n                    ->withFirstName('Michio')\n                    ->withLastName('Kaku'),\n            )\n            ->create()\n        ;\n\n        $this->client->request('GET', '/science-books');\n        $response = $this->client->getResponse();\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n\n        $content = $response->getContent();\n        $this->assertStringContainsString('<h1>Books</h1>', $content);\n        $this->assertStringContainsString(\n            sprintf('<td>%d</td><td>A Brief History of Time</td><td>Stephen Hawking</td>', $firstBook->getId()),\n            $content,\n        );\n        $this->assertStringContainsString(\n            sprintf('<td>%d</td><td>The Future of Humanity</td><td>Michio Kaku</td>', $secondBook->getId()),\n            $content,\n        );\n    }\n\n    #[Test]\n    public function it_allows_indexing_books_with_bc_layer(): void\n    {\n        $this->markAsSkippedIfBcLayerIsNotEnabled();\n\n        $firstBook = ScienceBookFactory::new()\n            ->withTitle('A Brief History of Time')\n            ->withAuthor(\n                AuthorFactory::new()\n                    ->withFirstName('Stephen')\n                    ->withLastName('Hawking'),\n            )\n            ->create()\n        ;\n\n        $secondBook = ScienceBookFactory::new()\n            ->withTitle('The Future of Humanity')\n            ->withAuthor(\n                AuthorFactory::new()\n                    ->withFirstName('Michio')\n                    ->withLastName('Kaku'),\n            )\n            ->create()\n        ;\n\n        $this->client->request('GET', '/science-books/');\n        $response = $this->client->getResponse();\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n\n        $content = $response->getContent();\n        $this->assertStringContainsString('<h1>Books</h1>', $content);\n        $this->assertStringContainsString(\n            sprintf('<td>%d</td><td>A Brief History of Time</td><td>Stephen Hawking</td>', $firstBook->getId()),\n            $content,\n        );\n        $this->assertStringContainsString(\n            sprintf('<td>%d</td><td>The Future of Humanity</td><td>Michio Kaku</td>', $secondBook->getId()),\n            $content,\n        );\n    }\n\n    #[Test]\n    public function it_allows_creating_a_book(): void\n    {\n        $newBookTitle = 'The Book of Why';\n        $newBookAuthorFirstName = 'Judea';\n        $newBookAuthorLastName = 'Pearl';\n\n        $this->client->request('GET', '/science-books/new');\n        $this->client->submitForm('Create', [\n            'science_book[title]' => $newBookTitle,\n            'science_book[author][firstName]' => $newBookAuthorFirstName,\n            'science_book[author][lastName]' => $newBookAuthorLastName,\n        ]);\n\n        $this->assertResponseRedirects(null, expectedCode: Response::HTTP_FOUND);\n\n        /** @var ScienceBook $book */\n        $book = static::getContainer()->get('app.repository.science_book')->findOneBy(['title' => $newBookTitle]);\n\n        $this->assertNotNull($book);\n        $this->assertSame($newBookTitle, $book->getTitle());\n        $this->assertSame($newBookAuthorFirstName, $book->getAuthorFirstName());\n        $this->assertSame($newBookAuthorLastName, $book->getAuthorLastName());\n    }\n\n    #[Test]\n    public function it_does_not_allow_to_create_a_book_if_there_is_a_validation_error(): void\n    {\n        $newBookTitle = 'The Book of Why';\n        $newBookAuthorLastName = 'Pearl';\n\n        $this->client->request('GET', '/science-books/new');\n        $this->client->submitForm('Create', [\n            'science_book[title]' => $newBookTitle,\n            'science_book[author][lastName]' => $newBookAuthorLastName,\n        ]);\n\n        $this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);\n\n        /** @var ScienceBook $book */\n        $book = static::getContainer()->get('app.repository.science_book')->findOneBy(['title' => $newBookTitle]);\n\n        $this->assertNull($book);\n    }\n\n    #[Test]\n    public function it_allows_updating_a_book(): void\n    {\n        $scienceBook = ScienceBookFactory::createOne();\n\n        $newBookTitle = 'The Book of Why';\n        $newBookAuthorFirstName = 'Judea';\n        $newBookAuthorLastName = 'Pearl';\n\n        $this->client->request('GET', '/science-books/' . $scienceBook->getId() . '/edit');\n        $this->client->submitForm('Save changes', [\n            'science_book[title]' => $newBookTitle,\n            'science_book[author][firstName]' => $newBookAuthorFirstName,\n            'science_book[author][lastName]' => $newBookAuthorLastName,\n        ]);\n\n        $this->assertResponseRedirects(null, expectedCode: Response::HTTP_FOUND);\n\n        $scienceBook = refresh($scienceBook);\n        $this->assertSame($newBookTitle, $scienceBook->getTitle());\n        $this->assertSame($newBookAuthorFirstName, $scienceBook->getAuthorFirstName());\n        $this->assertSame($newBookAuthorLastName, $scienceBook->getAuthorLastName());\n    }\n\n    #[Test]\n    public function it_does_not_allow_to_update_a_book_if_there_is_a_validation_error(): void\n    {\n        $scienceBook = ScienceBookFactory::new()\n            ->withTitle('The Shinning')\n        ->create();\n\n        $newBookTitle = 'The Book of Why';\n        $newBookAuthorLastName = 'Pearl';\n\n        $this->client->request('GET', '/science-books/' . $scienceBook->getId() . '/edit');\n        $this->client->submitForm('Save changes', [\n            'science_book[title]' => $newBookTitle,\n            'science_book[author][firstName]' => null,\n            'science_book[author][lastName]' => $newBookAuthorLastName,\n        ]);\n\n        $this->assertResponseStatusCodeSame(expectedCode: Response::HTTP_UNPROCESSABLE_ENTITY);\n\n        /** @var ScienceBook $book */\n        $book = static::getContainer()->get('app.repository.science_book')->find($scienceBook->getId());\n        $this->getContainer()->get('doctrine.orm.entity_manager')->refresh($book);\n\n        $this->assertNotEquals($newBookTitle, $book->getTitle());\n    }\n\n    #[Test]\n    public function it_allows_deleting_a_book(): void\n    {\n        $this->markAsSkippedIfBcLayerIsEnabled();\n\n        ScienceBookFactory::createOne();\n\n        $this->client->request('GET', '/science-books');\n        $this->client->submitForm('Delete');\n\n        $this->assertResponseRedirects(null, expectedCode: Response::HTTP_FOUND);\n\n        /** @var ScienceBook[] $books */\n        $books = static::getContainer()->get('app.repository.science_book')->findAll();\n\n        $this->assertEmpty($books);\n    }\n\n    #[Test]\n    public function it_allows_deleting_a_book_with_bc_layer(): void\n    {\n        $this->markAsSkippedIfBcLayerIsNotEnabled();\n\n        ScienceBookFactory::createOne();\n\n        $this->client->request('GET', '/science-books/');\n        $this->client->submitForm('Delete');\n\n        $this->assertResponseRedirects(null, expectedCode: Response::HTTP_FOUND);\n\n        /** @var ScienceBook[] $books */\n        $books = static::getContainer()->get('app.repository.science_book')->findAll();\n\n        $this->assertEmpty($books);\n    }\n\n    #[Test]\n    public function it_allows_filtering_books(): void\n    {\n        $this->markAsSkippedIfBcLayerIsEnabled();\n\n        $firstBook = ScienceBookFactory::new()\n            ->withTitle('A Brief History of Time')\n            ->withAuthor(\n                AuthorFactory::new()\n                    ->withFirstName('Stephen')\n                    ->withLastName('Hawking'),\n            )\n            ->create()\n        ;\n\n        $secondBook = ScienceBookFactory::new()\n            ->withTitle('The Future of Humanity')\n            ->withAuthor(\n                AuthorFactory::new()\n                    ->withFirstName('Michio')\n                    ->withLastName('Kaku'),\n            )\n            ->create()\n        ;\n\n        $this->client->request('GET', '/science-books?criteria[search][value]=history of time');\n        $response = $this->client->getResponse();\n\n        $this->assertResponseStatusCodeSame(expectedCode: Response::HTTP_OK);\n        $content = $response->getContent();\n        $this->assertStringContainsString('<h1>Books</h1>', $content);\n        $this->assertStringContainsString(\n            sprintf('<td>%d</td><td>A Brief History of Time</td><td>Stephen Hawking</td>', $firstBook->getId()),\n            $content,\n        );\n        $this->assertStringNotContainsString(\n            sprintf('<td>%d</td><td>The Future of Humanity</td><td>Michio Kaku</td>', $secondBook->getId()),\n            $content,\n        );\n    }\n\n    #[Test]\n    public function it_allows_filtering_books_with_bc_layer(): void\n    {\n        $this->markAsSkippedIfBcLayerIsNotEnabled();\n\n        $firstBook = ScienceBookFactory::new()\n            ->withTitle('A Brief History of Time')\n            ->withAuthor(\n                AuthorFactory::new()\n                    ->withFirstName('Stephen')\n                    ->withLastName('Hawking'),\n            )\n            ->create()\n        ;\n\n        $secondBook = ScienceBookFactory::new()\n            ->withTitle('The Future of Humanity')\n            ->withAuthor(\n                AuthorFactory::new()\n                    ->withFirstName('Michio')\n                    ->withLastName('Kaku'),\n            )\n            ->create()\n        ;\n\n        $this->client->request('GET', '/science-books/?criteria[search][value]=history of time');\n        $response = $this->client->getResponse();\n\n        $this->assertResponseStatusCodeSame(expectedCode: Response::HTTP_OK);\n        $content = $response->getContent();\n        $this->assertStringContainsString('<h1>Books</h1>', $content);\n        $this->assertStringContainsString(\n            sprintf('<td>%d</td><td>A Brief History of Time</td><td>Stephen Hawking</td>', $firstBook->getId()),\n            $content,\n        );\n        $this->assertStringNotContainsString(\n            sprintf('<td>%d</td><td>The Future of Humanity</td><td>Michio Kaku</td>', $secondBook->getId()),\n            $content,\n        );\n    }\n\n    private function isRoutingPathBcLayerEnabled(): bool\n    {\n        return (bool) $this->getContainer()->getParameter('sylius.routing_path_bc_layer');\n    }\n\n    private function markAsSkippedIfBcLayerIsEnabled(): void\n    {\n        if ($this->isRoutingPathBcLayerEnabled()) {\n            $this->markTestSkipped('This test requires The BC layer to be disabled.');\n        }\n    }\n\n    private function markAsSkippedIfBcLayerIsNotEnabled(): void\n    {\n        if (!$this->isRoutingPathBcLayerEnabled()) {\n            $this->markTestSkipped('This test requires The BC layer to be enabled.');\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Tests/Controller/SpeakerUiTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Tests\\Controller;\n\nuse App\\Conference\\Entity\\Speaker;\nuse App\\Conference\\Factory\\SpeakerFactory;\nuse Doctrine\\ORM\\EntityManagerInterface;\nuse Symfony\\Bundle\\FrameworkBundle\\KernelBrowser;\nuse Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Zenstruck\\Foundry\\Attribute\\ResetDatabase;\nuse function Zenstruck\\Foundry\\Persistence\\refresh;\n\n#[ResetDatabase]\nfinal class SpeakerUiTest extends WebTestCase\n{\n    private KernelBrowser $client;\n\n    protected function setUp(): void\n    {\n        $this->client = $this->createClient();\n    }\n\n    /** @test */\n    public function it_allows_browsing_speakers(): void\n    {\n        SpeakerFactory::new()\n            ->withFirstName('Francis')\n            ->withLastName('Hilaire')\n            ->create()\n        ;\n\n        SpeakerFactory::new()\n            ->withFirstName('Gregor')\n            ->withLastName('Šink')\n            ->create()\n        ;\n\n        $this->client->request('GET', '/admin/speakers');\n        $response = $this->client->getResponse();\n\n        $this->assertSame(Response::HTTP_OK, $response->getStatusCode());\n        $content = $response->getContent();\n\n        $this->assertStringContainsString('<td>Francis Hilaire</td>', $content);\n        $this->assertStringContainsString('<td>Gregor Šink</td>', $content);\n    }\n\n    /** @test */\n    public function it_allows_accessing_speaker_creation_page(): void\n    {\n        $this->client->request('GET', '/admin/speakers/new');\n\n        $response = $this->client->getResponse();\n        $this->assertSame(Response::HTTP_OK, $response->getStatusCode());\n    }\n\n    /** @test */\n    public function it_allows_creating_a_speaker(): void\n    {\n        $this->client->request('GET', '/admin/speakers/new');\n        $this->client->submitForm('Create', [\n            'speaker[firstName]' => 'Francis',\n            'speaker[lastName]' => 'Hilaire',\n        ]);\n\n        $this->assertResponseRedirects(null, expectedCode: Response::HTTP_FOUND);\n\n        /** @var Speaker|null $speaker */\n        $speaker = static::getContainer()->get(EntityManagerInterface::class)->getRepository(Speaker::class)->findOneBy(['firstName' => 'Francis']);\n\n        $this->assertNotNull($speaker);\n        $this->assertSame('Francis Hilaire', $speaker->getFullName());\n    }\n\n    /** @test */\n    public function it_allows_updating_a_speaker(): void\n    {\n        $speaker = SpeakerFactory::createOne();\n\n        $this->client->request('GET', '/admin/speakers/' . $speaker->getId() . '/edit');\n        $this->client->submitForm('Save changes', [\n            'speaker[firstName]' => 'Francis',\n            'speaker[lastName]' => 'Hilaire',\n        ]);\n\n        $this->assertResponseRedirects(null, expectedCode: Response::HTTP_FOUND);\n\n        $speaker = refresh($speaker);\n        $this->assertSame('Francis Hilaire', $speaker->getFullName());\n    }\n\n    /** @test */\n    public function it_allows_deleting_a_speaker(): void\n    {\n        SpeakerFactory::createOne();\n\n        $this->client->request('GET', '/admin/speakers');\n        $this->client->submitForm('Delete');\n\n        $this->assertResponseRedirects(null, expectedCode: Response::HTTP_FOUND);\n\n        /** @var Speaker[] $speakers */\n        $speakers = static::getContainer()->get(EntityManagerInterface::class)->getRepository(Speaker::class)->findAll();\n\n        $this->assertEmpty($speakers);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Tests/Controller/SubscriptionJsonApiTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Tests\\Controller;\n\nuse App\\Kernel;\nuse App\\Subscription\\Foundry\\Factory\\SubscriptionFactory;\nuse App\\Subscription\\Foundry\\Story\\DefaultSubscriptionsStory;\nuse PHPUnit\\Framework\\Attributes\\Test;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Tests\\ApiTestCase;\nuse Zenstruck\\Foundry\\Attribute\\ResetDatabase;\n\n#[ResetDatabase]\nfinal class SubscriptionJsonApiTest extends ApiTestCase\n{\n    private static array $headers = [\n        'HTTP_CONTENT_TYPE' => 'application/json',\n        'HTTP_ACCEPT' => 'application/json',\n    ];\n\n    #[Test]\n    public function it_allows_showing_a_subscription(): void\n    {\n        $subscription = SubscriptionFactory::new()\n            ->withEmail('marty.mcfly@bttf.com')\n            ->create()\n        ;\n\n        $this->client->request(method: 'GET', uri: '/ajax/subscriptions/' . $subscription->getId(), server: self::$headers);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json; charset=utf-8');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"state\": \"new\",\n                \"email\": \"marty.mcfly@bttf.com\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_indexing_subscriptions(): void\n    {\n        DefaultSubscriptionsStory::load();\n\n        $this->client->request(method: 'GET', uri: '/ajax/subscriptions', server: self::$headers);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'application/json; charset=utf-8');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"items\": [\n                    {\n                        \"state\": \"new\",\n                        \"email\": \"marty.mcfly@bttf.com\"\n                    },\n                    {\n                        \"state\": \"new\",\n                        \"email\": \"doc.brown@bttf.com\"\n                    },\n                    {\n                        \"state\": \"accepted\",\n                        \"email\": \"biff.tannen@bttf.com\"\n                    },\n                    {\n                        \"state\": \"new\",\n                        \"email\": \"lorraine.baines@bttf.com\"\n                    },\n                    {\n                        \"state\": \"new\",\n                        \"email\": \"george.mcfly@bttf.com\"\n                    },\n                    {\n                        \"state\": \"new\",\n                        \"email\": \"jennifer.parker@bttf.com\"\n                    }\n                ],\n                \"pagination\": {\n                    \"current_page\": 1,\n                    \"has_previous_page\": false,\n                    \"has_next_page\": false,\n                    \"per_page\": 10,\n                    \"total_items\": 6,\n                    \"total_pages\": 1\n                }\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_creating_a_subscription(): void\n    {\n        $data =\n            <<<'JSON'\n            {\n                \"email\": \"marty.mcfly@bttf.com\"\n            }\n            JSON\n        ;\n\n        $this->client->request(method: 'POST', uri: '/ajax/subscriptions', server: self::$headers, content: $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_CREATED);\n        $this->assertResponseHeaderSame('content-type', 'application/json; charset=utf-8');\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"state\": \"new\",\n                \"email\": \"marty.mcfly@bttf.com\"\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_does_not_allow_to_create_a_subscription_if_there_is_a_validation_error(): void\n    {\n        $data =\n            <<<'JSON'\n            {\n                \"email\": \"\"\n            }\n            JSON\n        ;\n\n        $this->client->request(method: 'POST', uri: '/ajax/subscriptions', server: self::$headers, content: $data);\n\n        $this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);\n        $this->assertResponseHeaderSame('content-type', 'application/json; charset=utf-8');\n\n        if (Kernel::VERSION_ID < 60400) {\n            $this->assertResponseMatchesPattern(\n                <<<'JSON'\n                {\n                    \"type\": \"https://symfony.com/errors/validation\",\n                    \"title\": \"Validation Failed\",\n                    \"detail\": \"email: This value should not be blank.\",\n                    \"violations\": [\n                        {\n                            \"propertyPath\": \"email\",\n                            \"title\": \"This value should not be blank.\",\n                            \"parameters\": {\n                                \"{{ value }}\": \"\\\"\\\"\"\n                            },\n                            \"type\": \"urn:uuid:c1051bb4-d103-4f74-8988-acbcafc7fdc3\"\n                        }\n                    ]\n                }\n                JSON\n            );\n\n            return;\n        }\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"type\": \"https://symfony.com/errors/validation\",\n                \"title\": \"Validation Failed\",\n                \"detail\": \"email: This value should not be blank.\",\n                \"violations\": [\n                    {\n                        \"propertyPath\": \"email\",\n                        \"title\": \"This value should not be blank.\",\n                        \"template\": \"This value should not be blank.\",\n                        \"parameters\": {\n                            \"{{ value }}\": \"\\\"\\\"\"\n                        },\n                        \"type\": \"urn:uuid:c1051bb4-d103-4f74-8988-acbcafc7fdc3\"\n                    }\n                ]\n            }\n        JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_updating_a_subscription(): void\n    {\n        $subscription = SubscriptionFactory::createOne();\n\n        $data =\n            <<<'JSON'\n            {\n                \"email\": \"calvin.klein@bttf.com\"\n            }\n            JSON\n        ;\n\n        $this->client->request(method: 'PUT', uri: '/ajax/subscriptions/' . $subscription->getId(), server: self::$headers, content: $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_NO_CONTENT);\n    }\n\n    #[Test]\n    public function it_does_not_allow_to_update_a_subscription_if_there_is_a_validation_error(): void\n    {\n        $subscription = SubscriptionFactory::createOne();\n\n        $data =\n            <<<EOT\n        {\n            \"email\": \"\"\n        }\nEOT;\n\n        $this->client->request(method: 'PUT', uri: '/ajax/subscriptions/' . $subscription->getId(), server: self::$headers, content: $data);\n\n        $this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);\n        $this->assertResponseHeaderSame('content-type', 'application/json; charset=utf-8');\n\n        if (Kernel::VERSION_ID < 60400) {\n            $this->assertResponseMatchesPattern(\n                <<<'JSON'\n                {\n                    \"type\": \"https://symfony.com/errors/validation\",\n                    \"title\": \"Validation Failed\",\n                    \"detail\": \"email: This value should not be blank.\",\n                    \"violations\": [\n                        {\n                            \"propertyPath\": \"email\",\n                            \"title\": \"This value should not be blank.\",\n                            \"parameters\": {\n                                \"{{ value }}\": \"\\\"\\\"\"\n                            },\n                            \"type\": \"urn:uuid:c1051bb4-d103-4f74-8988-acbcafc7fdc3\"\n                        }\n                    ]\n                }\n                JSON\n            );\n\n            return;\n        }\n\n        $this->assertResponseMatchesPattern(\n            <<<'JSON'\n            {\n                \"type\": \"https://symfony.com/errors/validation\",\n                \"title\": \"Validation Failed\",\n                \"detail\": \"email: This value should not be blank.\",\n                \"violations\": [\n                    {\n                        \"propertyPath\": \"email\",\n                        \"title\": \"This value should not be blank.\",\n                        \"template\": \"This value should not be blank.\",\n                        \"parameters\": {\n                            \"{{ value }}\": \"\\\"\\\"\"\n                        },\n                        \"type\": \"urn:uuid:c1051bb4-d103-4f74-8988-acbcafc7fdc3\"\n                    }\n                ]\n            }\n            JSON\n        );\n    }\n\n    #[Test]\n    public function it_allows_removing_a_subscription(): void\n    {\n        $subscription = SubscriptionFactory::createOne();\n\n        $this->client->request(method: 'DELETE', uri: '/ajax/subscriptions/' . $subscription->getId(), server: self::$headers);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_NO_CONTENT);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Tests/Controller/SubscriptionUiTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Tests\\Controller;\n\nuse App\\Subscription\\Entity\\Subscription;\nuse App\\Subscription\\Foundry\\Factory\\SubscriptionFactory;\nuse App\\Subscription\\Foundry\\Story\\DefaultSubscriptionsStory;\nuse PHPUnit\\Framework\\Attributes\\Test;\nuse Symfony\\Bundle\\FrameworkBundle\\KernelBrowser;\nuse Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Workflow\\Registry;\nuse winzou\\Bundle\\StateMachineBundle\\winzouStateMachineBundle;\nuse Zenstruck\\Foundry\\Attribute\\ResetDatabase;\nuse function Zenstruck\\Foundry\\Persistence\\refresh;\n\n#[ResetDatabase]\nfinal class SubscriptionUiTest extends WebTestCase\n{\n    private KernelBrowser $client;\n\n    protected function setUp(): void\n    {\n        $this->client = self::createClient();\n    }\n\n    #[Test]\n    public function it_allows_showing_a_subscription(): void\n    {\n        $subscription = SubscriptionFactory::new()\n            ->withEmail('marty.mcfly@bttf.com')\n            ->create()\n        ;\n\n        $this->client->request('GET', '/admin/subscriptions/' . $subscription->getId());\n        $response = $this->client->getResponse();\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n\n        $content = $response->getContent();\n        $this->assertStringContainsString(sprintf('ID: %s', $subscription->getId()), $content);\n        $this->assertStringContainsString('Email: marty.mcfly@bttf.com', $content);\n        $this->assertStringContainsString('Foo: bar', $content);\n    }\n\n    #[Test]\n    public function it_allows_browsing_subscriptions(): void\n    {\n        DefaultSubscriptionsStory::load();\n\n        $docBrownSubscription = SubscriptionFactory::find(['email' => 'doc.brown@bttf.com']);\n        $biffTannenSubscription = SubscriptionFactory::find(['email' => 'biff.tannen@bttf.com']);\n\n        $this->client->request('GET', '/admin/subscriptions');\n        $response = $this->client->getResponse();\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n\n        $content = $response->getContent();\n\n        // only 5 subscriptions\n        if (method_exists($this, 'assertSelectorCount')) {\n            $this->assertSelectorCount(5, 'tbody tr');\n        }\n\n        $this->assertStringContainsString('<td>doc.brown@bttf.com</td>', $content);\n        $this->assertStringContainsString(sprintf('<a href=\"/admin/subscriptions/%s\">Show</a>', $docBrownSubscription->getId()), $content);\n        $this->assertStringContainsString(sprintf('<a href=\"/admin/subscriptions/%s/edit\">Edit</a>', $docBrownSubscription->getId()), $content);\n        $this->assertStringContainsString(sprintf('<form action=\"/admin/subscriptions/%s/delete\" method=\"post\">', $docBrownSubscription->getId()), $content);\n\n        $this->assertStringContainsString('<td>biff.tannen@bttf.com</td>', $content);\n        $this->assertStringContainsString(sprintf('<a href=\"/admin/subscriptions/%s\">Show</a>', $biffTannenSubscription->getId()), $content);\n        $this->assertStringContainsString(sprintf('<a href=\"/admin/subscriptions/%s/edit\">Edit</a>', $biffTannenSubscription->getId()), $content);\n        $this->assertStringContainsString(sprintf('<form action=\"/admin/subscriptions/%s/delete\" method=\"post\">', $biffTannenSubscription->getId()), $content);\n    }\n\n    #[Test]\n    public function it_allows_browsing_subscriptions_with_page_limit(): void\n    {\n        DefaultSubscriptionsStory::load();\n\n        $this->client->request('GET', '/admin/subscriptions?limit=3');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n\n        // only 2 subscriptions\n        if (method_exists($this, 'assertSelectorCount')) {\n            $this->assertSelectorCount(3, 'tbody tr');\n        }\n    }\n\n    #[Test]\n    public function it_allows_browsing_subscriptions_with_grid_limits(): void\n    {\n        DefaultSubscriptionsStory::load();\n\n        $this->client->request('GET', '/admin/subscriptions');\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n\n        // only 5 subscriptions\n        if (method_exists($this, 'assertSelectorCount')) {\n            $this->assertSelectorCount(5, 'tbody tr');\n        }\n    }\n\n    #[Test]\n    public function it_allows_creating_a_subscription(): void\n    {\n        $this->client->request('GET', '/admin/subscriptions/new');\n        $response = $this->client->getResponse();\n\n        $content = $response->getContent();\n\n        $this->assertStringContainsString('value=\"new@example.com\"', $content);\n\n        $this->client->submitForm('Create', [\n            'subscription[email]' => 'biff.tannen@bttf.com',\n        ]);\n\n        $this->assertResponseRedirects(null, expectedCode: Response::HTTP_FOUND);\n\n        /** @var Subscription $subscription */\n        $subscription = static::getContainer()->get('app.repository.subscription')->findOneBy(['email' => 'biff.tannen@bttf.com']);\n\n        $this->assertNotNull($subscription);\n        $this->assertSame('biff.tannen@bttf.com', (string) $subscription->email);\n    }\n\n    #[Test]\n    public function it_does_not_allow_to_create_a_subscription_if_there_is_a_validation_error(): void\n    {\n        $this->client->request('GET', '/admin/subscriptions/new');\n        $this->client->submitForm('Create', [\n            'subscription[email]' => null,\n        ]);\n\n        $this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);\n    }\n\n    #[Test]\n    public function it_allows_updating_a_subscription(): void\n    {\n        $subscription = SubscriptionFactory::createOne();\n\n        $this->client->request('GET', '/admin/subscriptions/' . $subscription->getId() . '/edit');\n        $this->client->submitForm('Save changes', [\n            'subscription[email]' => 'biff.tannen@bttf.com',\n        ]);\n\n        $this->assertResponseRedirects(null, expectedCode: Response::HTTP_FOUND);\n\n        $subscription = refresh($subscription);\n        $this->assertSame('biff.tannen@bttf.com', (string) $subscription->email);\n    }\n\n    #[Test]\n    public function it_does_not_allow_to_update_a_subscription_if_there_is_a_validation_error(): void\n    {\n        $subscription = SubscriptionFactory::createOne();\n\n        $this->client->request('GET', '/admin/subscriptions/' . $subscription->getId() . '/edit');\n        $this->client->submitForm('Save changes', [\n            'subscription[email]' => null,\n        ]);\n\n        $this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);\n    }\n\n    #[Test]\n    public function it_allows_deleting_a_subscription(): void\n    {\n        SubscriptionFactory::createOne();\n\n        $this->client->request('GET', '/admin/subscriptions');\n        $this->client->submitForm('Delete');\n\n        $this->assertResponseRedirects(null, expectedCode: Response::HTTP_FOUND);\n\n        /** @var Subscription[] $subscriptions */\n        $subscriptions = static::getContainer()->get('app.repository.subscription')->findAll();\n\n        $this->assertEmpty($subscriptions);\n    }\n\n    #[Test]\n    public function it_allows_deleting_multiple_subscriptions(): void\n    {\n        DefaultSubscriptionsStory::load();\n\n        $this->client->request('GET', '/admin/subscriptions?limit=10');\n        $this->client->submitForm('Bulk delete');\n\n        $this->assertResponseRedirects(null, expectedCode: Response::HTTP_FOUND);\n\n        /** @var Subscription[] $subscriptions */\n        $subscriptions = static::getContainer()->get('app.repository.subscription')->findAll();\n\n        $this->assertEmpty($subscriptions);\n    }\n\n    #[Test]\n    public function it_allows_accepting_a_subscription(): void\n    {\n        $this->markAsSkippedIfNoStateMachineIsAvailable();\n\n        $subscription = SubscriptionFactory::createOne();\n\n        $this->client->request('GET', '/admin/subscriptions');\n        $this->client->submitForm('Accept');\n\n        $this->assertResponseRedirects(null, expectedCode: Response::HTTP_FOUND);\n\n        $subscription = refresh($subscription);\n        $this->assertSame('accepted', $subscription->getState());\n    }\n\n    #[Test]\n    public function it_allows_accepting_multiple_subscription(): void\n    {\n        $this->markAsSkippedIfNoStateMachineIsAvailable();\n\n        DefaultSubscriptionsStory::load();\n        $martyMcFly = SubscriptionFactory::find(['email' => 'marty.mcfly@bttf.com']);\n        $docBrown = SubscriptionFactory::find(['email' => 'doc.brown@bttf.com']);\n\n        $this->client->request('GET', '/admin/subscriptions?limit=10');\n        $this->client->submitForm('Bulk accept');\n\n        $this->assertResponseRedirects(null, expectedCode: Response::HTTP_FOUND);\n\n        $martyMcFly = refresh($martyMcFly);\n        $this->assertSame('accepted', $martyMcFly->getState());\n\n        $docBrown = refresh($docBrown);\n        $this->assertSame('accepted', $docBrown->getState());\n    }\n\n    private function markAsSkippedIfNoStateMachineIsAvailable(): void\n    {\n        if (!class_exists(winzouStateMachineBundle::class) && !class_exists(Registry::class)) {\n            $this->markTestSkipped('No State machine is available.');\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Tests/Controller/SubscriptionXmlApiTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Tests\\Controller;\n\nuse App\\Kernel;\nuse App\\Subscription\\Foundry\\Factory\\SubscriptionFactory;\nuse App\\Subscription\\Foundry\\Story\\DefaultSubscriptionsStory;\nuse PHPUnit\\Framework\\Attributes\\Test;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Tests\\ApiTestCase;\nuse Zenstruck\\Foundry\\Attribute\\ResetDatabase;\n\n#[ResetDatabase]\nfinal class SubscriptionXmlApiTest extends ApiTestCase\n{\n    private static array $headers = [\n        'HTTP_CONTENT_TYPE' => 'application/xml',\n        'HTTP_ACCEPT' => 'application/xml',\n    ];\n\n    #[Test]\n    public function it_allows_showing_a_subscription(): void\n    {\n        $subscription = SubscriptionFactory::new()\n            ->withEmail('marty.mcfly@bttf.com')\n            ->create()\n        ;\n\n        $this->client->request('GET', '/ajax/subscriptions/' . $subscription->getId(), server: self::$headers);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'text/xml; charset=utf-8');\n\n        $this->assertResponseMatchesPattern(\n            <<<'XML'\n            <response>\n                <state>new</state>\n                <email>marty.mcfly@bttf.com</email>\n            </response>\n            XML\n        );\n    }\n\n    #[Test]\n    public function it_allows_indexing_subscriptions(): void\n    {\n        DefaultSubscriptionsStory::load();\n\n        $this->client->request('GET', '/ajax/subscriptions', server: self::$headers);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_OK);\n        $this->assertResponseHeaderSame('content-type', 'text/xml; charset=utf-8');\n\n        $this->assertResponseMatchesPattern(\n            <<<'XML'\n            <response>\n              <items>\n                <state>new</state>\n                <email>marty.mcfly@bttf.com</email>\n              </items>\n              <items>\n                <state>new</state>\n                <email>doc.brown@bttf.com</email>\n              </items>\n              <items>\n                <state>accepted</state>\n                <email>biff.tannen@bttf.com</email>\n              </items>\n              <items>\n                <state>new</state>\n                <email>lorraine.baines@bttf.com</email>\n              </items>\n              <items>\n                <state>new</state>\n                <email>george.mcfly@bttf.com</email>\n              </items>\n              <items>\n                <state>new</state>\n                <email>jennifer.parker@bttf.com</email>\n              </items>\n              <pagination>\n                <current_page>1</current_page>\n                <has_previous_page>0</has_previous_page>\n                <has_next_page>0</has_next_page>\n                <per_page>10</per_page>\n                <total_items>6</total_items>\n                <total_pages>1</total_pages>\n              </pagination>\n            </response>\n            XML\n        );\n    }\n\n    #[Test]\n    public function it_allows_creating_a_subscription(): void\n    {\n        $data =\n            <<<'XML'\n            <root>\n                <email>marty.mcfly@bttf.com</email>\n            </root>\n            XML\n        ;\n\n        $this->client->request(method: 'POST', uri: '/ajax/subscriptions', server: self::$headers, content: $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_CREATED);\n        $this->assertResponseHeaderSame('content-type', 'text/xml; charset=utf-8');\n\n        $this->assertResponseMatchesPattern(\n            <<<'XML'\n            <response>\n                <state>new</state>\n                <email>marty.mcfly@bttf.com</email>\n            </response>\n            XML\n        );\n    }\n\n    #[Test]\n    public function it_does_not_allow_to_create_a_subscription_if_there_is_a_validation_error(): void\n    {\n        $data =\n            <<<'XML'\n            <root>\n                <email></email>\n            </root>\n            XML\n        ;\n\n        $this->client->request(method: 'POST', uri: '/ajax/subscriptions', server: self::$headers, content: $data);\n\n        $this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);\n        $this->assertResponseHeaderSame('content-type', 'text/xml; charset=utf-8');\n\n        if (Kernel::VERSION_ID < 60400) {\n            $this->assertResponseMatchesPattern(\n                <<<'XML'\n                <response>\n                    <type>https://symfony.com/errors/validation</type>\n                    <title>Validation Failed</title>\n                    <detail>email: This value should not be blank.</detail>\n                    <violations>\n                        <propertyPath>email</propertyPath>\n                        <title>This value should not be blank.</title>\n                        <parameters>\n                            <item key=\"{{ value }}\">\"\"</item>\n                        </parameters>\n                        <type>urn:uuid:c1051bb4-d103-4f74-8988-acbcafc7fdc3</type>\n                    </violations>\n                </response>\n                XML\n            );\n\n            return;\n        }\n\n        $this->assertResponseMatchesPattern(\n            <<<'XML'\n            <response>\n                <type>https://symfony.com/errors/validation</type>\n                <title>Validation Failed</title>\n                <detail>email: This value should not be blank.</detail>\n                <violations>\n                    <propertyPath>email</propertyPath>\n                    <title>This value should not be blank.</title>\n                    <template>This value should not be blank.</template>\n                    <parameters>\n                        <item key=\"{{ value }}\">\"\"</item>\n                    </parameters>\n                    <type>urn:uuid:c1051bb4-d103-4f74-8988-acbcafc7fdc3</type>\n                </violations>\n            </response>\n            XML\n        );\n    }\n\n    #[Test]\n    public function it_allows_updating_a_subscription(): void\n    {\n        $subscription = SubscriptionFactory::createOne();\n\n        $data =\n            <<<'XML'\n            <root>\n                <email>calvin.klein@bttf.com</email>\n            </root>\n            XML\n        ;\n\n        $this->client->request(method: 'PUT', uri: '/ajax/subscriptions/' . $subscription->getId(), server: self::$headers, content: $data);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_NO_CONTENT);\n    }\n\n    #[Test]\n    public function it_does_not_allow_to_update_a_subscription_if_there_is_a_validation_error(): void\n    {\n        $subscription = SubscriptionFactory::createOne();\n\n        $data =\n            <<<'XML'\n            <root>\n                <email></email>\n            </root>\n            XML\n        ;\n\n        $this->client->request(method: 'PUT', uri: '/ajax/subscriptions/' . $subscription->getId(), server: self::$headers, content: $data);\n\n        $this->assertResponseStatusCodeSame(Response::HTTP_UNPROCESSABLE_ENTITY);\n        $this->assertResponseHeaderSame('content-type', 'text/xml; charset=utf-8');\n\n        if (Kernel::VERSION_ID < 60400) {\n            $this->assertResponseMatchesPattern(\n                <<<'XML'\n                <response>\n                    <type>https://symfony.com/errors/validation</type>\n                    <title>Validation Failed</title>\n                    <detail>email: This value should not be blank.</detail>\n                    <violations>\n                        <propertyPath>email</propertyPath>\n                        <title>This value should not be blank.</title>\n                        <parameters>\n                            <item key=\"{{ value }}\">\"\"</item>\n                        </parameters>\n                        <type>urn:uuid:c1051bb4-d103-4f74-8988-acbcafc7fdc3</type>\n                    </violations>\n                </response>\n                XML\n            );\n\n            return;\n        }\n\n        $this->assertResponseMatchesPattern(\n            <<<'XML'\n            <response>\n                <type>https://symfony.com/errors/validation</type>\n                <title>Validation Failed</title>\n                <detail>email: This value should not be blank.</detail>\n                <violations>\n                    <propertyPath>email</propertyPath>\n                    <title>This value should not be blank.</title>\n                    <template>This value should not be blank.</template>\n                    <parameters>\n                        <item key=\"{{ value }}\">\"\"</item>\n                    </parameters>\n                    <type>urn:uuid:c1051bb4-d103-4f74-8988-acbcafc7fdc3</type>\n                </violations>\n            </response>\n            XML\n        );\n    }\n\n    #[Test]\n    public function it_allows_removing_a_subscription(): void\n    {\n        $subscription = SubscriptionFactory::createOne();\n\n        $this->client->request(method: 'DELETE', uri: '/ajax/subscriptions/' . $subscription->getId(), server: self::$headers);\n\n        $this->assertResponseIsSuccessful();\n        $this->assertResponseStatusCodeSame(Response::HTTP_NO_CONTENT);\n    }\n}\n"
  },
  {
    "path": "tests/Application/src/Tests/Validator/TranslatableValidatorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace App\\Tests\\Validator;\n\nuse App\\Entity\\Book;\nuse App\\Foundry\\Story\\DefaultBooksStory;\nuse Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase;\nuse Symfony\\Component\\Validator\\Validator\\ValidatorInterface;\nuse Zenstruck\\Foundry\\Attribute\\ResetDatabase;\n\n#[ResetDatabase]\nfinal class TranslatableValidatorTest extends KernelTestCase\n{\n    /** @test */\n    public function it_fails_validation_with_empty_locale(): void\n    {\n        DefaultBooksStory::load();\n\n        $book = $this->getBookBy();\n        $book->getTranslation('pl_PL')->setLocale('');\n\n        $errors = $this->getValidator()->validate($book, null, ['sylius']);\n        $this->assertCount(1, $errors);\n        $this->assertSame('sylius.resource.translation.locale.not_blank', $errors->get(0)->getMessageTemplate());\n    }\n\n    /** @test */\n    public function it_fails_validation_with_invalid_locale(): void\n    {\n        DefaultBooksStory::load();\n\n        $book = $this->getBookBy();\n        $book->getTranslation('pl_PL')->setLocale('invalid');\n\n        $errors = $this->getValidator()->validate($book, null, ['sylius']);\n        $this->assertCount(1, $errors);\n        $this->assertSame('sylius.resource.translation.locale.invalid', $errors->get(0)->getMessageTemplate());\n    }\n\n    /** @test */\n    public function it_fails_validation_with_not_unique_locale(): void\n    {\n        DefaultBooksStory::load();\n\n        $book = $this->getBookBy();\n        $book->getTranslation('pl_PL')->setLocale('en_US');\n\n        $errors = $this->getValidator()->validate($book, null, ['sylius']);\n        $this->assertCount(1, $errors);\n        $this->assertSame('sylius.resource.translation.locale.unique', $errors->get(0)->getMessageTemplate());\n    }\n\n    private function getValidator(): ValidatorInterface\n    {\n        return self::getContainer()->get(ValidatorInterface::class);\n    }\n\n    private function getBookBy(array $criteria = ['author' => 'J.R.R. Tolkien']): ?Book\n    {\n        return self::getContainer()->get('app.repository.book')->findOneBy($criteria);\n    }\n}\n"
  },
  {
    "path": "tests/Application/templates/ScienceBook/create.html.twig",
    "content": "<h1>New Science Book</h1>\n\n{{ form_start(form) }}\n{{ form_widget(form) }}\n<br />\n<button type=\"submit\">Create</button>\n{{ form_end(form) }}\n"
  },
  {
    "path": "tests/Application/templates/ScienceBook/index.html.twig",
    "content": "<h1>Books</h1>\n<table>\n    <thead>\n        <tr>\n            <td>ID</td>\n            <td>Title</td>\n            <td>Author</td>\n            <td>Actions</td>\n        </tr>\n    </thead>\n    <tbody>\n    {% for book in resources.data %}\n        <tr><td>{{ book.id }}</td><td>{{ book.title }}</td><td>{{ book.authorFirstName }} {{ book.authorLastName }}</td>\n            <td>\n                <form action=\"{{ path('app_science_book_delete', {'id': book.id}) }}\" method=\"POST\">\n                    <input type=\"hidden\" name=\"_method\" value=\"DELETE\"/>\n                    <input type=\"hidden\" name=\"_csrf_token\" value=\"{{ csrf_token(book.id) }}\" />\n                    <button type=\"submit\">Delete</button>\n                </form>\n            </td>\n        </tr>\n    {% endfor %}\n    </tbody>\n</table>\n"
  },
  {
    "path": "tests/Application/templates/ScienceBook/show.html.twig",
    "content": "<h1>Science book</h1>\n\n<h3>ID: {{ resource.id }}</h3>\n<span>Title: {{ resource.title }}</span>\n<span>Author: {{ resource.authorFirstName }} {{ resource.authorLastName }}</span>\n"
  },
  {
    "path": "tests/Application/templates/ScienceBook/update.html.twig",
    "content": "<h1>Edit Science Book</h1>\n\n{{ form_start(form) }}\n<input type=\"hidden\" name=\"_method\" value=\"PUT\">\n{{ form_widget(form) }}\n<br />\n<button type=\"submit\">Save changes</button>\n{{ form_end(form) }}\n"
  },
  {
    "path": "tests/Application/templates/board_game/show.html.twig",
    "content": "<h1>Science book</h1>\n\n<h3>ID: {{ resource.id }}</h3>\n<span>Name: {{ resource.name }}</span>\n"
  },
  {
    "path": "tests/Application/templates/crud/create.html.twig",
    "content": "{% extends 'layout.html.twig' %}\n\n{% block body %}\n    <h1>{{ (operation.resource.applicationName ~ '.ui.new_' ~ operation.resource.name)|trans }}</h1>\n\n    {{ form_start(form, {'attr': {'novalidate': 'novalidate'}}) }}\n    {{ form_widget(form) }}\n    <br />\n    <button type=\"submit\">Create</button>\n    {{ form_end(form) }}\n{% endblock %}\n"
  },
  {
    "path": "tests/Application/templates/crud/index.html.twig",
    "content": "{% extends 'layout.html.twig' %}\n\n{% block body %}\n    <h1>{{ (operation.resource.applicationName ~ '.ui.' ~ operation.resource.pluralName)|trans }}</h1>\n\n    {% set grid = resources %}\n    {% set definition = grid.definition|default(null) %}\n\n    {% if definition.actionGroups.bulk is defined and definition.getEnabledActions('bulk')|length > 0 %}\n        {% for action in definition.getEnabledActions('bulk') %}\n            {{ sylius_grid_render_bulk_action(grid, action, null) }}\n        {% endfor %}\n    {% endif %}\n\n    {% if not definition %}\n        This template doesn't support non-grid data.\n    {% endif %}\n\n    {% if definition %}\n        <table>\n            <thead>\n            <tr>\n                {% for field in definition.fields %}\n                    {% if field.enabled %}\n                        <th class=\"sylius-table-column-{{ field.name }}\">{{ field.label|trans }}</th>\n                    {% endif %}\n                    {% if definition.actionGroups.item is defined and definition.getEnabledActions('item')|length > 0 %}\n                        <th class=\"sylius-table-column-actions\">Actions</th>\n                    {% endif %}\n                {% endfor %}\n            </tr>\n            </thead>\n            <tbody>\n            {% for resource in resources.data %}\n                <tr>\n                    {% for field in definition.enabledFields %}\n                        <td>{{ sylius_grid_render_field(grid, field, resource) }}</td>\n                        {% if definition.actionGroups.item is defined and definition.getEnabledActions('item')|length > 0 %}\n                            <td>\n                                {% for action in definition.getEnabledActions('item') %}\n                                    {{ sylius_grid_render_action(grid, action, resource) }}\n                                {% endfor %}\n                            </td>\n                        {% endif %}\n                    {% endfor %}\n                </tr>\n            {% endfor %}\n            </tbody>\n        </table>\n    {% endif %}\n{% endblock %}\n"
  },
  {
    "path": "tests/Application/templates/crud/update.html.twig",
    "content": "{% extends 'layout.html.twig' %}\n\n{% block body %}\n    <h1>{{ (operation.resource.applicationName ~ '.ui.edit_' ~ operation.resource.name)|trans }}</h1>\n\n    {{ form_start(form, {'attr': {'novalidate': 'novalidate'}}) }}\n    <input type=\"hidden\" name=\"_method\" value=\"PUT\" />\n    {{ form_widget(form) }}\n    <br />\n    <button type=\"submit\">Save changes</button>\n    {{ form_end(form) }}\n{% endblock %}\n"
  },
  {
    "path": "tests/Application/templates/grid/action/apply_transition.html.twig",
    "content": "{% set labeled = options.labeled is defined ? options.labeled : true %}\n\n{% if sylius_state_machine_can(data, options.transition, options.graph) %}\n    <form action=\"{{ path(options.link.route, options.link.parameters) }}\" method=\"post\">\n        <input type=\"hidden\" name=\"_csrf_token\" value=\"{{ csrf_token(data.id) }}\">\n        <input type=\"hidden\" name=\"_method\" value=\"PUT\">\n        <button class=\"ui loadable {{ options.class|default }} {% if labeled %}labeled{% endif %} icon button\" type=\"submit\" data-js-disable=\".sylius-grid-table-wrapper button, .sylius-grid-table-wrapper a\">\n            <i class=\"{{ action.icon }} icon\"></i>\n            {% if labeled %}{{ action.label|trans }}{% endif %}\n        </button>\n    </form>\n{% endif %}\n"
  },
  {
    "path": "tests/Application/templates/grid/action/delete.html.twig",
    "content": "{% set path = options.link.url|default(path(options.link.route|default(grid.requestConfiguration.getRouteName('delete')), options.link.parameters|default({'id': data.id}))) %}\n\n<form action=\"{{ path }}\" method=\"post\">\n    <input type=\"hidden\" name=\"_method\" value=\"DELETE\">\n    <button type=\"submit\">\n        Delete\n    </button>\n    <input type=\"hidden\" name=\"_csrf_token\" value=\"{{ csrf_token(data.id) }}\" />\n</form>\n"
  },
  {
    "path": "tests/Application/templates/grid/action/show.html.twig",
    "content": "{% set path = options.link.url|default(path(options.link.route|default(grid.requestConfiguration.getRouteName('show')), options.link.parameters|default({'id': data.id}))) %}\n\n<a href=\"{{ path }}\">Show</a>\n"
  },
  {
    "path": "tests/Application/templates/grid/action/update.html.twig",
    "content": "{% set path = options.link.url|default(path(options.link.route|default(grid.requestConfiguration.getRouteName('update')), options.link.parameters|default({'id': data.id}))) %}\n\n<a href=\"{{ path }}\">Edit</a>\n"
  },
  {
    "path": "tests/Application/templates/grid/bulk_action/apply_transition.html.twig",
    "content": "{% set labeled = true %}\n{% set message = action.label %}\n{% set path = options.link.url|default(path(options.link.route|default(grid.requestConfiguration.getRouteName('bulk_update')), options.link.parameters|default({}))) %}\n\n<form action=\"{{ path }}\" method=\"post\">\n    <input type=\"hidden\" name=\"_method\" value=\"PATCH\">\n    <button class=\"button\" type=\"submit\">\n        <i class=\"icon check\"></i> {{ ((message is empty and labeled) ? 'sylius.ui.bulk_update' : message)|trans }}\n    </button>\n    <input type=\"hidden\" name=\"_csrf_token\" value=\"{{ csrf_token('bulk_update') }}\" />\n\n    {% for resource in grid.data %}\n        <input type=\"hidden\" name=\"ids[]\" value=\"{{ resource.id }}\" />\n    {% endfor %}\n</form>\n"
  },
  {
    "path": "tests/Application/templates/grid/bulk_action/delete.html.twig",
    "content": "{% set path = options.link.url|default(path(options.link.route|default(grid.requestConfiguration.getRouteName('bulk_delete')), options.link.parameters|default({}))) %}\n\n<form action=\"{{ path }}\" method=\"post\">\n    <input type=\"hidden\" name=\"_method\" value=\"DELETE\">\n    <button type=\"submit\">\n        <i class=\"icon trash\"></i> Bulk delete\n    </button>\n    <input type=\"hidden\" name=\"_csrf_token\" value=\"{{ csrf_token('bulk_delete') }}\" />\n\n    {% for resource in grid.data %}\n        <input type=\"hidden\" name=\"ids[]\" value=\"{{ resource.id }}\" />\n    {% endfor %}\n</form>\n"
  },
  {
    "path": "tests/Application/templates/layout/_flashes.html.twig",
    "content": "{% if app.session is not null %}\n    {# Enforce starting session #}\n    {% set token = app.token %}\n{% endif %}\n\n{% if app.session is not null and app.session.started %}\n    {% for type in ['success', 'error', 'info', 'warning'] %}\n        {% for flash in app.session.flashbag.get(type) %}\n            <div class=\"alert alert-{{ type == 'error' ? 'danger' : type }}\" role=\"alert\">\n                <h4 class=\"alert-title\">\n                    {% set header = 'sylius.ui.' ~ type %}\n                    {{ header|trans }}\n                </h4>\n                <div class=\"message\">\n                    {% if flash is iterable %}\n                        {{ flash.message|trans(flash.parameters, 'flashes') }}\n                    {% else %}\n                        {{ flash|trans({}, 'flashes') }}\n                    {% endif %}\n                </div>\n            </div>\n        {% endfor %}\n    {% endfor %}\n    </div>\n{% endif %}\n"
  },
  {
    "path": "tests/Application/templates/layout.html.twig",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"UTF-8\">\n    <title>{% block title %}Sylius{% endblock %}</title>\n    <link rel=\"icon\" href=\"data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>\">\n</head>\n<body>\n{% include 'layout/_flashes.html.twig' %}\n\n{% block body %}\n{% endblock %}\n</body>\n</html>\n"
  },
  {
    "path": "tests/Application/templates/subscription/show.html.twig",
    "content": "{% extends 'layout.html.twig' %}\n\n{% block body %}\n    <h1>Subscription</h1>\n\n    <h3>ID: {{ resource.id }}</h3>\n    <ul>\n        <li>Email: {{ resource.email }}</li>\n        <li>Foo: {{ foo }}</li>\n    </ul>\n{% endblock %}\n"
  },
  {
    "path": "tests/Application/translations/messages.en.yaml",
    "content": "app:\n    ui:\n        board_games: Board games\n        edit_board_game: Edit board game\n        new_board_game: New board game\n        new_subscription: New subscription\n        speakers: Speakers\n"
  },
  {
    "path": "tests/Bundle/Command/DebugResourceCommandTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Command;\n\nuse PHPUnit\\Framework\\Attributes\\Test;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Command\\DebugResourceCommand;\nuse Sylius\\Resource\\Metadata\\Create;\nuse Sylius\\Resource\\Metadata\\Index;\nuse Sylius\\Resource\\Metadata\\Metadata;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\Operations;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\Factory\\ResourceMetadataCollectionFactoryInterface;\nuse Sylius\\Resource\\Metadata\\Resource\\ResourceMetadataCollection;\nuse Sylius\\Resource\\Metadata\\ResourceMetadata;\nuse Symfony\\Component\\Console\\Tester\\CommandTester;\n\nfinal class DebugResourceCommandTest extends TestCase\n{\n    private RegistryInterface|MockObject $registry;\n\n    private ResourceMetadataCollectionFactoryInterface|MockObject $resourceCollectionMetadataFactory;\n\n    private CommandTester $tester;\n\n    public function setUp(): void\n    {\n        $this->registry = $this->createMock(RegistryInterface::class);\n        $this->resourceCollectionMetadataFactory = $this->createMock(ResourceMetadataCollectionFactoryInterface::class);\n\n        $command = new DebugResourceCommand($this->registry, $this->resourceCollectionMetadataFactory);\n        $this->tester = new CommandTester($command);\n    }\n\n    /**\n     * @test\n     */\n    public function it_lists_all_resources_if_no_argument_is_given(): void\n    {\n        $this->registry->method('getAll')->willReturn([$this->createMetadata('one'), $this->createMetadata('two')]);\n\n        $this->tester->execute([]);\n        $display = $this->tester->getDisplay();\n\n        $this->assertEquals(\n            <<<TXT\n             ------------ \n              Alias       \n             ------------ \n              sylius.one  \n              sylius.two  \n             ------------ \n            \n            \n            TXT\n            ,\n            $display,\n        );\n    }\n\n    /**\n     * @test\n     */\n    public function it_displays_the_metadata_for_given_resource_alias_without_operations(): void\n    {\n        $this->registry->method('get')->with('metadata.one')->willReturn($this->createMetadata('one'));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection();\n\n        $this->resourceCollectionMetadataFactory->method('create')->with('App\\One')->willReturn($resourceMetadataCollection);\n\n        $this->tester->execute([\n            'resource' => 'metadata.one',\n        ]);\n\n        $display = $this->tester->getDisplay();\n\n        $this->assertStringContainsString('[INFO] This resource has no defined operations.', $display);\n    }\n\n    /**\n     * @test\n     */\n    public function it_displays_the_metadata_for_given_resource_alias_with_operations(): void\n    {\n        $this->registry->method('get')->with('metadata.one')->willReturn($this->createMetadata('one'));\n\n        $resourceMetadata = (new ResourceMetadata())->withOperations(new Operations([\n            'app_one_index' => new Index(name: 'app_one_index', provider: 'App\\GetOneItemProvider'),\n            'app_one_create' => new Create(name: 'app_one_create', processor: 'App\\CreateOneProcessor'),\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection([$resourceMetadata]);\n\n        $this->resourceCollectionMetadataFactory->method('create')->with('App\\One')->willReturn($resourceMetadataCollection);\n\n        $this->tester->execute([\n            'resource' => 'metadata.one',\n        ]);\n\n        $display = $this->tester->getDisplay();\n\n        $this->assertEquals(\n            <<<TXT\n            \n            Resource Metadata\n            -----------------\n            \n             ------------------------ ------- \n              Option                   Value  \n             ------------------------ ------- \n              alias                    null   \n              section                  null   \n              formType                 null   \n              templatesDir             null   \n              routePrefix              null   \n              routeRequirements        null   \n              routeCondition           null   \n              routePriority            null   \n              name                     null   \n              pluralName               null   \n              applicationName          null   \n              identifier               null   \n              normalizationContext     null   \n              denormalizationContext   null   \n              validationContext        null   \n              class                    null   \n              driver                   null   \n              vars                     null   \n             ------------------------ ------- \n            \n            Operations\n            ----------\n            \n             ---------------- --------------------------------------------------------------- \n              Name             Details                                                        \n             ---------------- --------------------------------------------------------------- \n              app_one_index    bin/console sylius:debug:resource metadata.one app_one_index   \n              app_one_create   bin/console sylius:debug:resource metadata.one app_one_create  \n             ---------------- --------------------------------------------------------------- \n            \n            \n            TXT\n            ,\n            $display,\n        );\n    }\n\n    /**\n     * @test\n     */\n    public function it_displays_the_metadata_for_given_resource_as_fully_qualified_class_name(): void\n    {\n        $this->registry->method('getByClass')->with('App\\Resource')->willReturn($this->createMetadata('one'));\n\n        $resourceMetadata = (new ResourceMetadata(alias: 'sylius.one'))->withOperations(new Operations([\n            'app_one_index' => new Index(name: 'app_one_index', provider: 'App\\GetOneItemProvider'),\n            'app_one_create' => new Create(name: 'app_one_create', processor: 'App\\CreateOneProcessor'),\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection([$resourceMetadata]);\n\n        $this->resourceCollectionMetadataFactory->method('create')->with('App\\One')->willReturn($resourceMetadataCollection);\n\n        $this->tester->execute([\n            'resource' => 'App\\Resource',\n        ]);\n\n        $display = $this->tester->getDisplay();\n\n        $this->assertEquals(\n            <<<TXT\n            \n            Resource Metadata\n            -----------------\n            \n             ------------------------ -------------- \n              Option                   Value         \n             ------------------------ -------------- \n              alias                    \"sylius.one\"  \n              section                  null          \n              formType                 null          \n              templatesDir             null          \n              routePrefix              null          \n              routeRequirements        null          \n              routeCondition           null          \n              routePriority            null          \n              name                     null          \n              pluralName               null          \n              applicationName          null          \n              identifier               null          \n              normalizationContext     null          \n              denormalizationContext   null          \n              validationContext        null          \n              class                    null          \n              driver                   null          \n              vars                     null          \n             ------------------------ -------------- \n            \n            Operations\n            ----------\n            \n             ---------------- --------------------------------------------------------------- \n              Name             Details                                                        \n             ---------------- --------------------------------------------------------------- \n              app_one_index    bin/console sylius:debug:resource App\\Resource app_one_index   \n              app_one_create   bin/console sylius:debug:resource App\\Resource app_one_create  \n             ---------------- --------------------------------------------------------------- \n            \n            \n            TXT\n            ,\n            $display,\n        );\n    }\n\n    /**\n     * @test\n     */\n    public function it_displays_the_metadata_for_given_resource_operation(): void\n    {\n        $this->registry->method('get')->with('metadata.one')->willReturn($this->createMetadata('one'));\n\n        $resourceMetadata = (new ResourceMetadata(alias: 'sylius.one'))->withOperations(new Operations([\n            'app_one_index' => new Index(name: 'app_one_index', provider: 'App\\GetOneItemProvider'),\n            'app_one_create' => new Create(\n                template: 'register.html.twig',\n                name: 'app_one_create',\n                provider: 'App\\ItemProvider',\n                processor: 'App\\CreateOneProcessor',\n                responder: 'App\\ItemResponder',\n                factory: 'App\\CreateOneFactory',\n                factoryMethod: 'createWithCreator',\n                factoryArguments: ['creator' => 'user'],\n                eventShortName: 'register',\n                vars: ['foo' => 'bar'],\n            ),\n        ]));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection([$resourceMetadata]);\n\n        $this->resourceCollectionMetadataFactory->method('create')->with('App\\One')->willReturn($resourceMetadataCollection);\n\n        $this->tester->execute([\n            'resource' => 'metadata.one',\n            'operation' => 'app_one_create',\n        ]);\n\n        $display = $this->tester->getDisplay();\n\n        $this->assertEquals(\n            <<<TXT\n            \n            Operation Metadata\n            ------------------\n            \n             ------------------------ -------------------------- \n              Option                   Value                     \n             ------------------------ -------------------------- \n              factory                  \"App\\CreateOneFactory\"    \n              factoryMethod            \"createWithCreator\"       \n              factoryArguments         [                         \n                                         \"creator\" => \"user\"     \n                                       ]                         \n              stateMachineComponent    null                      \n              stateMachineTransition   null                      \n              stateMachineGraph        null                      \n              twigContextFactory       null                      \n              methods                  [                         \n                                         \"GET\",                  \n                                         \"POST\"                  \n                                       ]                         \n              path                     null                      \n              routeName                null                      \n              routePrefix              null                      \n              routeRequirements        null                      \n              routeCondition           null                      \n              routePriority            null                      \n              redirectTo               null                      \n              redirectToRoute          null                      \n              redirectArguments        null                      \n              vars                     [                         \n                                         \"foo\" => \"bar\"          \n                                       ]                         \n              provider                 \"App\\ItemProvider\"        \n              processor                \"App\\CreateOneProcessor\"  \n              responder                \"App\\ItemResponder\"       \n              repository               null                      \n              template                 \"register.html.twig\"      \n              shortName                \"create\"                  \n              name                     \"app_one_create\"          \n              repositoryMethod         null                      \n              repositoryArguments      null                      \n              read                     null                      \n              write                    null                      \n              validate                 null                      \n              deserialize              null                      \n              serialize                null                      \n              formType                 null                      \n              formOptions              null                      \n              normalizationContext     null                      \n              denormalizationContext   null                      \n              validationContext        null                      \n              eventShortName           \"register\"                \n              notificationMessage      null                      \n              security                 null                      \n              securityMessage          null                      \n             ------------------------ -------------------------- \n            \n            \n            TXT\n            ,\n            $display,\n        );\n    }\n\n    #[Test]\n    public function it_displays_the_legacy_resource_metadata_for_given_resource_alias(): void\n    {\n        $this->registry->method('get')->with('metadata.one')->willReturn($this->createMetadata('one'));\n\n        $resourceMetadata = (new ResourceMetadata(alias: 'sylius.one'));\n\n        $resourceMetadataCollection = new ResourceMetadataCollection([$resourceMetadata]);\n\n        $this->resourceCollectionMetadataFactory->method('create')->with('App\\One')->willReturn($resourceMetadataCollection);\n\n        $this->tester->execute([\n            'resource' => 'metadata.one',\n            '--legacy' => true,\n        ]);\n\n        $display = $this->tester->getDisplay();\n\n        $this->assertEquals(\n            <<<TXT\n            \n            Configuration\n            -------------\n            \n             ----------------------- ----------------------------- \n              Option                  Value                        \n             ----------------------- ----------------------------- \n              name                    \"one\"                        \n              applicationName         \"sylius\"                     \n              driver                  \"doctrine/foobar\"            \n              stateMachineComponent   null                         \n              templatesNamespace      null                         \n              classes                 [                            \n                                        \"model\" => \"App\\One\",      \n                                        \"foo\" => \"bar\",            \n                                        \"bar\" => \"foo\"             \n                                      ]                            \n              whatever                [                            \n                                        \"something\" => [           \n                                          \"elephants\" => \"camels\"  \n                                        ]                          \n                                      ]                            \n             ----------------------- ----------------------------- \n            \n            \n            TXT\n            ,\n            $display,\n        );\n    }\n\n    private function createMetadata(string $suffix): MetadataInterface\n    {\n        return Metadata::fromAliasAndConfiguration(sprintf('sylius.%s', $suffix), [\n            'driver' => 'doctrine/foobar',\n            'classes' => [\n                'model' => 'App\\\\' . ucfirst($suffix),\n                'foo' => 'bar',\n                'bar' => 'foo',\n            ],\n            'whatever' => [\n                'something' => [\n                    'elephants' => 'camels',\n                ],\n            ],\n        ]);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Configuration/ConfigurationTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Configuration;\n\nuse Matthias\\SymfonyConfigTest\\PhpUnit\\ConfigurationTestCaseTrait;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Configuration;\nuse Symfony\\Component\\Config\\Definition\\ConfigurationInterface;\n\nclass ConfigurationTest extends TestCase\n{\n    use ConfigurationTestCaseTrait;\n\n    /** @test */\n    public function it_does_not_break_if_not_customized(): void\n    {\n        $this->assertConfigurationIsValid(\n            [\n                [],\n            ],\n        );\n    }\n\n    /** @test */\n    public function it_has_no_default_drivers(): void\n    {\n        $this->assertProcessedConfigurationEquals(\n            [],\n            [\n                'drivers' => [],\n            ],\n            'drivers',\n        );\n    }\n\n    /** @test */\n    public function its_drivers_can_be_customized(): void\n    {\n        $this->assertProcessedConfigurationEquals(\n            [\n                ['drivers' => [\n                    'doctrine/orm',\n                ]],\n            ],\n            [\n                'drivers' => [\n                    'doctrine/orm',\n                ],\n            ],\n            'drivers',\n        );\n    }\n\n    /** @test */\n    public function it_has_no_default_mapping_paths(): void\n    {\n        $this->assertProcessedConfigurationEquals(\n            [\n                [],\n            ],\n            [\n                'mapping' => [\n                    'imports' => [],\n                    'paths' => [],\n                ],\n            ],\n            'mapping',\n        );\n    }\n\n    /** @test */\n    public function its_mapping_paths_can_be_customized(): void\n    {\n        $this->assertProcessedConfigurationEquals(\n            [\n                ['mapping' => [\n                    'paths' => ['path/to/resources'],\n                ]],\n            ],\n            [\n                'mapping' => [\n                    'imports' => [],\n                    'paths' => [\n                        'path/to/resources',\n                    ],\n                ],\n            ],\n            'mapping',\n        );\n    }\n\n    /** @test */\n    public function its_default_templates_dir_can_be_customized(): void\n    {\n        $this->assertProcessedConfigurationEquals(\n            [\n                ['settings' => [\n                    'default_templates_dir' => 'path/to/templates',\n                ]],\n            ],\n            [\n                'settings' => [\n                    'default_templates_dir' => 'path/to/templates',\n                ],\n            ],\n            'settings.default_templates_dir',\n        );\n    }\n\n    /** @test */\n    public function it_has_default_authorization_checker(): void\n    {\n        $this->assertProcessedConfigurationEquals(\n            [\n                [],\n            ],\n            ['authorization_checker' => 'sylius.resource_controller.authorization_checker.disabled'],\n            'authorization_checker',\n        );\n    }\n\n    /** @test */\n    public function its_authorization_checker_can_be_customized(): void\n    {\n        $this->assertProcessedConfigurationEquals(\n            [\n                ['authorization_checker' => 'custom_service'],\n            ],\n            ['authorization_checker' => 'custom_service'],\n            'authorization_checker',\n        );\n    }\n\n    /** @test */\n    public function its_authorization_checker_cannot_be_empty(): void\n    {\n        $this->assertPartialConfigurationIsInvalid(\n            [\n                ['authorization_checker' => ''],\n            ],\n            'authorization_checker',\n        );\n    }\n\n    protected function getConfiguration(): ConfigurationInterface\n    {\n        return new Configuration();\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Context/Initiator/LegacyRequestContextInitiatorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Context\\Initiator;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Context\\Initiator\\LegacyRequestContextInitiator;\nuse Sylius\\Bundle\\ResourceBundle\\Context\\Option\\RequestConfigurationOption;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfigurationFactoryInterface;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Initiator\\RequestContextInitiatorInterface;\nuse Sylius\\Resource\\Context\\Option\\MetadataOption;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class LegacyRequestContextInitiatorTest extends TestCase\n{\n    private RegistryInterface|MockObject $resourceRegistryMock;\n\n    private RequestConfigurationFactoryInterface|MockObject $requestConfigurationFactoryMock;\n\n    private RequestContextInitiatorInterface|MockObject $decoratedMock;\n\n    private LegacyRequestContextInitiator $legacyRequestContextInitiator;\n\n    private Request|MockObject $requestMock;\n\n    private MetadataInterface|MockObject $metadataMock;\n\n    private RequestConfiguration|MockObject $requestConfigurationMock;\n\n    protected function setUp(): void\n    {\n        $this->resourceRegistryMock = $this->createMock(RegistryInterface::class);\n        $this->requestConfigurationFactoryMock = $this->createMock(RequestConfigurationFactoryInterface::class);\n        $this->decoratedMock = $this->createMock(RequestContextInitiatorInterface::class);\n        $this->legacyRequestContextInitiator = new LegacyRequestContextInitiator(\n            $this->resourceRegistryMock,\n            $this->requestConfigurationFactoryMock,\n            $this->decoratedMock,\n        );\n        $this->requestMock = $this->createMock(Request::class);\n        $this->metadataMock = $this->createMock(MetadataInterface::class);\n        $this->requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n    }\n\n    public function testAddsMetadataAndRequestConfigurationToTheContext(): void\n    {\n        $parameterBag = new ParameterBag(['_sylius' => ['resource' => 'app.dummy']]);\n\n        $this->requestConfigurationMock->expects($this->once())->method('getParameters')->willReturn($parameterBag);\n        $this->requestConfigurationMock->expects($this->once())->method('getVars')->willReturn([]);\n\n        $this->requestMock->attributes = $parameterBag;\n\n        $this->decoratedMock\n            ->expects($this->once())\n            ->method('initializeContext')\n            ->with($this->requestMock)\n            ->willReturn(new Context())\n        ;\n\n        $this->resourceRegistryMock\n            ->expects($this->once())\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn($this->metadataMock)\n        ;\n\n        $this->requestConfigurationFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($this->metadataMock, $this->requestMock)\n            ->willReturn($this->requestConfigurationMock)\n        ;\n\n        $result = $this->legacyRequestContextInitiator->initializeContext($this->requestMock);\n\n        $this->assertInstanceOf(Context::class, $result);\n        $this->assertSame($this->metadataMock, $result->get(MetadataOption::class)?->metadata());\n        $this->assertSame(\n            $this->requestConfigurationMock,\n            $result->get(RequestConfigurationOption::class)?->requestConfiguration(),\n        );\n    }\n\n    public function testDirectlyReturnsTheContextWhenRequestHasNoSyliusAttributes(): void\n    {\n        $this->requestMock->attributes = new ParameterBag();\n\n        $this->decoratedMock\n            ->expects($this->once())\n            ->method('initializeContext')\n            ->with($this->requestMock)\n            ->willReturn(new Context())\n        ;\n\n        $this->resourceRegistryMock\n            ->expects($this->never())\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn($this->metadataMock)\n        ;\n\n        $this->requestConfigurationFactoryMock\n            ->expects($this->never())\n            ->method('create')\n            ->with($this->metadataMock, $this->requestMock)\n            ->willReturn($this->requestConfigurationMock)\n        ;\n\n        $result = $this->legacyRequestContextInitiator->initializeContext($this->requestMock);\n\n        $this->assertInstanceOf(Context::class, $result);\n        $this->assertNull($result->get(MetadataOption::class));\n        $this->assertNull($result->get(RequestConfigurationOption::class));\n    }\n\n    public function testDirectlyReturnsTheContextWhenRequestHasNoResourceOnAttributes(): void\n    {\n        $this->requestMock->attributes = new ParameterBag(['_sylius' => ['section' => 'admin']]);\n\n        $this->decoratedMock\n            ->expects($this->once())\n            ->method('initializeContext')\n            ->with($this->requestMock)\n            ->willReturn(new Context())\n        ;\n\n        $this->resourceRegistryMock\n            ->expects($this->never())\n            ->method('get')\n            ->with('app.dummy')\n            ->willReturn($this->metadataMock)\n        ;\n\n        $this->requestConfigurationFactoryMock\n            ->expects($this->never())\n            ->method('create')\n            ->with($this->metadataMock, $this->requestMock)\n            ->willReturn($this->requestConfigurationMock)\n        ;\n\n        $result = $this->legacyRequestContextInitiator->initializeContext($this->requestMock);\n\n        $this->assertInstanceOf(Context::class, $result);\n        $this->assertNull($result->get(MetadataOption::class));\n        $this->assertNull($result->get(RequestConfigurationOption::class));\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Context/Option/RequestConfigurationOptionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Context\\Option;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Context\\Option\\RequestConfigurationOption;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\n\nfinal class RequestConfigurationOptionTest extends TestCase\n{\n    private RequestConfiguration|MockObject $requestConfigurationMock;\n\n    private RequestConfigurationOption $requestConfigurationOption;\n\n    protected function setUp(): void\n    {\n        $this->requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        $this->requestConfigurationOption = new RequestConfigurationOption($this->requestConfigurationMock);\n    }\n\n    public function testReturnsRequestConfiguration(): void\n    {\n        $this->assertSame($this->requestConfigurationMock, $this->requestConfigurationOption->requestConfiguration());\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/DisabledAuthorizationCheckerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\AuthorizationCheckerInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\DisabledAuthorizationChecker;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\n\nfinal class DisabledAuthorizationCheckerTest extends TestCase\n{\n    private DisabledAuthorizationChecker $disabledAuthorizationChecker;\n\n    protected function setUp(): void\n    {\n        $this->disabledAuthorizationChecker = new DisabledAuthorizationChecker();\n    }\n\n    public function testImplementsResourceControllerAuthorizationCheckerInterface(): void\n    {\n        $this->assertInstanceOf(AuthorizationCheckerInterface::class, $this->disabledAuthorizationChecker);\n    }\n\n    public function testAlwaysReturnsTrue(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        $this->assertTrue($this->disabledAuthorizationChecker->isGranted($requestConfigurationMock, 'create'));\n        $this->assertTrue($this->disabledAuthorizationChecker->isGranted($requestConfigurationMock, 'update'));\n        $this->assertTrue($this->disabledAuthorizationChecker->isGranted($requestConfigurationMock, 'custom'));\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/EventDispatcherTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse Doctrine\\Common\\Collections\\Collection;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\EventDispatcher;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\EventDispatcherInterface as ControllerEventDispatcherInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Sylius\\Resource\\ResourceActions;\nuse Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface;\n\nfinal class EventDispatcherTest extends TestCase\n{\n    private MockObject $eventDispatcherMock;\n\n    private EventDispatcher $eventDispatcher;\n\n    protected function setUp(): void\n    {\n        $this->eventDispatcherMock = $this->createMock(EventDispatcherInterface::class);\n        $this->eventDispatcher = new EventDispatcher($this->eventDispatcherMock);\n    }\n\n    public function testImplementsEventDispatcherInterface(): void\n    {\n        $this->assertInstanceOf(ControllerEventDispatcherInterface::class, $this->eventDispatcher);\n    }\n\n    public function testDispatchesAppropriateEventForAResource(): void\n    {\n        $requestConfiguration = $this->createRequestConfiguration(null);\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->expectEventDispatched('sylius.product.show');\n\n        $result = $this->eventDispatcher->dispatch(ResourceActions::SHOW, $requestConfiguration, $resource);\n\n        $this->assertInstanceOf(ResourceControllerEvent::class, $result);\n    }\n\n    public function testDispatchesAppropriateCustomEventForAResource(): void\n    {\n        $requestConfiguration = $this->createRequestConfiguration('register');\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->expectEventDispatched('sylius.product.register');\n\n        $result = $this->eventDispatcher->dispatch(ResourceActions::CREATE, $requestConfiguration, $resource);\n\n        $this->assertInstanceOf(ResourceControllerEvent::class, $result);\n    }\n\n    public function testDispatchesEventForACollectionOfResources(): void\n    {\n        $requestConfiguration = $this->createRequestConfiguration('register');\n        $resources = $this->createMock(Collection::class);\n\n        $this->expectEventDispatched('sylius.product.register');\n\n        $result = $this->eventDispatcher->dispatchMultiple(ResourceActions::CREATE, $requestConfiguration, $resources);\n\n        $this->assertInstanceOf(ResourceControllerEvent::class, $result);\n    }\n\n    public function testDispatchesAppropriatePreEventForAResource(): void\n    {\n        $requestConfiguration = $this->createRequestConfiguration(null);\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->expectEventDispatched('sylius.product.pre_create');\n\n        $this->eventDispatcher->dispatchPreEvent(ResourceActions::CREATE, $requestConfiguration, $resource);\n    }\n\n    public function testDispatchesAppropriateCustomPreEventForAResource(): void\n    {\n        $requestConfiguration = $this->createRequestConfiguration('register');\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->expectEventDispatched('sylius.product.pre_register');\n\n        $this->eventDispatcher->dispatchPreEvent(ResourceActions::CREATE, $requestConfiguration, $resource);\n    }\n\n    public function testDispatchesAppropriatePostEventForAResource(): void\n    {\n        $requestConfiguration = $this->createRequestConfiguration(null);\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->expectEventDispatched('sylius.product.post_create');\n\n        $this->eventDispatcher->dispatchPostEvent(ResourceActions::CREATE, $requestConfiguration, $resource);\n    }\n\n    public function testDispatchesAppropriateCustomPostEventForAResource(): void\n    {\n        $requestConfiguration = $this->createRequestConfiguration('register');\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->expectEventDispatched('sylius.product.post_register');\n\n        $result = $this->eventDispatcher->dispatchPostEvent(ResourceActions::CREATE, $requestConfiguration, $resource);\n\n        $this->assertInstanceOf(ResourceControllerEvent::class, $result);\n    }\n\n    /**\n     * @return MockObject&RequestConfiguration\n     */\n    private function createRequestConfiguration(?string $customEvent): MockObject\n    {\n        /** @var MockObject&MetadataInterface $metadata */\n        $metadata = $this->createMock(MetadataInterface::class);\n        $metadata->method('getApplicationName')->willReturn('sylius');\n        $metadata->method('getName')->willReturn('product');\n\n        /** @var MockObject&RequestConfiguration $requestConfiguration */\n        $requestConfiguration = $this->createMock(RequestConfiguration::class);\n        $requestConfiguration->method('getEvent')->willReturn($customEvent);\n        $requestConfiguration->method('getMetadata')->willReturn($metadata);\n\n        return $requestConfiguration;\n    }\n\n    private function expectEventDispatched(string $eventName): void\n    {\n        $this->eventDispatcherMock\n            ->expects($this->once())\n            ->method('dispatch')\n            ->with(\n                $this->isInstanceOf(ResourceControllerEvent::class),\n                $eventName,\n            );\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/FlashHelperTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse PHPUnit\\Framework\\Attributes\\CoversClass;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\FlashHelper;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\RequestStack;\nuse Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBag;\nuse Symfony\\Component\\HttpFoundation\\Session\\Session;\nuse Symfony\\Component\\HttpFoundation\\Session\\Storage\\MockArraySessionStorage;\nuse Symfony\\Contracts\\Translation\\TranslatorInterface;\n\n#[CoversClass(FlashHelper::class)]\nfinal class FlashHelperTest extends TestCase\n{\n    private FlashHelper $flashHelper;\n\n    private Session $session;\n\n    /** @var TranslatorInterface&MockObject */\n    private TranslatorInterface $translator;\n\n    protected function setUp(): void\n    {\n        $this->session = new Session(new MockArraySessionStorage());\n        $this->session->registerBag(new FlashBag());\n\n        $requestStack = new RequestStack();\n        $request = new Request();\n        $request->setSession($this->session);\n        $requestStack->push($request);\n\n        $this->translator = $this->createMock(TranslatorInterface::class);\n\n        $this->flashHelper = new FlashHelper($requestStack, $this->translator, 'en_US');\n    }\n\n    public function testAddsSuccessFlashWithTranslatedResourceNameForSingleResource(): void\n    {\n        $this->configureTranslator(['app.ui.product' => 'Product']);\n        $requestConfiguration = $this->createRequestConfiguration('product', 'sylius.resource.create');\n\n        $this->flashHelper->addSuccessFlash($requestConfiguration, 'create');\n\n        $this->assertFlashMessage('success', 'sylius.resource.create', ['%resource%' => 'Product']);\n    }\n\n    public function testAddsSuccessFlashWithTranslatedPluralResourceNameForBulkAction(): void\n    {\n        $this->configureTranslator(['app.ui.products' => 'Products']);\n        $requestConfiguration = $this->createRequestConfiguration('product', 'sylius.resource.bulk_delete', 'products');\n\n        $this->flashHelper->addSuccessFlash($requestConfiguration, 'bulk_delete');\n\n        $this->assertFlashMessage('success', 'sylius.resource.bulk_delete', ['%resources%' => 'Products']);\n    }\n\n    public function testConvertsCamelCaseToSnakeCaseForResourceNames(): void\n    {\n        $this->configureTranslator(['app.ui.product_variant' => 'Product Variant']);\n        $requestConfiguration = $this->createRequestConfiguration('productVariant', 'sylius.resource.update');\n\n        $this->flashHelper->addSuccessFlash($requestConfiguration, 'update');\n\n        $this->assertFlashMessage('success', 'sylius.resource.update', ['%resource%' => 'Product Variant']);\n    }\n\n    public function testConvertsCamelCaseToSnakeCaseForPluralResourceNames(): void\n    {\n        $this->configureTranslator(['app.ui.product_variants' => 'Product Variants']);\n        $requestConfiguration = $this->createRequestConfiguration('productVariant', 'sylius.resource.bulk_update', 'productVariants');\n\n        $this->flashHelper->addSuccessFlash($requestConfiguration, 'bulk_update');\n\n        $this->assertFlashMessage('success', 'sylius.resource.bulk_update', ['%resources%' => 'Product Variants']);\n    }\n\n    public function testAddsErrorFlashWithTranslatedResourceName(): void\n    {\n        $this->configureTranslator(['app.ui.customer' => 'Customer']);\n        $requestConfiguration = $this->createRequestConfiguration('customer', 'sylius.resource.delete');\n\n        $this->flashHelper->addErrorFlash($requestConfiguration, 'delete');\n\n        $this->assertFlashMessage('error', 'sylius.resource.delete', ['%resource%' => 'Customer']);\n    }\n\n    public function testDoesNotAddFlashWhenMessageIsEmpty(): void\n    {\n        $this->configureTranslator(['sylius.ui.product' => 'Product']);\n        $requestConfiguration = $this->createRequestConfiguration('product', '');\n\n        $this->flashHelper->addSuccessFlash($requestConfiguration, 'create');\n\n        $this->assertFlashCount('success', 0);\n    }\n\n    public function testTranslatesResourceNameToGerman(): void\n    {\n        $this->configureTranslator(['app.ui.product' => 'Produkt']);\n        $requestConfiguration = $this->createRequestConfiguration('product', 'sylius.resource.create');\n\n        $this->flashHelper->addSuccessFlash($requestConfiguration, 'create');\n\n        $this->assertFlashMessage('success', 'sylius.resource.create', ['%resource%' => 'Produkt']);\n    }\n\n    public function testTranslatesPluralResourceNameToGerman(): void\n    {\n        $this->configureTranslator(['app.ui.products' => 'Produkte']);\n        $requestConfiguration = $this->createRequestConfiguration('product', 'sylius.resource.bulk_delete', 'products');\n\n        $this->flashHelper->addSuccessFlash($requestConfiguration, 'bulk_delete');\n\n        $this->assertFlashMessage('success', 'sylius.resource.bulk_delete', ['%resources%' => 'Produkte']);\n    }\n\n    public function testTranslatesResourceNameToGermanForUpdate(): void\n    {\n        $this->configureTranslator(['app.ui.customer' => 'Kunde']);\n        $requestConfiguration = $this->createRequestConfiguration('customer', 'sylius.resource.update');\n\n        $this->flashHelper->addSuccessFlash($requestConfiguration, 'update');\n\n        $this->assertFlashMessage('success', 'sylius.resource.update', ['%resource%' => 'Kunde']);\n    }\n\n    private function createRequestConfiguration(string $resourceName, string $flashMessage, ?string $pluralName = null, ?string $applicationName = null): RequestConfiguration\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $metadata->method('getName')->willReturn($resourceName);\n        $metadata->method('getApplicationName')->willReturn($applicationName ?? 'app');\n\n        if ($pluralName !== null) {\n            $metadata->method('getPluralName')->willReturn($pluralName);\n        }\n\n        $requestConfiguration = $this->createMock(RequestConfiguration::class);\n        $requestConfiguration->method('getMetadata')->willReturn($metadata);\n        $requestConfiguration->method('getFlashMessage')->willReturn($flashMessage);\n\n        return $requestConfiguration;\n    }\n\n    /**\n     * @param array<string, string> $translations\n     */\n    private function configureTranslator(array $translations): void\n    {\n        $this->translator\n            ->method('trans')\n            ->willReturnCallback(function (string $id, array $parameters, string $domain) use ($translations) {\n                if ($domain === 'messages' && isset($translations[$id])) {\n                    return $translations[$id];\n                }\n\n                return $id;\n            });\n    }\n\n    /**\n     * @param array<string, string> $expectedParameters\n     */\n    private function assertFlashMessage(string $type, string $expectedMessage, array $expectedParameters): void\n    {\n        $flashes = $this->session->getFlashBag()->get($type);\n        $this->assertCount(1, $flashes);\n        $this->assertSame($expectedMessage, $flashes[0]['message']);\n        $this->assertSame($expectedParameters, $flashes[0]['parameters']);\n    }\n\n    private function assertFlashCount(string $type, int $expectedCount): void\n    {\n        $flashes = $this->session->getFlashBag()->get($type);\n        $this->assertCount($expectedCount, $flashes);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/NewResourceFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\NewResourceFactory;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\NewResourceFactoryInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Resource\\Factory\\FactoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\nfinal class NewResourceFactoryTest extends TestCase\n{\n    private NewResourceFactory $newResourceFactory;\n\n    protected function setUp(): void\n    {\n        $this->newResourceFactory = new NewResourceFactory();\n    }\n\n    public function testImplementsNewResourceFactoryInterface(): void\n    {\n        $this->assertInstanceOf(NewResourceFactoryInterface::class, $this->newResourceFactory);\n    }\n\n    public function testCallsCreateNewByDefaultIfNoCustomMethodConfigured(): void\n    {\n        $requestConfiguration = $this->createRequestConfiguration(null, []);\n        $factory = $this->createMock(FactoryInterface::class);\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $factory\n            ->expects($this->once())\n            ->method('createNew')\n            ->willReturn($resource);\n\n        $result = $this->newResourceFactory->create($requestConfiguration, $factory);\n\n        $this->assertSame($resource, $result);\n    }\n\n    public function testCallsProperFactoryMethodsBasedOnConfiguration(): void\n    {\n        $requestConfiguration = $this->createRequestConfiguration('createNew', ['00032']);\n        $factory = $this->createMock(FactoryInterface::class);\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $factory\n            ->expects($this->once())\n            ->method('createNew')\n            ->with('00032')\n            ->willReturn($resource);\n\n        $result = $this->newResourceFactory->create($requestConfiguration, $factory);\n\n        $this->assertSame($resource, $result);\n    }\n\n    public function testCallsProperServiceBasedOnConfiguration(): void\n    {\n        $customFactory = $this->createMock(FactoryInterface::class);\n        $requestConfiguration = $this->createRequestConfiguration([$customFactory, 'createNew'], ['foo', 'bar']);\n        $factory = $this->createMock(FactoryInterface::class);\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $customFactory\n            ->expects($this->once())\n            ->method('createNew')\n            ->with('foo', 'bar')\n            ->willReturn($resource);\n\n        $factory\n            ->expects($this->never())\n            ->method('createNew');\n\n        $result = $this->newResourceFactory->create($requestConfiguration, $factory);\n\n        $this->assertSame($resource, $result);\n    }\n\n    /**\n     * @param string|array<object|string>|null $factoryMethod\n     * @param array<mixed> $factoryArguments\n     *\n     * @return MockObject&RequestConfiguration\n     */\n    private function createRequestConfiguration(string|array|null $factoryMethod, array $factoryArguments): MockObject\n    {\n        /** @var MockObject&RequestConfiguration $requestConfiguration */\n        $requestConfiguration = $this->createMock(RequestConfiguration::class);\n        $requestConfiguration->method('getFactoryMethod')->willReturn($factoryMethod);\n        $requestConfiguration->method('getFactoryArguments')->willReturn($factoryArguments);\n\n        return $requestConfiguration;\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/ParametersParserTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ParametersParser;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ParametersParserInterface;\nuse Symfony\\Component\\DependencyInjection\\Container;\nuse Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class ParametersParserTest extends TestCase\n{\n    private ParametersParser $parametersParser;\n\n    protected function setUp(): void\n    {\n        $this->parametersParser = new ParametersParser(new Container(), new ExpressionLanguage());\n    }\n\n    public function testImplementsParametersParserInterface(): void\n    {\n        $this->assertInstanceOf(ParametersParserInterface::class, $this->parametersParser);\n    }\n\n    public function testParsesStringParameters(): void\n    {\n        $request = new Request();\n        $request->request->set('string', 'Lorem ipsum');\n\n        $this->assertSame(['nested' => ['string' => 'Lorem ipsum']], $this->parametersParser\n            ->parseRequestValues(['nested' => ['string' => '$string']], $request))\n        ;\n    }\n\n    public function testParsesBooleanParameters(): void\n    {\n        $request = new Request();\n        $request->request->set('boolean', true);\n\n        $this->assertSame(['nested' => ['boolean' => true]], $this->parametersParser\n            ->parseRequestValues(['nested' => ['boolean' => '$boolean']], $request))\n        ;\n    }\n\n    public function testParsesArrayParameters(): void\n    {\n        $request = new Request();\n        $request->request->set('array', ['foo' => 'bar']);\n\n        $this->assertSame(['nested' => ['array' => ['foo' => 'bar']]], $this->parametersParser\n            ->parseRequestValues(['nested' => ['array' => '$array']], $request))\n        ;\n    }\n\n    public function testParsesStringParameterAndCastsItIntoInt(): void\n    {\n        $request = new Request();\n        $request->request->set('int', '5');\n\n        $this->assertSame(['nested' => ['int' => 5]], $this->parametersParser\n            ->parseRequestValues(['nested' => ['int' => '!!int $int']], $request))\n        ;\n    }\n\n    public function testParsesStringParameterAndCastsItIntoFloat(): void\n    {\n        $request = new Request();\n        $request->request->set('float', '5.4');\n\n        $this->assertSame(['nested' => ['float' => 5.4]], $this->parametersParser\n            ->parseRequestValues(['nested' => ['float' => '!!float $float']], $request))\n        ;\n    }\n\n    public function testThrowsExceptionIfStringParameterIsGoingToBeCastedIntoInvalidType(): void\n    {\n        $request = new Request();\n        $request->request->set('int', 5);\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->parametersParser->parseRequestValues(['nested' => ['int' => '!!invalid $int']], $request);\n    }\n\n    public function testThrowsExceptionIfInvalidTypecastIsProvided(): void\n    {\n        $request = new Request();\n        $request->request->set('int', 5);\n\n        $this->expectException(\\InvalidArgumentException::class);\n\n        $this->parametersParser->parseRequestValues(['nested' => ['int' => '!!int!! $int']], $request);\n    }\n\n    public function testParsesStringParameterAndCastsItIntoBool(): void\n    {\n        $request = new Request();\n        $request->request->set('bool0', '0');\n        $request->request->set('bool1', '1');\n\n        $this->assertSame(['nested' => ['bool' => false]], $this->parametersParser\n            ->parseRequestValues(['nested' => ['bool' => '!!bool $bool0']], $request))\n        ;\n\n        $this->assertSame(['nested' => ['bool' => true]], $this->parametersParser\n            ->parseRequestValues(['nested' => ['bool' => '!!bool $bool1']], $request))\n        ;\n    }\n\n    public function testParsesAnExpressionAndCastsItIntoAGivenType(): void\n    {\n        $request = new Request();\n\n        $this->assertSame(['nested' => ['cast' => 5]], $this->parametersParser\n            ->parseRequestValues(['nested' => ['cast' => '!!int expr:\"5\"']], $request))\n        ;\n    }\n\n    public function testParsesAnExpressionWithSpacesAndCastsItIntoAGivenType(): void\n    {\n        $request = new Request();\n\n        $this->assertSame(['nested' => ['cast' => 10]], $this->parametersParser\n            ->parseRequestValues(['nested' => ['cast' => '!!int expr:\"5\" + \"5\"']], $request))\n        ;\n    }\n\n    public function testParsesExpressions(): void\n    {\n        $request = new Request();\n\n        $this->assertSame(['nested' => ['boolean' => true]], $this->parametersParser\n            ->parseRequestValues(['nested' => ['boolean' => 'expr:\"foo\" in [\"foo\", \"bar\"]']], $request))\n        ;\n    }\n\n    public function testParsesExpressionsWithStringParameters(): void\n    {\n        $request = new Request();\n        $request->request->set('string', 'lorem ipsum');\n\n        $this->assertSame(['expression' => true], $this->parametersParser\n            ->parseRequestValues(['expression' => 'expr:$string === \"lorem ipsum\"'], $request))\n        ;\n    }\n\n    public function testParsesExpressionsWithScalarParameters(): void\n    {\n        $request = new Request();\n        $request->request->set('number', 6);\n\n        $this->assertSame(['expression' => true], $this->parametersParser\n            ->parseRequestValues(['expression' => 'expr:$number === 6'], $request))\n        ;\n    }\n\n    public function testThrowsAnExceptionIfArrayParameterIsInjectedIntoExpression(): void\n    {\n        $request = new Request();\n        $request->request->set('array', ['foo', 'bar']);\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->parametersParser->parseRequestValues(['expression' => 'expr:\"foo\" in $array'], $request);\n    }\n\n    public function testThrowsAnExceptionIfObjectParameterIsInjectedIntoExpression(): void\n    {\n        /** @var array|bool|float|int|string|null $objectMock */\n        $objectMock = $this->createMock(\\Stringable::class);\n        $request = new Request();\n        $request->request->set('object', $objectMock);\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->parametersParser->parseRequestValues(['expression' => 'expr:$object.callMethod()'], $request);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/ParametersTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\Parameters;\n\nfinal class ParametersTest extends TestCase\n{\n    private Parameters $parameters;\n\n    protected function setUp(): void\n    {\n        $this->parameters = new Parameters();\n    }\n\n    public function testHasMutableParameters(): void\n    {\n        $this->parameters->replace();\n        $this->assertSame([], $this->parameters->all());\n    }\n\n    public function testHasParameters(): void\n    {\n        $this->parameters->replace([\n            'criteria' => 'criteria',\n            'paginate' => 'paginate',\n        ]);\n\n        $this->assertSame([\n            'criteria' => 'criteria',\n            'paginate' => 'paginate',\n        ], $this->parameters->all());\n    }\n\n    public function testGetsASingleParameterAndSupportsDefaultValue(): void\n    {\n        $this->parameters->replace([\n            'criteria' => 'criteria',\n            'paginate' => 'paginate',\n        ]);\n\n        $this->assertSame('criteria', $this->parameters->get('criteria'));\n        $this->assertNull($this->parameters->get('sorting'));\n        $this->assertSame('default', $this->parameters->get('sorting', 'default'));\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/RedirectHandlerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RedirectHandler;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\HttpFoundation\\RedirectResponse;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\Routing\\Exception\\RouteNotFoundException;\nuse Symfony\\Component\\Routing\\RouterInterface;\n\nfinal class RedirectHandlerTest extends TestCase\n{\n    private RouterInterface&MockObject $router;\n\n    private RedirectHandler $redirectHandler;\n\n    private RequestConfiguration&MockObject $configuration;\n\n    private ResourceInterface&MockObject $resource;\n\n    protected function setUp(): void\n    {\n        $this->router = $this->createMock(RouterInterface::class);\n        $this->redirectHandler = new RedirectHandler($this->router);\n        $this->configuration = $this->createMock(RequestConfiguration::class);\n        $this->resource = $this->createMock(ResourceInterface::class);\n    }\n\n    public function test_it_redirects_to_show_route(): void\n    {\n        $this->configuration\n            ->method('getRedirectRoute')\n            ->with('show')\n            ->willReturn('app_resource_show');\n\n        $this->configuration\n            ->method('getRedirectParameters')\n            ->willReturn(['id' => 1]);\n\n        $this->router\n            ->method('generate')\n            ->with('app_resource_show', ['id' => 1])\n            ->willReturn('/resource/1');\n\n        $response = $this->redirectHandler->redirectToResource($this->configuration, $this->resource);\n\n        $this->assertInstanceOf(RedirectResponse::class, $response);\n        $this->assertEquals('/resource/1', $response->getTargetUrl());\n    }\n\n    public function test_it_falls_back_to_index_if_show_route_is_not_found(): void\n    {\n        $this->configuration\n            ->method('getRedirectRoute')\n            ->willReturnMap([\n                ['show', 'app_resource_show'],\n                ['index', 'app_resource_index'],\n            ]);\n\n        $this->configuration\n            ->method('getRedirectParameters')\n            ->willReturn([]);\n\n        $this->router\n            ->method('generate')\n            ->willReturnCallback(function (string $route) {\n                if ($route === 'app_resource_show') {\n                    throw new RouteNotFoundException();\n                }\n\n                return '/resource/';\n            });\n\n        $response = $this->redirectHandler->redirectToResource($this->configuration, $this->resource);\n\n        $this->assertInstanceOf(RedirectResponse::class, $response);\n        $this->assertEquals('/resource/', $response->getTargetUrl());\n    }\n\n    public function test_it_redirects_to_index(): void\n    {\n        $this->configuration\n            ->method('getRedirectRoute')\n            ->with('index')\n            ->willReturn('app_resource_index');\n\n        $this->configuration\n            ->method('getRedirectParameters')\n            ->willReturn([]);\n\n        $this->router\n            ->method('generate')\n            ->with('app_resource_index', [])\n            ->willReturn('/resource/');\n\n        $response = $this->redirectHandler->redirectToIndex($this->configuration);\n\n        $this->assertInstanceOf(RedirectResponse::class, $response);\n        $this->assertEquals('/resource/', $response->getTargetUrl());\n    }\n\n    public function test_it_redirects_to_referer(): void\n    {\n        $this->configuration\n            ->method('getRedirectReferer')\n            ->willReturn('/previous-page');\n\n        $response = $this->redirectHandler->redirectToRoute($this->configuration, 'referer');\n\n        $this->assertInstanceOf(RedirectResponse::class, $response);\n        $this->assertEquals('/previous-page', $response->getTargetUrl());\n    }\n\n    public function test_it_returns_header_redirection(): void\n    {\n        $this->configuration\n            ->method('isHeaderRedirection')\n            ->willReturn(true);\n\n        $this->configuration\n            ->method('getRedirectHash')\n            ->willReturn('#hash');\n\n        $response = $this->redirectHandler->redirect($this->configuration, '/resource/1');\n\n        $this->assertInstanceOf(Response::class, $response);\n        $this->assertEquals('', $response->getContent());\n        $this->assertEquals('/resource/1#hash', $response->headers->get('X-SYLIUS-LOCATION'));\n    }\n\n    public function test_it_returns_standard_redirect_response(): void\n    {\n        $this->configuration\n            ->method('isHeaderRedirection')\n            ->willReturn(false);\n\n        $this->configuration\n            ->method('getRedirectHash')\n            ->willReturn('#hash');\n\n        $response = $this->redirectHandler->redirect($this->configuration, '/resource/1');\n\n        $this->assertInstanceOf(RedirectResponse::class, $response);\n        $this->assertEquals('/resource/1#hash', $response->getTargetUrl());\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/RequestConfigurationFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ParametersParserInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfigurationFactory;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfigurationFactoryInterface;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Component\\HttpFoundation\\HeaderBag;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class RequestConfigurationFactoryTest extends TestCase\n{\n    /** @var ParametersParserInterface|MockObject */\n    private MockObject $parametersParserMock;\n\n    private RequestConfigurationFactory $requestConfigurationFactory;\n\n    protected function setUp(): void\n    {\n        $this->parametersParserMock = $this->createMock(ParametersParserInterface::class);\n        $this->requestConfigurationFactory = new RequestConfigurationFactory($this->parametersParserMock, RequestConfiguration::class);\n    }\n\n    public function testImplementsRequestConfigurationFactoryInterface(): void\n    {\n        $this->assertInstanceOf(RequestConfigurationFactoryInterface::class, $this->requestConfigurationFactory);\n    }\n\n    public function testCreatesConfigurationFromResourceMetadataAndRequest(): void\n    {\n        /** @var MetadataInterface|MockObject $metadataMock */\n        $metadataMock = $this->createMock(MetadataInterface::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var HeaderBag|MockObject $headersBagMock */\n        $headersBagMock = $this->createMock(HeaderBag::class);\n        /** @var ParameterBag|MockObject $attributesBagMock */\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $requestMock->headers = $headersBagMock;\n        $requestMock->attributes = $attributesBagMock;\n        $headersBagMock->expects($this->any())->method('all')->with('Accept')->willReturn([]);\n        $attributesBagMock->expects($this->once())->method('get')->with('_sylius', [])->willReturn(['template' => ':Product:show.html.twig']);\n        $this->parametersParserMock->expects($this->once())->method('parseRequestValues')->with(['template' => ':Product:show.html.twig'], $requestMock)\n            ->willReturn(['template' => ':Product:list.html.twig'])\n        ;\n        $this->assertInstanceOf(RequestConfiguration::class, $this->requestConfigurationFactory->create($metadataMock, $requestMock));\n    }\n\n    public function testCreatesConfigurationWithoutDefaultSettings(): void\n    {\n        /** @var MetadataInterface|MockObject $metadataMock */\n        $metadataMock = $this->createMock(MetadataInterface::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var HeaderBag|MockObject $headersBagMock */\n        $headersBagMock = $this->createMock(HeaderBag::class);\n        /** @var ParameterBag|MockObject $attributesBagMock */\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $requestMock->headers = $headersBagMock;\n        $requestMock->attributes = $attributesBagMock;\n        $headersBagMock->expects($this->any())->method('all')->with('Accept')->willReturn([]);\n        $attributesBagMock->expects($this->once())->method('get')->with('_sylius', [])->willReturn(['template' => ':Product:list.html.twig']);\n        $this->parametersParserMock->expects($this->once())->method('parseRequestValues')->with(['template' => ':Product:list.html.twig'], $requestMock)\n            ->willReturn(['template' => ':Product:list.html.twig'])\n        ;\n        $this->assertFalse($this->requestConfigurationFactory->create($metadataMock, $requestMock)->isSortable());\n    }\n\n    public function testCreatesConfigurationForSerializationGroupFromSingleHeader(): void\n    {\n        /** @var MetadataInterface|MockObject $metadataMock */\n        $metadataMock = $this->createMock(MetadataInterface::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var HeaderBag|MockObject $headersBagMock */\n        $headersBagMock = $this->createMock(HeaderBag::class);\n        /** @var ParameterBag|MockObject $attributesBagMock */\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $requestMock->headers = $headersBagMock;\n        $requestMock->attributes = $attributesBagMock;\n        $attributesBagMock->expects($this->once())->method('get')->with('_sylius', [])->willReturn([\n            'allowed_serialization_groups' => ['Default', 'Detailed', 'Other'],\n        ]);\n        $headersBagMock->expects($this->any())->method('all')->with('Accept')->willReturn(['groups=Default,Detailed']);\n        $this->parametersParserMock->expects($this->once())->method('parseRequestValues')->with([\n            'allowed_serialization_groups' => ['Default', 'Detailed', 'Other'],\n            'serialization_groups' => ['Default', 'Detailed'],\n        ], $requestMock)\n            ->willReturn(['serialization_groups' => ['Default', 'Detailed']])\n        ;\n        $this->assertSame(['Default', 'Detailed'], $this->requestConfigurationFactory->create($metadataMock, $requestMock)->getSerializationGroups());\n    }\n\n    public function testCreatesConfigurationForSerializationGroupFromMultipleHeaders(): void\n    {\n        /** @var MetadataInterface|MockObject $metadataMock */\n        $metadataMock = $this->createMock(MetadataInterface::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var HeaderBag|MockObject $headersBagMock */\n        $headersBagMock = $this->createMock(HeaderBag::class);\n        /** @var ParameterBag|MockObject $attributesBagMock */\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $requestMock->headers = $headersBagMock;\n        $requestMock->attributes = $attributesBagMock;\n        $attributesBagMock->expects($this->once())->method('get')->with('_sylius', [])->willReturn([\n            'allowed_serialization_groups' => ['Default', 'Detailed', 'Other'],\n        ]);\n        $headersBagMock->expects($this->any())->method('all')->with('Accept')->willReturn(['application/json', 'groups=Default,Detailed']);\n        $this->parametersParserMock->expects($this->once())->method('parseRequestValues')->with([\n            'allowed_serialization_groups' => ['Default', 'Detailed', 'Other'],\n            'serialization_groups' => ['Default', 'Detailed'],\n        ], $requestMock)\n            ->willReturn(['serialization_groups' => ['Default', 'Detailed']])\n        ;\n        $this->assertSame(['Default', 'Detailed'], $this->requestConfigurationFactory->create($metadataMock, $requestMock)->getSerializationGroups());\n    }\n\n    public function testCreatesConfigurationUsingOnlyThoseSerializationGroupsThatAreAllowed(): void\n    {\n        /** @var MetadataInterface|MockObject $metadataMock */\n        $metadataMock = $this->createMock(MetadataInterface::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var HeaderBag|MockObject $headersBagMock */\n        $headersBagMock = $this->createMock(HeaderBag::class);\n        /** @var ParameterBag|MockObject $attributesBagMock */\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $requestMock->headers = $headersBagMock;\n        $requestMock->attributes = $attributesBagMock;\n        $attributesBagMock->expects($this->once())->method('get')->with('_sylius', [])->willReturn([\n            'allowed_serialization_groups' => ['Default'],\n        ]);\n        $headersBagMock->expects($this->any())->method('all')->with('Accept')->willReturn(['application/json', 'groups=Default,Detailed']);\n        $this->parametersParserMock->expects($this->once())->method('parseRequestValues')->with([\n            'allowed_serialization_groups' => ['Default'],\n            'serialization_groups' => ['Default'],\n        ], $requestMock)\n            ->willReturn(['serialization_groups' => ['Default']])\n        ;\n        $this->assertSame(['Default'], $this->requestConfigurationFactory->create($metadataMock, $requestMock)->getSerializationGroups());\n    }\n\n    public function testCreatesConfigurationUsingOnlyThoseSerializationGroupsThatAreAllowedOrDefinedAsDefault(): void\n    {\n        /** @var MetadataInterface|MockObject $metadataMock */\n        $metadataMock = $this->createMock(MetadataInterface::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var HeaderBag|MockObject $headersBagMock */\n        $headersBagMock = $this->createMock(HeaderBag::class);\n        /** @var ParameterBag|MockObject $attributesBagMock */\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $requestMock->headers = $headersBagMock;\n        $requestMock->attributes = $attributesBagMock;\n        $attributesBagMock->expects($this->once())->method('get')->with('_sylius', [])->willReturn([\n            'allowed_serialization_groups' => ['Default'],\n            'serialization_groups' => ['Detailed'],\n        ]);\n        $headersBagMock->expects($this->any())->method('all')->with('Accept')->willReturn(['application/json', 'groups=Default,Detailed,Other']);\n        $this->parametersParserMock->expects($this->once())->method('parseRequestValues')->with([\n            'allowed_serialization_groups' => ['Default'],\n            'serialization_groups' => ['Default', 'Detailed'],\n        ], $requestMock)\n            ->willReturn(['serialization_groups' => ['Default', 'Detailed']])\n        ;\n        $this->assertSame(['Default', 'Detailed'], $this->requestConfigurationFactory->create($metadataMock, $requestMock)->getSerializationGroups());\n    }\n\n    public function testCreatesConfigurationUsingOnlyThoseSerializationGroupsThatAreDefinedAsDefault(): void\n    {\n        /** @var MetadataInterface|MockObject $metadataMock */\n        $metadataMock = $this->createMock(MetadataInterface::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var HeaderBag|MockObject $headersBagMock */\n        $headersBagMock = $this->createMock(HeaderBag::class);\n        /** @var ParameterBag|MockObject $attributesBagMock */\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $requestMock->headers = $headersBagMock;\n        $requestMock->attributes = $attributesBagMock;\n        $attributesBagMock->expects($this->once())->method('get')->with('_sylius', [])->willReturn([\n            'serialization_groups' => ['Detailed'],\n        ]);\n        $headersBagMock->expects($this->any())->method('all')->with('Accept')->willReturn(['application/json', 'groups=Default,Detailed,Other']);\n        $this->parametersParserMock->expects($this->once())->method('parseRequestValues')->with(['serialization_groups' => ['Detailed']], $requestMock)\n            ->willReturn(['serialization_groups' => ['Detailed']])\n        ;\n        $this->assertSame(['Detailed'], $this->requestConfigurationFactory->create($metadataMock, $requestMock)->getSerializationGroups());\n    }\n\n    public function testCreatesConfigurationForSerializationVersionFromSingleHeader(): void\n    {\n        /** @var MetadataInterface|MockObject $metadataMock */\n        $metadataMock = $this->createMock(MetadataInterface::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var HeaderBag|MockObject $headersBagMock */\n        $headersBagMock = $this->createMock(HeaderBag::class);\n        /** @var ParameterBag|MockObject $attributesBagMock */\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $requestMock->headers = $headersBagMock;\n        $requestMock->attributes = $attributesBagMock;\n        $headersBagMock->expects($this->any())->method('all')->with('Accept')->willReturn(['version=1.0.0']);\n        $attributesBagMock->expects($this->once())->method('get')->with('_sylius', [])->willReturn([]);\n        $this->parametersParserMock->expects($this->once())->method('parseRequestValues')->with(['serialization_version' => '1.0.0'], $requestMock)\n            ->willReturn(['template' => ':Product:list.html.twig'])\n        ;\n        $this->assertFalse($this->requestConfigurationFactory->create($metadataMock, $requestMock)->isSortable());\n    }\n\n    public function testCreatesConfigurationForSerializationVersionFromMultipleHeaders(): void\n    {\n        /** @var MetadataInterface|MockObject $metadataMock */\n        $metadataMock = $this->createMock(MetadataInterface::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var HeaderBag|MockObject $headersBagMock */\n        $headersBagMock = $this->createMock(HeaderBag::class);\n        /** @var ParameterBag|MockObject $attributesBagMock */\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $requestMock->headers = $headersBagMock;\n        $requestMock->attributes = $attributesBagMock;\n        $headersBagMock->expects($this->any())->method('all')->with('Accept')->willReturn(['application/xml', 'version=1.0.0']);\n        $attributesBagMock->expects($this->once())->method('get')->with('_sylius', [])->willReturn([]);\n        $this->parametersParserMock->expects($this->once())->method('parseRequestValues')->with(['serialization_version' => '1.0.0'], $requestMock)\n            ->willReturn(['template' => ':Product:list.html.twig'])\n        ;\n        $this->assertFalse($this->requestConfigurationFactory->create($metadataMock, $requestMock)->isSortable());\n    }\n\n    public function testCreatesConfigurationWithDefaultSettings(): void\n    {\n        /** @var MetadataInterface|MockObject $metadataMock */\n        $metadataMock = $this->createMock(MetadataInterface::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var HeaderBag|MockObject $headersBagMock */\n        $headersBagMock = $this->createMock(HeaderBag::class);\n        /** @var ParameterBag|MockObject $attributesBagMock */\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $this->requestConfigurationFactory = new RequestConfigurationFactory($this->parametersParserMock, RequestConfiguration::class, ['sortable' => true]);\n        $requestMock->headers = $headersBagMock;\n        $requestMock->attributes = $attributesBagMock;\n        $headersBagMock->expects($this->any())->method('all')->with('Accept')->willReturn([]);\n        $attributesBagMock->expects($this->once())->method('get')->with('_sylius', [])->willReturn(['template' => ':Product:list.html.twig']);\n        $this->parametersParserMock->expects($this->once())->method('parseRequestValues')->with(['template' => ':Product:list.html.twig', 'sortable' => true], $requestMock)\n            ->willReturn(['template' => ':Product:list.html.twig', 'sortable' => true])\n        ;\n        $this->assertTrue($this->requestConfigurationFactory->create($metadataMock, $requestMock)->isSortable());\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/RequestConfigurationTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\Parameters;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Component\\HttpFoundation\\HeaderBag;\nuse Symfony\\Component\\HttpFoundation\\InputBag;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class RequestConfigurationTest extends TestCase\n{\n    /** @var MetadataInterface|MockObject */\n    private MockObject $metadataMock;\n\n    /** @var Request|MockObject */\n    private MockObject $requestMock;\n\n    /** @var Parameters|MockObject */\n    private MockObject $parametersMock;\n\n    private RequestConfiguration $requestConfiguration;\n\n    protected function setUp(): void\n    {\n        $this->metadataMock = $this->createMock(MetadataInterface::class);\n        $this->requestMock = $this->createMock(Request::class);\n        $this->parametersMock = $this->createMock(Parameters::class);\n        $this->requestConfiguration = new RequestConfiguration($this->metadataMock, $this->requestMock, $this->parametersMock);\n    }\n\n    public function testHasRequest(): void\n    {\n        $this->assertSame($this->requestMock, $this->requestConfiguration->getRequest());\n    }\n\n    public function testHasMetadata(): void\n    {\n        $this->assertSame($this->metadataMock, $this->requestConfiguration->getMetadata());\n    }\n\n    public function testHasParameters(): void\n    {\n        $this->assertSame($this->parametersMock, $this->requestConfiguration->getParameters());\n    }\n\n    public function testChecksIfItsAHtmlRequest(): void\n    {\n        $this->requestMock->expects($this->once())->method('getRequestFormat')->willReturn('html');\n        $this->assertTrue($this->requestConfiguration->isHtmlRequest());\n    }\n\n    public function testChecksIfItsNotAHtmlRequest(): void\n    {\n        $this->requestMock->expects($this->once())->method('getRequestFormat')->willReturn('json');\n        $this->assertFalse($this->requestConfiguration->isHtmlRequest());\n    }\n\n    public function testReturnsDefaultTemplateNames(): void\n    {\n        $this->metadataMock->expects($this->exactly(5))->method('getTemplatesNamespace')->willReturn('@SyliusAdmin/Product');\n        $this->assertSame('@SyliusAdmin/Product/index.html.twig', $this->requestConfiguration->getDefaultTemplate('index.html'));\n        $this->assertSame('@SyliusAdmin/Product/show.html.twig', $this->requestConfiguration->getDefaultTemplate('show.html'));\n        $this->assertSame('@SyliusAdmin/Product/create.html.twig', $this->requestConfiguration->getDefaultTemplate('create.html'));\n        $this->assertSame('@SyliusAdmin/Product/update.html.twig', $this->requestConfiguration->getDefaultTemplate('update.html'));\n        $this->assertSame('@SyliusAdmin/Product/custom.html.twig', $this->requestConfiguration->getDefaultTemplate('custom.html'));\n    }\n\n    public function testReturnsDefaultTemplateNamesForADirectoryBasedTemplates(): void\n    {\n        $this->metadataMock->expects($this->exactly(5))->method('getTemplatesNamespace')->willReturn('book/Backend');\n        $this->assertSame('book/Backend/index.html.twig', $this->requestConfiguration->getDefaultTemplate('index.html'));\n        $this->assertSame('book/Backend/show.html.twig', $this->requestConfiguration->getDefaultTemplate('show.html'));\n        $this->assertSame('book/Backend/create.html.twig', $this->requestConfiguration->getDefaultTemplate('create.html'));\n        $this->assertSame('book/Backend/update.html.twig', $this->requestConfiguration->getDefaultTemplate('update.html'));\n        $this->assertSame('book/Backend/custom.html.twig', $this->requestConfiguration->getDefaultTemplate('custom.html'));\n    }\n\n    public function testTakesTheCustomTemplateIfSpecified(): void\n    {\n        $this->metadataMock->expects($this->once())->method('getTemplatesNamespace')->willReturn('@SyliusAdmin/Product');\n        $this->parametersMock->expects($this->once())->method('get')->with('template', '@SyliusAdmin/Product/foo.html.twig')->willReturn('Product/show.html.twig');\n        $this->assertSame('Product/show.html.twig', $this->requestConfiguration->getTemplate('foo.html'));\n    }\n\n    public function testFormTypeAndOptionsArrayWithTypeOnly(): void\n    {\n        $this->parametersMock->method('get')->willReturn(['type' => 'sylius_custom_resource']);\n\n        $this->assertSame('sylius_custom_resource', $this->requestConfiguration->getFormType());\n        $this->assertSame([], $this->requestConfiguration->getFormOptions());\n    }\n\n    public function testFormTypeAndOptionsString(): void\n    {\n        $this->parametersMock->method('get')->willReturn('sylius_custom_resource');\n\n        $this->assertSame('sylius_custom_resource', $this->requestConfiguration->getFormType());\n        $this->assertSame([], $this->requestConfiguration->getFormOptions());\n    }\n\n    public function testFormTypeAndOptionsArrayWithTypeAndOptions(): void\n    {\n        $this->parametersMock->method('get')->willReturn([\n            'type' => 'sylius_custom_resource',\n            'options' => ['key' => 'value'],\n        ]);\n\n        $this->assertSame('sylius_custom_resource', $this->requestConfiguration->getFormType());\n        $this->assertSame(['key' => 'value'], $this->requestConfiguration->getFormOptions());\n    }\n\n    public function testFormTypeAndOptionsFallbackToMetadataWhenEmpty(): void\n    {\n        $this->parametersMock->method('get')->willReturn([]);\n        $this->metadataMock->method('getClass')->with('form')->willReturn('\\Fully\\Qualified\\ClassName');\n\n        $this->assertSame('\\Fully\\Qualified\\ClassName', $this->requestConfiguration->getFormType());\n        $this->assertSame([], $this->requestConfiguration->getFormOptions());\n    }\n\n    public function testFormTypeAndOptionsFallbackToMetadataWithOptionsOnly(): void\n    {\n        $this->parametersMock->method('get')->willReturn(['options' => ['key' => 'value']]);\n        $this->metadataMock->method('getClass')->with('form')->willReturn('\\Fully\\Qualified\\ClassName');\n\n        $this->assertSame('\\Fully\\Qualified\\ClassName', $this->requestConfiguration->getFormType());\n        $this->assertSame(['key' => 'value'], $this->requestConfiguration->getFormOptions());\n    }\n\n    public function testGeneratesFormTypeWithArrayConfiguration(): void\n    {\n        $this->parametersMock->expects($this->exactly(2))->method('get')->with('form')->willReturn(['type' => 'sylius_product', 'options' => ['validation_groups' => ['sylius']]]);\n        $this->assertSame('sylius_product', $this->requestConfiguration->getFormType());\n        $this->assertSame(['validation_groups' => ['sylius']], $this->requestConfiguration->getFormOptions());\n    }\n\n    public function testGeneratesRouteNamesWithoutSection(): void\n    {\n        $this->metadataMock->method('getApplicationName')->willReturn('sylius');\n        $this->metadataMock->method('getName')->willReturn('product');\n        $this->parametersMock->method('get')->with('section')->willReturn(null);\n        $this->assertSame('sylius_product_index', $this->requestConfiguration->getRouteName('index'));\n        $this->assertSame('sylius_product_show', $this->requestConfiguration->getRouteName('show'));\n        $this->assertSame('sylius_product_custom', $this->requestConfiguration->getRouteName('custom'));\n    }\n\n    public function testGeneratesRouteNamesWithSection(): void\n    {\n        $this->metadataMock->method('getApplicationName')->willReturn('sylius');\n        $this->metadataMock->method('getName')->willReturn('product');\n        $this->parametersMock->method('get')->with('section')->willReturn('admin');\n        $this->assertSame('sylius_admin_product_index', $this->requestConfiguration->getRouteName('index'));\n        $this->assertSame('sylius_admin_product_show', $this->requestConfiguration->getRouteName('show'));\n        $this->assertSame('sylius_admin_product_custom', $this->requestConfiguration->getRouteName('custom'));\n    }\n\n    public function testGeneratesRedirectReferer(): void\n    {\n        /** @var HeaderBag|MockObject $bagMock */\n        $bagMock = $this->createMock(HeaderBag::class);\n        $this->requestMock->headers = $bagMock;\n        $bagMock->expects($this->once())->method('get')->with('referer')->willReturn('http://myurl.com');\n        $this->parametersMock->expects($this->once())->method('get')->with('redirect')->willReturn(['referer' => 'http://myurl.com']);\n        $this->assertSame('http://myurl.com', $this->requestConfiguration->getRedirectReferer());\n    }\n\n    public function testGeneratesRedirectRouteWithoutRedirect(): void\n    {\n        $this->metadataMock->method('getApplicationName')->willReturn('sylius');\n        $this->metadataMock->method('getName')->willReturn('product');\n        $this->parametersMock\n            ->method('get')\n            ->willReturnMap([\n                ['section', null, null],\n                ['redirect', null, null],\n            ]);\n        $this->assertSame('sylius_product_index', $this->requestConfiguration->getRedirectRoute('index'));\n    }\n\n    public function testGeneratesRedirectRouteWithRedirectAsArray(): void\n    {\n        $this->metadataMock->method('getApplicationName')->willReturn('sylius');\n        $this->metadataMock->method('getName')->willReturn('product');\n        $this->parametersMock\n            ->method('get')\n            ->willReturnMap([\n                ['section', null, null],\n                ['redirect', null, ['route' => 'myRoute']],\n            ]);\n        $this->assertSame('myRoute', $this->requestConfiguration->getRedirectRoute('show'));\n    }\n\n    public function testGeneratesRedirectRouteWithRedirectAsString(): void\n    {\n        $this->metadataMock->method('getApplicationName')->willReturn('sylius');\n        $this->metadataMock->method('getName')->willReturn('product');\n        $this->parametersMock\n            ->method('get')\n            ->willReturnMap([\n                ['section', null, null],\n                ['redirect', null, 'myRoute'],\n            ]);\n        $this->assertSame('myRoute', $this->requestConfiguration->getRedirectRoute('custom'));\n    }\n\n    public function testRedirectRouteUsesSection(): void\n    {\n        $this->metadataMock->method('getApplicationName')->willReturn('sylius');\n        $this->metadataMock->method('getName')->willReturn('product');\n        $this->parametersMock->method('get')->willReturnMap([\n            ['section', null, 'admin'],\n            ['redirect', null, null],\n        ]);\n\n        $this->assertSame('sylius_admin_product_index', $this->requestConfiguration->getRedirectRoute('index'));\n    }\n\n    public function testRedirectRouteOverriddenWithArray(): void\n    {\n        $this->metadataMock->method('getApplicationName')->willReturn('sylius');\n        $this->metadataMock->method('getName')->willReturn('product');\n        $this->parametersMock->method('get')->with('redirect')->willReturn(['route' => 'myRoute']);\n        $this->assertSame('myRoute', $this->requestConfiguration->getRedirectRoute('show'));\n    }\n\n    public function testRedirectRouteOverriddenWithString(): void\n    {\n        $this->metadataMock->method('getApplicationName')->willReturn('sylius');\n        $this->metadataMock->method('getName')->willReturn('product');\n        $this->parametersMock->method('get')->with('redirect')->willReturn('myRoute');\n        $this->assertSame('myRoute', $this->requestConfiguration->getRedirectRoute('custom'));\n    }\n\n    public function testReturnsEmptyRedirectParametersWhenRedirectIsNull(): void\n    {\n        $this->parametersMock->method('get')->willReturnMap([\n            ['vars', [], []],\n            ['redirect', null, null],\n        ]);\n\n        $this->assertSame([], $this->requestConfiguration->getVars());\n        $this->assertSame([], $this->requestConfiguration->getRedirectParameters());\n    }\n\n    public function testReturnsEmptyRedirectParametersWhenRedirectIsString(): void\n    {\n        $this->parametersMock->method('get')->willReturn(['redirect' => 'string']);\n\n        $this->assertSame([], $this->requestConfiguration->getRedirectParameters());\n    }\n\n    public function testReturnsEmptyRedirectParametersWhenRedirectHasEmptyArray(): void\n    {\n        $this->parametersMock->method('get')->willReturn(['redirect' => ['parameters' => []]]);\n\n        $this->assertSame([], $this->requestConfiguration->getRedirectParameters());\n    }\n\n    public function testReturnsRedirectParametersWhenPresent(): void\n    {\n        $this->parametersMock->method('get')->willReturn(['redirect' => ['parameters' => ['myParameter']]]);\n\n        $this->assertSame(['myParameter'], $this->requestConfiguration->getRedirectParameters());\n    }\n\n    public function testMergesExtraVarsWithRedirectParameters(): void\n    {\n        $extraVars = ['redirect' => ['parameters' => ['myExtraParameter']]];\n        $this->parametersMock->method('get')->willReturnMap([\n            ['vars', [], $extraVars],\n            ['redirect', null, ['parameters' => ['myParameter']]],\n        ]);\n\n        $this->assertSame($extraVars, $this->requestConfiguration->getVars());\n        $this->assertSame(['myParameter', 'myExtraParameter'], $this->requestConfiguration->getRedirectParameters(new \\stdClass()));\n    }\n\n    public function testIsLimitedReturnsTrueWhenLimitIsSet(): void\n    {\n        $this->parametersMock->method('get')->willReturn(10);\n\n        $this->assertTrue($this->requestConfiguration->isLimited());\n    }\n\n    public function testIsLimitedReturnsFalseWhenLimitIsNotSet(): void\n    {\n        $this->parametersMock->method('get')->willReturn(null);\n\n        $this->assertFalse($this->requestConfiguration->isLimited());\n    }\n\n    public function testGetLimitReturnsValue(): void\n    {\n        $this->parametersMock->method('get')->willReturnMap([\n            ['limit', false, true],\n            ['limit', 10, 10],\n        ]);\n\n        $this->assertSame(10, $this->requestConfiguration->getLimit());\n    }\n\n    public function testGetLimitReturnsNullWhenNotSet(): void\n    {\n        $this->parametersMock->method('get')->willReturnMap([\n            ['limit', false, false],\n            ['limit', 10, null],\n        ]);\n\n        $this->assertNull($this->requestConfiguration->getLimit());\n    }\n\n    public function testIsPaginatedReturnsTrueWhenLimitIsPositive(): void\n    {\n        $this->parametersMock->method('get')->willReturn(10);\n\n        $this->assertTrue($this->requestConfiguration->isPaginated());\n    }\n\n    public function testIsPaginatedReturnsTrueWhenLimitIsZero(): void\n    {\n        $this->parametersMock->method('get')->willReturn(0);\n\n        $this->assertTrue($this->requestConfiguration->isPaginated());\n    }\n\n    public function testIsPaginatedReturnsFalseWhenLimitIsNull(): void\n    {\n        $this->parametersMock->method('get')->willReturn(null);\n\n        $this->assertFalse($this->requestConfiguration->isPaginated());\n    }\n\n    public function testIsPaginatedReturnsFalseWhenLimitIsFalse(): void\n    {\n        $this->parametersMock->method('get')->willReturn(false);\n\n        $this->assertFalse($this->requestConfiguration->isPaginated());\n    }\n\n    public function testGetPaginationMaxPerPageReturnsCustomValue(): void\n    {\n        $this->parametersMock->method('get')->with('paginate', 10)->willReturn(20);\n\n        $this->assertSame(20, $this->requestConfiguration->getPaginationMaxPerPage());\n    }\n\n    public function testGetPaginationMaxPerPageReturnsDefaultValue(): void\n    {\n        $this->parametersMock->method('get')->with('paginate', 10)->willReturn(10);\n\n        $this->assertSame(10, $this->requestConfiguration->getPaginationMaxPerPage());\n    }\n\n    public function testIsFilterableReturnsTrue(): void\n    {\n        $this->parametersMock->method('get')->willReturn(true);\n\n        $this->assertTrue($this->requestConfiguration->isFilterable());\n    }\n\n    public function testIsFilterableReturnsFalse(): void\n    {\n        $this->parametersMock->method('get')->willReturn(null);\n\n        $this->assertFalse($this->requestConfiguration->isFilterable());\n    }\n\n    public function testHasNoFilterableParameter(): void\n    {\n        $defaultCriteria = ['property' => 'myValue'];\n        $this->parametersMock\n            ->method('get')\n            ->willReturnMap([\n                ['criteria', [], []],\n                ['filterable', false, false],\n            ]);\n        $this->assertIsIterable($this->requestConfiguration->getCriteria($defaultCriteria));\n        $this->assertCount(1, $this->requestConfiguration->getCriteria($defaultCriteria));\n    }\n\n    public function testHasCriteriaParameter(): void\n    {\n        /** @var ParameterBag|MockObject $attributesBagMock */\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $queryBag = new InputBag();\n        $requestBag = new InputBag();\n        $criteria = ['property' => 'myNewValue'];\n        $this->requestMock->attributes = $attributesBagMock;\n        $this->requestMock->query = $queryBag;\n        $this->requestMock->request = $requestBag;\n\n        $this->parametersMock\n            ->method('get')\n            ->willReturnMap([\n                ['criteria', [], []],\n                ['filterable', false, true],\n            ]);\n\n        $attributesBagMock->expects($this->once())->method('get')->with('criteria', $this->requestMock)->willReturn($this->requestMock);\n        $queryBag->set('criteria', $criteria);\n        $requestBag->set('criteria', []);\n        $this->assertSame($criteria, $this->requestConfiguration->getCriteria());\n    }\n\n    public function testHasCriteriaParameterInRequest(): void\n    {\n        /** @var ParameterBag|MockObject $attributesBagMock */\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $queryBag = new InputBag();\n        $requestBag = new InputBag();\n        $criteria = ['property' => 'myNewValue'];\n        $this->requestMock->attributes = $attributesBagMock;\n        $this->requestMock->query = $queryBag;\n        $this->requestMock->request = $requestBag;\n\n        $this->parametersMock\n            ->method('get')\n            ->willReturnMap([\n                ['criteria', [], []],\n                ['filterable', false, true],\n            ]);\n\n        $attributesBagMock->expects($this->once())->method('get')->with('criteria', $this->requestMock)->willReturn($this->requestMock);\n        $requestBag->set('criteria', $criteria);\n        $this->assertSame($criteria, $this->requestConfiguration->getCriteria());\n    }\n\n    public function testCriteriaIsOverriddenByQueryParameters(): void\n    {\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $queryBag = new InputBag();\n        $requestBag = new InputBag();\n\n        $criteria = ['property' => 'myValue'];\n        $overriddenCriteria = ['other_property' => 'myNewValue'];\n        $expected = ['property' => 'myValue', 'other_property' => 'myNewValue'];\n\n        $this->requestMock->attributes = $attributesBagMock;\n        $this->requestMock->query = $queryBag;\n        $this->requestMock->request = $requestBag;\n\n        $this->parametersMock->method('get')->willReturnMap([\n            ['filterable', false, true],\n            ['criteria', [], $criteria],\n        ]);\n        $attributesBagMock->method('get')->with('criteria', $this->requestMock)->willReturn($this->requestMock);\n\n        $queryBag->set('criteria', $overriddenCriteria);\n        $requestBag->set('criteria', []);\n\n        $this->assertSame($expected, $this->requestConfiguration->getCriteria());\n    }\n\n    public function testCriteriaMergesWithDefaultCriteriaWhenOverridden(): void\n    {\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $queryBag = new InputBag();\n        $requestBag = new InputBag();\n\n        $criteria = ['property' => 'myValue'];\n        $overriddenCriteria = ['other_property' => 'myNewValue'];\n        $defaultCriteria = ['slug' => 'foo'];\n        $expected = ['property' => 'myValue', 'slug' => 'foo', 'other_property' => 'myNewValue'];\n\n        $this->requestMock->attributes = $attributesBagMock;\n        $this->requestMock->query = $queryBag;\n        $this->requestMock->request = $requestBag;\n\n        $this->parametersMock->method('get')->willReturnMap([\n            ['filterable', false, true],\n            ['criteria', [], $criteria],\n        ]);\n        $attributesBagMock->method('get')->with('criteria', $this->requestMock)->willReturn($this->requestMock);\n\n        $queryBag->set('criteria', $overriddenCriteria);\n        $requestBag->set('criteria', []);\n\n        $this->assertSame($expected, $this->requestConfiguration->getCriteria($defaultCriteria));\n    }\n\n    public function testQueryCriteriaTakesPrecedenceOverDefaultAndRouteCriteria(): void\n    {\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $queryBag = new InputBag();\n        $requestBag = new InputBag();\n\n        $criteria = ['filter' => 'route'];\n        $expected = ['filter' => 'request'];\n\n        $this->requestMock->attributes = $attributesBagMock;\n        $this->requestMock->query = $queryBag;\n        $this->requestMock->request = $requestBag;\n\n        $this->parametersMock->method('get')->willReturnMap([\n            ['filterable', false, true],\n            ['criteria', [], $criteria],\n        ]);\n        $attributesBagMock->method('get')->with('criteria', $this->requestMock)->willReturn($this->requestMock);\n\n        $queryBag->set('criteria', ['filter' => 'request']);\n        $requestBag->set('criteria', []);\n\n        $this->assertSame($expected, $this->requestConfiguration->getCriteria(['filter' => 'default']));\n    }\n\n    public function testResourceIsSortableWhenParameterIsTrue(): void\n    {\n        $this->parametersMock\n            ->method('get')\n            ->with('sortable', false)\n            ->willReturn(true);\n\n        $this->assertTrue($this->requestConfiguration->isSortable());\n    }\n\n    public function testResourceIsNotSortableWhenParameterIsNull(): void\n    {\n        $this->parametersMock\n            ->method('get')\n            ->with('sortable', false)\n            ->willReturn(null);\n\n        $this->assertFalse($this->requestConfiguration->isSortable());\n    }\n\n    public function testHasSortingParameter(): void\n    {\n        /** @var ParameterBag|MockObject $attributesBagMock */\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $queryBag = new InputBag();\n        $requestBag = new InputBag();\n        $sorting = ['property' => 'asc'];\n        $this->requestMock->attributes = $attributesBagMock;\n        $this->requestMock->query = $queryBag;\n        $this->requestMock->request = $requestBag;\n\n        $this->parametersMock->method('get')->willReturnMap([\n            ['sortable', false, true],\n            ['sorting', [], $sorting],\n        ]);\n\n        $attributesBagMock->expects($this->once())->method('get')->with('sorting', $this->requestMock)->willReturn($this->requestMock);\n        $queryBag->set('sorting', $sorting);\n        $requestBag->set('sorting', []);\n        $this->assertSame($sorting, $this->requestConfiguration->getSorting());\n    }\n\n    public function testHasNoSortableParameter(): void\n    {\n        $defaultSorting = ['property' => 'desc'];\n\n        $this->parametersMock->method('get')->willReturnMap([\n            ['sortable', false, false],\n            ['sorting', [], []],\n        ]);\n\n        $this->assertIsIterable($this->requestConfiguration->getSorting($defaultSorting));\n        $this->assertCount(1, $this->requestConfiguration->getSorting($defaultSorting));\n    }\n\n    public function testSortingIsOverriddenByQueryParameters(): void\n    {\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $queryBag = new InputBag();\n        $requestBag = new InputBag();\n\n        $sorting = ['property' => 'desc'];\n        $overriddenSorting = ['other_property' => 'asc'];\n        $expected = ['other_property' => 'asc', 'property' => 'desc'];\n\n        $this->requestMock->attributes = $attributesBagMock;\n        $this->requestMock->query = $queryBag;\n        $this->requestMock->request = $requestBag;\n\n        $this->parametersMock->method('get')->willReturnMap([\n            ['sortable', false, true],\n            ['sorting', [], $sorting],\n        ]);\n        $attributesBagMock->method('get')->with('sorting', $this->requestMock)->willReturn($this->requestMock);\n\n        $queryBag->set('sorting', $overriddenSorting);\n        $requestBag->set('sorting', []);\n\n        $this->assertSame($expected, $this->requestConfiguration->getSorting());\n    }\n\n    public function testSortingMergesWithDefaultSortingWhenOverridden(): void\n    {\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $queryBag = new InputBag();\n        $requestBag = new InputBag();\n\n        $sorting = ['property' => 'desc'];\n        $overriddenSorting = ['other_property' => 'asc'];\n        $defaultSorting = ['slug' => 'foo'];\n        $expected = ['other_property' => 'asc', 'property' => 'desc', 'slug' => 'foo'];\n\n        $this->requestMock->attributes = $attributesBagMock;\n        $this->requestMock->query = $queryBag;\n        $this->requestMock->request = $requestBag;\n\n        $this->parametersMock->method('get')->willReturnMap([\n            ['sortable', false, true],\n            ['sorting', [], $sorting],\n        ]);\n        $attributesBagMock->method('get')->with('sorting', $this->requestMock)->willReturn($this->requestMock);\n\n        $queryBag->set('sorting', $overriddenSorting);\n        $requestBag->set('sorting', []);\n\n        $this->assertSame($expected, $this->requestConfiguration->getSorting($defaultSorting));\n    }\n\n    public function testQuerySortingTakesPrecedenceOverRouteAndDefaultSorting(): void\n    {\n        $attributesBagMock = $this->createMock(ParameterBag::class);\n        $queryBag = new InputBag();\n        $requestBag = new InputBag();\n\n        $this->requestMock->attributes = $attributesBagMock;\n        $this->requestMock->query = $queryBag;\n        $this->requestMock->request = $requestBag;\n\n        $this->parametersMock->method('get')->willReturnMap([\n            ['sortable', false, true],\n            ['sorting', [], ['sort' => 'route']],\n        ]);\n        $attributesBagMock->method('get')->with('sorting', $this->requestMock)->willReturn($this->requestMock);\n\n        $queryBag->set('sorting', ['sort' => 'request']);\n        $requestBag->set('sorting', []);\n\n        $this->assertSame(['sort' => 'request'], $this->requestConfiguration->getSorting(['sort' => 'default']));\n    }\n\n    public function testGetRepositoryMethodReturnsNullIfRepositoryParamDoesNotExist(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('has')\n            ->with('repository')\n            ->willReturn(false);\n\n        $this->assertNull($this->requestConfiguration->getRepositoryMethod());\n    }\n\n    public function testGetRepositoryMethodReturnsConfiguredMethod(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('has')\n            ->with('repository')\n            ->willReturn(true);\n\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('get')\n            ->with('repository')\n            ->willReturn(['method' => 'findAllEnabled']);\n\n        $this->assertSame('findAllEnabled', $this->requestConfiguration->getRepositoryMethod());\n    }\n\n    public function testReturnsEmptyArrayWhenRepositoryConfigurationIsMissing(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('has')\n            ->with('repository')\n            ->willReturn(false);\n\n        $this->assertSame([], $this->requestConfiguration->getRepositoryArguments());\n    }\n\n    public function testReturnsRepositoryArgumentsWhenScalarValueProvided(): void\n    {\n        $repositoryConfiguration = ['arguments' => 'value'];\n\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('has')\n            ->with('repository')\n            ->willReturn(true);\n\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('get')\n            ->with('repository')\n            ->willReturn($repositoryConfiguration);\n\n        $this->assertSame(['value'], $this->requestConfiguration->getRepositoryArguments());\n    }\n\n    public function testReturnsRepositoryArgumentsWhenArrayProvided(): void\n    {\n        $repositoryConfiguration = ['arguments' => ['foo, bar']];\n\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('has')\n            ->with('repository')\n            ->willReturn(true);\n\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('get')\n            ->with('repository')\n            ->willReturn($repositoryConfiguration);\n\n        $this->assertSame(['foo, bar'], $this->requestConfiguration->getRepositoryArguments());\n    }\n\n    public function testReturnsNullWhenFactoryConfigurationIsMissing(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('has')\n            ->with('factory')\n            ->willReturn(false);\n\n        $this->assertNull($this->requestConfiguration->getFactoryMethod());\n    }\n\n    public function testReturnsFactoryMethodWhenConfigured(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('has')\n            ->with('factory')\n            ->willReturn(true);\n\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('get')\n            ->with('factory')\n            ->willReturn(['method' => 'createForPromotion']);\n\n        $this->assertSame('createForPromotion', $this->requestConfiguration->getFactoryMethod());\n    }\n\n    public function testReturnsEmptyArrayWhenFactoryConfigurationIsMissing(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('has')\n            ->with('factory')\n            ->willReturn(false);\n\n        $this->assertSame([], $this->requestConfiguration->getFactoryArguments());\n    }\n\n    public function testReturnsFactoryArgumentsAsArrayWhenConfiguredWithScalar(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('has')\n            ->with('factory')\n            ->willReturn(true);\n\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('get')\n            ->with('factory')\n            ->willReturn(['arguments' => 'value']);\n\n        $this->assertSame(['value'], $this->requestConfiguration->getFactoryArguments());\n    }\n\n    public function testReturnsFactoryArgumentsAsArrayWhenConfiguredWithArray(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('has')\n            ->with('factory')\n            ->willReturn(true);\n\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('get')\n            ->with('factory')\n            ->willReturn(['arguments' => ['foo, bar']]);\n\n        $this->assertSame(['foo, bar'], $this->requestConfiguration->getFactoryArguments());\n    }\n\n    public function testReturnsDefaultFlashMessageForMessageAction(): void\n    {\n        $this->metadataMock->method('getApplicationName')->willReturn('sylius');\n        $this->metadataMock->method('getName')->willReturn('product');\n\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('get')\n            ->with('flash', 'sylius.product.message')\n            ->willReturn('sylius.product.message');\n\n        $this->assertSame('sylius.product.message', $this->requestConfiguration->getFlashMessage('message'));\n    }\n\n    public function testReturnsCustomFlashMessageForFlashAction(): void\n    {\n        $this->metadataMock->method('getApplicationName')->willReturn('sylius');\n        $this->metadataMock->method('getName')->willReturn('product');\n\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('get')\n            ->with('flash', 'sylius.product.flash')\n            ->willReturn('sylius.product.myMessage');\n\n        $this->assertSame('sylius.product.myMessage', $this->requestConfiguration->getFlashMessage('flash'));\n    }\n\n    public function testReturnsDefaultSortablePosition(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('get')\n            ->with('sortable_position', 'position')\n            ->willReturn('position');\n\n        $this->assertSame('position', $this->requestConfiguration->getSortablePosition());\n    }\n\n    public function testReturnsCustomSortablePosition(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('get')\n            ->with('sortable_position', 'position')\n            ->willReturn('myPosition');\n\n        $this->assertSame('myPosition', $this->requestConfiguration->getSortablePosition());\n    }\n\n    public function testShouldNotHavePermissionWhenPermissionIsFalse(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('get')\n            ->with('permission', false)\n            ->willReturn(false);\n\n        $this->assertFalse($this->requestConfiguration->hasPermission());\n    }\n\n    public function testShouldHavePermissionWhenPermissionIsCustomString(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('get')\n            ->with('permission', false)\n            ->willReturn('custom_permission');\n\n        $this->assertTrue($this->requestConfiguration->hasPermission());\n    }\n\n    public function testGeneratesPermissionName(): void\n    {\n        $this->metadataMock->expects($this->once())->method('getApplicationName')->willReturn('sylius');\n        $this->metadataMock->expects($this->once())->method('getName')->willReturn('product');\n        $this->parametersMock->expects($this->once())->method('get')->with('permission')->willReturn(true);\n        $this->assertSame('sylius.product.index', $this->requestConfiguration->getPermission('index'));\n    }\n\n    public function testTakesPermissionNameFromParametersIfProvided(): void\n    {\n        $this->parametersMock->expects($this->once())->method('get')->with('permission')->willReturn('app.sales_order.view_pricing');\n        $this->assertSame('app.sales_order.view_pricing', $this->requestConfiguration->getPermission('index'));\n    }\n\n    public function testThrowsAnExceptionWhenPermissionIsSetAsFalseInParametersButStillTryingToGetIt(): void\n    {\n        $this->parametersMock->expects($this->once())->method('get')->with('permission')->willReturn(null);\n        $this->expectException(\\LogicException::class);\n        $this->requestConfiguration->getPermission('index');\n    }\n\n    public function testHasEventName(): void\n    {\n        $this->parametersMock->expects($this->once())->method('get')->with('event')->willReturn('foo');\n        $this->assertSame('foo', $this->requestConfiguration->getEvent());\n    }\n\n    public function testReturnsNullWhenSectionIsNotSet(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('get')\n            ->with('section')\n            ->willReturn(null);\n\n        $this->assertNull($this->requestConfiguration->getSection());\n    }\n\n    public function testReturnsSectionWhenSet(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('get')\n            ->with('section')\n            ->willReturn('admin');\n\n        $this->assertSame('admin', $this->requestConfiguration->getSection());\n    }\n\n    public function testHasVars(): void\n    {\n        $this->parametersMock->expects($this->once())->method('get')->with('vars', [])->willReturn(['foo' => 'bar']);\n        $this->assertSame(['foo' => 'bar'], $this->requestConfiguration->getVars());\n    }\n\n    public function testShouldNotHaveGridWhenGridNotDefined(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('has')\n            ->with('grid')\n            ->willReturn(false);\n\n        $this->assertFalse($this->requestConfiguration->hasGrid());\n    }\n\n    public function testShouldHaveGridWhenGridDefined(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('has')\n            ->with('grid')\n            ->willReturn(true);\n\n        $this->assertTrue($this->requestConfiguration->hasGrid());\n    }\n\n    public function testGetGridReturnsConfiguredValue(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('has')\n            ->with('grid')\n            ->willReturn(true);\n\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('get')\n            ->with('grid')\n            ->willReturn('sylius_admin_tax_category');\n\n        $this->assertSame('sylius_admin_tax_category', $this->requestConfiguration->getGrid());\n    }\n\n    public function testThrowsAnExceptionWhenTryingToRetrieveUndefinedGrid(): void\n    {\n        $this->parametersMock->expects($this->once())->method('has')->with('grid')->willReturn(false);\n        $this->expectException(\\LogicException::class);\n        $this->requestConfiguration->getGrid();\n    }\n\n    public function testReturnsFalseWhenNoStateMachineConfigured(): void\n    {\n        $this->parametersMock\n            ->expects($this->once())\n            ->method('has')\n            ->with('state_machine')\n            ->willReturn(false);\n\n        $this->assertFalse($this->requestConfiguration->hasStateMachine());\n    }\n\n    public function testReturnsStateMachineDetailsWhenConfigured(): void\n    {\n        $stateMachineConfig = [\n            'graph' => 'sylius_product_review_state',\n            'transition' => 'approve',\n        ];\n\n        $this->parametersMock\n            ->method('has')\n            ->with('state_machine')\n            ->willReturn(true);\n\n        $this->parametersMock\n            ->method('get')\n            ->with('state_machine')\n            ->willReturn($stateMachineConfig);\n\n        $this->assertTrue($this->requestConfiguration->hasStateMachine());\n        $this->assertSame('sylius_product_review_state', $this->requestConfiguration->getStateMachineGraph());\n        $this->assertSame('approve', $this->requestConfiguration->getStateMachineTransition());\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/ResourceControllerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse Doctrine\\Persistence\\ObjectManager;\nuse FOS\\RestBundle\\FOSRestBundle;\nuse FOS\\RestBundle\\View\\View;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\AuthorizationCheckerInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\EventDispatcherInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\FlashHelperInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\NewResourceFactoryInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RedirectHandlerInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfigurationFactoryInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceController;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceDeleteHandlerInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceFormFactoryInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourcesCollectionProviderInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceUpdateHandlerInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\SingleResourceProviderInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\StateMachineInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ViewHandlerInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Exception\\DeleteHandlingException;\nuse Sylius\\Resource\\Factory\\FactoryInterface;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Sylius\\Resource\\ResourceActions;\nuse Symfony\\Component\\DependencyInjection\\ContainerInterface;\nuse Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBagInterface;\nuse Symfony\\Component\\Form\\Form;\nuse Symfony\\Component\\Form\\FormView;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\HttpKernel\\Exception\\BadRequestHttpException;\nuse Symfony\\Component\\HttpKernel\\Exception\\HttpException;\nuse Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException;\nuse Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException;\nuse Symfony\\Component\\Security\\Csrf\\CsrfToken;\nuse Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface;\nuse Twig\\Environment;\n\nfinal class ResourceControllerTest extends TestCase\n{\n    /** @var MetadataInterface|MockObject */\n    private MockObject $metadataMock;\n\n    /** @var RequestConfigurationFactoryInterface|MockObject */\n    private MockObject $requestConfigurationFactoryMock;\n\n    /** @var ViewHandlerInterface|MockObject */\n    private MockObject $viewHandlerMock;\n\n    /** @var RepositoryInterface|MockObject */\n    private MockObject $repositoryMock;\n\n    /** @var FactoryInterface|MockObject */\n    private MockObject $factoryMock;\n\n    /** @var NewResourceFactoryInterface|MockObject */\n    private MockObject $newResourceFactoryMock;\n\n    /** @var ObjectManager|MockObject */\n    private MockObject $managerMock;\n\n    /** @var SingleResourceProviderInterface|MockObject */\n    private MockObject $singleResourceProviderMock;\n\n    /** @var ResourcesCollectionProviderInterface|MockObject */\n    private MockObject $resourcesCollectionProviderMock;\n\n    /** @var ResourceFormFactoryInterface|MockObject */\n    private MockObject $resourceFormFactoryMock;\n\n    /** @var RedirectHandlerInterface|MockObject */\n    private MockObject $redirectHandlerMock;\n\n    /** @var FlashHelperInterface|MockObject */\n    private MockObject $flashHelperMock;\n\n    /** @var AuthorizationCheckerInterface|MockObject */\n    private MockObject $authorizationCheckerMock;\n\n    /** @var EventDispatcherInterface|MockObject */\n    private MockObject $eventDispatcherMock;\n\n    /** @var StateMachineInterface|MockObject */\n    private MockObject $stateMachineMock;\n\n    /** @var ResourceUpdateHandlerInterface|MockObject */\n    private MockObject $resourceUpdateHandlerMock;\n\n    /** @var ResourceDeleteHandlerInterface|MockObject */\n    private MockObject $resourceDeleteHandlerMock;\n\n    /** @var ContainerInterface|MockObject */\n    private MockObject $containerMock;\n\n    private ResourceController $resourceController;\n\n    protected function setUp(): void\n    {\n        $this->metadataMock = $this->createMock(MetadataInterface::class);\n        $this->requestConfigurationFactoryMock = $this->createMock(RequestConfigurationFactoryInterface::class);\n        $this->viewHandlerMock = $this->createMock(ViewHandlerInterface::class);\n        $this->repositoryMock = $this->createMock(RepositoryInterface::class);\n        $this->factoryMock = $this->createMock(FactoryInterface::class);\n        $this->newResourceFactoryMock = $this->createMock(NewResourceFactoryInterface::class);\n        $this->managerMock = $this->createMock(ObjectManager::class);\n        $this->singleResourceProviderMock = $this->createMock(SingleResourceProviderInterface::class);\n        $this->resourcesCollectionProviderMock = $this->createMock(ResourcesCollectionProviderInterface::class);\n        $this->resourceFormFactoryMock = $this->createMock(ResourceFormFactoryInterface::class);\n        $this->redirectHandlerMock = $this->createMock(RedirectHandlerInterface::class);\n        $this->flashHelperMock = $this->createMock(FlashHelperInterface::class);\n        $this->authorizationCheckerMock = $this->createMock(AuthorizationCheckerInterface::class);\n        $this->eventDispatcherMock = $this->createMock(EventDispatcherInterface::class);\n        $this->stateMachineMock = $this->createMock(StateMachineInterface::class);\n        $this->resourceUpdateHandlerMock = $this->createMock(ResourceUpdateHandlerInterface::class);\n        $this->resourceDeleteHandlerMock = $this->createMock(ResourceDeleteHandlerInterface::class);\n        $this->containerMock = $this->createMock(ContainerInterface::class);\n        $this->resourceController = new ResourceController($this->metadataMock, $this->requestConfigurationFactoryMock, $this->viewHandlerMock, $this->repositoryMock, $this->factoryMock, $this->newResourceFactoryMock, $this->managerMock, $this->singleResourceProviderMock, $this->resourcesCollectionProviderMock, $this->resourceFormFactoryMock, $this->redirectHandlerMock, $this->flashHelperMock, $this->authorizationCheckerMock, $this->eventDispatcherMock, $this->stateMachineMock, $this->resourceUpdateHandlerMock, $this->resourceDeleteHandlerMock);\n        $this->resourceController->setContainer($this->containerMock);\n    }\n\n    public function testThrowsA403ExceptionIfUserIsUnauthorizedToViewASingleResource(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n\n        $request = new Request();\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::SHOW)->willReturn('sylius.product.show');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.show')->willReturn(false);\n\n        $this->expectException(AccessDeniedException::class);\n\n        $this->resourceController->showAction($request);\n    }\n\n    public function testThrowsA404ExceptionIfResourceIsNotFoundBasedOnConfiguration(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        $request = new Request();\n\n        $this->metadataMock->expects($this->once())->method('getHumanizedName')->willReturn('product');\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::SHOW)->willReturn('sylius.product.show');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.show')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn(null);\n\n        $this->expectException(NotFoundHttpException::class);\n        $this->expectExceptionMessage('The \"product\" has not been found');\n\n        $this->resourceController->showAction($request);\n    }\n\n    public function testReturnsAResponseForHtmlViewOfASingleResource(): void\n    {\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        $twigMock = $this->createMock(Environment::class);\n        $request = new Request();\n\n        $this->metadataMock->expects($this->once())->method('getName')->willReturn('product');\n\n        $this->requestConfigurationFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($this->metadataMock, $request)\n            ->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())\n            ->method('getPermission')\n            ->with(ResourceActions::SHOW)\n            ->willReturn('sylius.product.show');\n\n        $this->authorizationCheckerMock\n            ->expects($this->once())\n            ->method('isGranted')\n            ->with($configurationMock, 'sylius.product.show')\n            ->willReturn(true);\n\n        $this->singleResourceProviderMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($configurationMock, $this->repositoryMock)\n            ->willReturn($resourceMock);\n\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n        $configurationMock->expects($this->once())\n            ->method('getTemplate')\n            ->with(ResourceActions::SHOW . '.html')\n            ->willReturn('@SyliusShop/Product/show.html.twig');\n\n        $this->containerMock->method('has')\n            ->willReturnMap([\n                ['templating', false],\n                ['twig', true],\n            ]);\n        $this->containerMock->method('get')->with('twig')->willReturn($twigMock);\n\n        $expectedContext = [\n            'configuration' => $configurationMock,\n            'metadata' => $this->metadataMock,\n            'resource' => $resourceMock,\n            'product' => $resourceMock,\n        ];\n\n        $twigMock->expects($this->once())\n            ->method('render')\n            ->with('@SyliusShop/Product/show.html.twig', $expectedContext)\n            ->willReturn('rendered');\n\n        $response = $this->resourceController->showAction($request);\n\n        $this->assertInstanceOf(Response::class, $response);\n        $this->assertSame('rendered', $response->getContent());\n    }\n\n    public function testReturnsEventResponseIfExistsDuringShow(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::SHOW)->willReturn('sylius.product.show');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.show')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatch')->with(ResourceActions::SHOW, $configurationMock, $resourceMock)->willReturn($eventMock);\n        $eventMock->expects($this->once())->method('getResponse')->willReturn($responseMock);\n        $configurationMock->expects($this->never())->method('isHtmlRequest');\n        $this->viewHandlerMock->expects($this->never())->method('handle');\n\n        $this->assertSame($responseMock, $this->resourceController->showAction($request));\n    }\n\n    public function testReturnsAResponseForNonHtmlViewOfSingleResource(): void\n    {\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        $responseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n\n        $this->requestConfigurationFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($this->metadataMock, $request)\n            ->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::SHOW)->willReturn('sylius.product.show');\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.show')->willReturn(true);\n\n        $this->singleResourceProviderMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($configurationMock, $this->repositoryMock)\n            ->willReturn($resourceMock);\n\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(false);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatch')->with(ResourceActions::SHOW, $configurationMock, $resourceMock);\n\n        $this->viewHandlerMock\n            ->expects($this->once())\n            ->method('handle')\n            ->willReturn($responseMock);\n\n        $this->assertSame($responseMock, $this->resourceController->showAction($request));\n    }\n\n    public function testThrowsA403ExceptionIfUserIsUnauthorizedToViewAnIndexOfResources(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n\n        $request = new Request();\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::INDEX)->willReturn('sylius.product.index');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.index')->willReturn(false);\n\n        $this->expectException(AccessDeniedException::class);\n\n        $this->resourceController->indexAction($request);\n    }\n\n    public function testReturnsAResponseForHtmlViewOfPaginatedResources(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resource1Mock */\n        $resource1Mock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceInterface|MockObject $resource2Mock */\n        $resource2Mock = $this->createMock(ResourceInterface::class);\n        /** @var Environment|MockObject $twigMock */\n        $twigMock = $this->createMock(Environment::class);\n\n        $this->metadataMock->expects($this->once())->method('getPluralName')->willReturn('products');\n\n        $request = new Request();\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::INDEX)->willReturn('sylius.product.index');\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getTemplate')->with(ResourceActions::INDEX . '.html')->willReturn('@SyliusShop/Product/index.html.twig');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.index')->willReturn(true);\n        $this->resourcesCollectionProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn([$resource1Mock, $resource2Mock]);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchMultiple')->with(ResourceActions::INDEX, $configurationMock, [$resource1Mock, $resource2Mock]);\n        $this->containerMock->method('has')\n            ->willReturnMap([\n                ['templating', false],\n                ['twig', true],\n            ]);\n        $this->containerMock->expects($this->once())->method('get')->with('twig')->willReturn($twigMock);\n\n        $expectedContext = [\n            'configuration' => $configurationMock,\n            'metadata' => $this->metadataMock,\n            'resources' => [$resource1Mock, $resource2Mock],\n            'products' => [$resource1Mock, $resource2Mock],\n        ];\n\n        $twigMock->expects($this->once())->method('render')->willReturnMap([['@SyliusShop/Product/index.html.twig', $expectedContext, 'view'], ['@SyliusShop/Product/index.html.twig', $expectedContext]]);\n\n        $this->resourceController->indexAction($request);\n    }\n\n    public function testReturnsEventResponseIfExistsDuringIndex(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var ResourceInterface|MockObject $resource1Mock */\n        $resource1Mock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceInterface|MockObject $resource2Mock */\n        $resource2Mock = $this->createMock(ResourceInterface::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::INDEX)->willReturn('sylius.product.index');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.index')->willReturn(true);\n        $this->resourcesCollectionProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn([$resource1Mock, $resource2Mock]);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchMultiple')->with(ResourceActions::INDEX, $configurationMock, [$resource1Mock, $resource2Mock])->willReturn($eventMock);\n\n        $eventMock->expects($this->once())->method('getResponse')->willReturn($responseMock);\n        $configurationMock->expects($this->never())->method('isHtmlRequest');\n\n        $this->viewHandlerMock->expects($this->never())->method('handle');\n\n        $this->assertSame($responseMock, $this->resourceController->indexAction($request));\n    }\n\n    public function testThrowsA403ExceptionIfUserIsUnauthorizedToCreateANewResource(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n\n        $request = new Request();\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::CREATE)->willReturn('sylius.product.create');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.create')->willReturn(false);\n\n        $this->expectException(AccessDeniedException::class);\n\n        $this->resourceController->createAction($request);\n    }\n\n    public function testReturnsAHtmlResponseForCreatingNewResourceForm(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $newResourceMock */\n        $newResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var FormView|MockObject $formViewMock */\n        $formViewMock = $this->createMock(FormView::class);\n        /** @var Environment|MockObject $twigMock */\n        $twigMock = $this->createMock(Environment::class);\n\n        $request = new Request();\n        $request->setMethod('GET');\n        $this->metadataMock->expects($this->once())->method('getName')->willReturn('product');\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::CREATE)->willReturn('sylius.product.create');\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getTemplate')->with(ResourceActions::CREATE . '.html')->willReturn('@SyliusShop/Product/create.html.twig');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.create')->willReturn(true);\n        $this->newResourceFactoryMock->expects($this->once())->method('create')->with($configurationMock, $this->factoryMock)->willReturn($newResourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $newResourceMock)->willReturn($formMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchInitializeEvent')->with(ResourceActions::CREATE, $configurationMock, $newResourceMock)->willReturn($eventMock);\n\n        $eventMock->expects($this->once())->method('getResponse')->willReturn(null);\n        $formMock->expects($this->once())->method('createView')->willReturn($formViewMock);\n        $formMock->method('handleRequest')->willReturnMap([[$request, $formMock], [$request]]);\n\n        $this->containerMock->method('has')\n            ->willReturnMap([\n                ['templating', false],\n                ['twig', true],\n            ]);\n        $this->containerMock->expects($this->once())->method('get')->with('twig')->willReturn($twigMock);\n\n        $expectedContext = [\n            'configuration' => $configurationMock,\n            'metadata' => $this->metadataMock,\n            'resource' => $newResourceMock,\n            'product' => $newResourceMock,\n            'form' => $formViewMock,\n        ];\n\n        $twigMock->expects($this->once())->method('render')->with('@SyliusShop/Product/create.html.twig', $expectedContext)->willReturn('view');\n        $twigMock->method('render')->willReturnMap([['@SyliusShop/Product/create.html.twig', $expectedContext, 'view'], ['@SyliusShop/Product/create.html.twig', $expectedContext]]);\n\n        $this->resourceController->createAction($request);\n    }\n\n    public function testReturnsAHtmlResponseForInvalidFormDuringResourceCreation(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $newResourceMock */\n        $newResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var FormView|MockObject $formViewMock */\n        $formViewMock = $this->createMock(FormView::class);\n        /** @var Environment|MockObject $twigMock */\n        $twigMock = $this->createMock(Environment::class);\n\n        $request = new Request();\n        $request->setMethod('POST');\n        $this->metadataMock->expects($this->once())->method('getName')->willReturn('product');\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::CREATE)->willReturn('sylius.product.create');\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getTemplate')->with(ResourceActions::CREATE . '.html')->willReturn('@SyliusShop/Product/create.html.twig');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.create')->willReturn(true);\n        $this->newResourceFactoryMock->expects($this->once())->method('create')->with($configurationMock, $this->factoryMock)->willReturn($newResourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $newResourceMock)->willReturn($formMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchInitializeEvent')->with(ResourceActions::CREATE, $configurationMock, $newResourceMock)->willReturn($eventMock);\n\n        $eventMock->expects($this->once())->method('getResponse')->willReturn(null);\n        $formMock->expects($this->once())->method('handleRequest')->with($request)->willReturn($formMock);\n        $formMock->method('isSubmitted')->willReturn(true);\n        $formMock->method('isValid')->willReturn(false);\n        $formMock->expects($this->once())->method('createView')->willReturn($formViewMock);\n        $this->containerMock->method('has')\n            ->willReturnMap([\n                ['templating', false],\n                ['twig', true],\n            ]);\n        $this->containerMock->expects($this->once())->method('get')->with('twig')->willReturn($twigMock);\n\n        $expectedContext = [\n            'configuration' => $configurationMock,\n            'metadata' => $this->metadataMock,\n            'resource' => $newResourceMock,\n            'product' => $newResourceMock,\n            'form' => $formViewMock,\n        ];\n\n        $twigMock->method('render')->willReturnMap([['@SyliusShop/Product/create.html.twig', $expectedContext, 'view'], ['@SyliusShop/Product/create.html.twig', $expectedContext]]);\n\n        $this->resourceController->createAction($request);\n    }\n\n    public function testReturnsAHtmlResponseForNotSubmittedFormDuringResourceCreation(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $newResourceMock */\n        $newResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var FormView|MockObject $formViewMock */\n        $formViewMock = $this->createMock(FormView::class);\n        /** @var Environment|MockObject $twigMock */\n        $twigMock = $this->createMock(Environment::class);\n\n        $request = new Request();\n        $request->setMethod('POST');\n        $this->metadataMock->expects($this->once())->method('getName')->willReturn('product');\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::CREATE)->willReturn('sylius.product.create');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.create')->willReturn(true);\n\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getTemplate')->with(ResourceActions::CREATE . '.html')->willReturn('@SyliusShop/Product/create.html.twig');\n\n        $this->newResourceFactoryMock->expects($this->once())->method('create')->with($configurationMock, $this->factoryMock)->willReturn($newResourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $newResourceMock)->willReturn($formMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchInitializeEvent')->with(ResourceActions::CREATE, $configurationMock, $newResourceMock)->willReturn($eventMock);\n\n        $eventMock->expects($this->once())->method('getResponse')->willReturn(null);\n        $formMock->expects($this->once())->method('handleRequest')->with($request)->willReturn($formMock);\n        $formMock->method('isSubmitted')->willReturn(false);\n        $formMock->expects($this->once())->method('createView')->willReturn($formViewMock);\n\n        $this->containerMock->method('has')\n            ->willReturnMap([\n                ['templating', false],\n                ['twig', true],\n            ]);\n        $this->containerMock->expects($this->once())->method('get')->with('twig')->willReturn($twigMock);\n\n        $expectedContext = [\n            'configuration' => $configurationMock,\n            'metadata' => $this->metadataMock,\n            'resource' => $newResourceMock,\n            'product' => $newResourceMock,\n            'form' => $formViewMock,\n        ];\n\n        $twigMock->method('render')->willReturnMap([['@SyliusShop/Product/create.html.twig', $expectedContext, 'view'], ['@SyliusShop/Product/create.html.twig', $expectedContext]]);\n\n        $this->resourceController->createAction($request);\n    }\n\n    public function testReturnsANonHtmlResponseForInvalidFormDuringResourceCreation(): void\n    {\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $newResourceMock */\n        $newResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n        $request->setMethod('POST');\n\n        $this->requestConfigurationFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($this->metadataMock, $request)\n            ->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::CREATE)->willReturn('sylius.product.create');\n\n        $this->authorizationCheckerMock\n            ->expects($this->once())\n            ->method('isGranted')\n            ->with($configurationMock, 'sylius.product.create')\n            ->willReturn(true);\n\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(false);\n\n        $this->newResourceFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($configurationMock, $this->factoryMock)\n            ->willReturn($newResourceMock);\n\n        $this->resourceFormFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($configurationMock, $newResourceMock)\n            ->willReturn($formMock);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request);\n        $formMock->method('isSubmitted')->willReturn(true);\n        $formMock->method('isValid')->willReturn(false);\n\n        $expectedView = View::create($formMock, 400);\n\n        $this->viewHandlerMock\n            ->expects($this->once())\n            ->method('handle')\n            ->with(\n                $this->anything(),\n                $this->callback(function ($view) use ($expectedView) {\n                    return $view instanceof View &&\n                        $view->getData() === $expectedView->getData() &&\n                        $view->getStatusCode() === $expectedView->getStatusCode();\n                }),\n            )\n            ->willReturn($responseMock);\n\n        $this->assertSame($responseMock, $this->resourceController->createAction($request));\n    }\n\n    public function testReturnsANonHtmlResponseForNotSubmittedFormDuringResourceCreation(): void\n    {\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $newResourceMock */\n        $newResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n        $request->setMethod('POST');\n\n        $this->requestConfigurationFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($this->metadataMock, $request)\n            ->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::CREATE)->willReturn('sylius.product.create');\n\n        $this->authorizationCheckerMock\n            ->expects($this->once())\n            ->method('isGranted')\n            ->with($configurationMock, 'sylius.product.create')\n            ->willReturn(true);\n\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(false);\n\n        $this->newResourceFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($configurationMock, $this->factoryMock)\n            ->willReturn($newResourceMock);\n\n        $this->resourceFormFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($configurationMock, $newResourceMock)\n            ->willReturn($formMock);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request);\n        $formMock->method('isSubmitted')->willReturn(false);\n\n        $expectedView = View::create($formMock, 400);\n\n        $this->viewHandlerMock\n            ->expects($this->once())\n            ->method('handle')\n            ->with(\n                $this->anything(),\n                $this->callback(function ($view) use ($expectedView) {\n                    return $view instanceof View &&\n                        $view->getData() === $expectedView->getData() &&\n                        $view->getStatusCode() === $expectedView->getStatusCode();\n                }),\n            )\n            ->willReturn($responseMock);\n\n        $this->assertSame($responseMock, $this->resourceController->createAction($request));\n    }\n\n    public function testDoesNotCreateTheResourceAndRedirectsToIndexForHtmlRequestsStoppedViaEvents(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $newResourceMock */\n        $newResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $redirectResponseMock */\n        $redirectResponseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n        $request->setMethod('POST');\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::CREATE)->willReturn('sylius.product.create');\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.create')->willReturn(true);\n        $this->newResourceFactoryMock->expects($this->once())->method('create')->with($configurationMock, $this->factoryMock)->willReturn($newResourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $newResourceMock)->willReturn($formMock);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request)->willReturn($formMock);\n        $formMock->expects($this->once())->method('isSubmitted')->willReturn(true);\n        $formMock->expects($this->once())->method('isValid')->willReturn(true);\n        $formMock->expects($this->once())->method('getData')->willReturn($newResourceMock);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::CREATE, $configurationMock, $newResourceMock)->willReturn($eventMock);\n        $eventMock->method('isStopped')->willReturn(true);\n\n        $this->flashHelperMock->expects($this->once())->method('addFlashFromEvent')->with($configurationMock, $eventMock);\n\n        $eventMock->expects($this->once())->method('getResponse')->willReturn(null);\n\n        $this->repositoryMock->expects($this->never())->method('add')->with($newResourceMock);\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPostEvent')->with(ResourceActions::CREATE, $configurationMock, $newResourceMock);\n        $this->flashHelperMock->expects($this->never())->method('addSuccessFlash');\n        $this->redirectHandlerMock->expects($this->once())->method('redirectToIndex')->with($configurationMock, $newResourceMock)->willReturn($redirectResponseMock);\n\n        $this->assertSame($redirectResponseMock, $this->resourceController->createAction($request));\n    }\n\n    public function testDoesNotCreateTheResourceAndReturnResponseForHtmlRequestsStoppedViaEvents(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $newResourceMock */\n        $newResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n        $request->setMethod('POST');\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::CREATE)->willReturn('sylius.product.create');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.create')->willReturn(true);\n\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n\n        $this->newResourceFactoryMock->expects($this->once())->method('create')->with($configurationMock, $this->factoryMock)->willReturn($newResourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $newResourceMock)->willReturn($formMock);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request)->willReturn($formMock);\n        $formMock->expects($this->once())->method('isSubmitted')->willReturn(true);\n        $formMock->expects($this->once())->method('isValid')->willReturn(true);\n        $formMock->expects($this->once())->method('getData')->willReturn($newResourceMock);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::CREATE, $configurationMock, $newResourceMock)->willReturn($eventMock);\n\n        $eventMock->method('isStopped')->willReturn(true);\n        $eventMock->expects($this->once())->method('getResponse')->willReturn($responseMock);\n\n        $this->flashHelperMock->expects($this->once())->method('addFlashFromEvent')->with($configurationMock, $eventMock);\n        $this->repositoryMock->expects($this->never())->method('add')->with($newResourceMock);\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPostEvent')->with(ResourceActions::CREATE, $configurationMock, $newResourceMock);\n        $this->flashHelperMock->expects($this->never())->method('addSuccessFlash');\n\n        $this->assertSame($responseMock, $this->resourceController->createAction($request));\n    }\n\n    public function testRedirectsToNewlyCreatedResource(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $newResourceMock */\n        $newResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var ResourceControllerEvent|MockObject $postEventMock */\n        $postEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $redirectResponseMock */\n        $redirectResponseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n        $request->setMethod('POST');\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::CREATE)->willReturn('sylius.product.create');\n        $configurationMock->expects($this->once())->method('hasStateMachine')->willReturn(true);\n        $configurationMock->method('isHtmlRequest')->willReturn(true);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.create')->willReturn(true);\n        $this->newResourceFactoryMock->expects($this->once())->method('create')->with($configurationMock, $this->factoryMock)->willReturn($newResourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $newResourceMock)->willReturn($formMock);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request)->willReturn($formMock);\n        $formMock->expects($this->once())->method('isSubmitted')->willReturn(true);\n        $formMock->expects($this->once())->method('isValid')->willReturn(true);\n        $formMock->expects($this->once())->method('getData')->willReturn($newResourceMock);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::CREATE, $configurationMock, $newResourceMock)->willReturn($eventMock);\n        $eventMock->method('isStopped')->willReturn(false);\n\n        $this->stateMachineMock->expects($this->once())->method('apply')->with($configurationMock, $newResourceMock);\n        $this->repositoryMock->expects($this->once())->method('add')->with($newResourceMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPostEvent')->with(ResourceActions::CREATE, $configurationMock, $newResourceMock)->willReturn($postEventMock);\n\n        $postEventMock->expects($this->once())->method('getResponse')->willReturn(null);\n\n        $this->flashHelperMock->expects($this->once())->method('addSuccessFlash')->with($configurationMock, ResourceActions::CREATE, $newResourceMock);\n        $this->redirectHandlerMock->expects($this->once())->method('redirectToResource')->with($configurationMock, $newResourceMock)->willReturn($redirectResponseMock);\n\n        $this->assertSame($redirectResponseMock, $this->resourceController->createAction($request));\n    }\n\n    public function testUsesResponseFromPostCreateEventIfDefined(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $newResourceMock */\n        $newResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var ResourceControllerEvent|MockObject $postEventMock */\n        $postEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $redirectResponseMock */\n        $redirectResponseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n        $request->setMethod('POST');\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::CREATE)->willReturn('sylius.product.create');\n        $configurationMock->expects($this->once())->method('hasStateMachine')->willReturn(true);\n        $configurationMock->method('isHtmlRequest')->willReturn(true);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.create')->willReturn(true);\n        $this->newResourceFactoryMock->expects($this->once())->method('create')->with($configurationMock, $this->factoryMock)->willReturn($newResourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $newResourceMock)->willReturn($formMock);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request)->willReturn($formMock);\n        $formMock->expects($this->once())->method('isSubmitted')->willReturn(true);\n        $formMock->expects($this->once())->method('isValid')->willReturn(true);\n        $formMock->expects($this->once())->method('getData')->willReturn($newResourceMock);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::CREATE, $configurationMock, $newResourceMock)->willReturn($eventMock);\n        $eventMock->method('isStopped')->willReturn(false);\n\n        $this->stateMachineMock->expects($this->once())->method('apply')->with($configurationMock, $newResourceMock);\n        $this->repositoryMock->expects($this->once())->method('add')->with($newResourceMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPostEvent')->with(ResourceActions::CREATE, $configurationMock, $newResourceMock)->willReturn($postEventMock);\n        $this->flashHelperMock->expects($this->once())->method('addSuccessFlash')->with($configurationMock, ResourceActions::CREATE, $newResourceMock);\n\n        $postEventMock->expects($this->once())->method('getResponse')->willReturn($redirectResponseMock);\n\n        $this->assertSame($redirectResponseMock, $this->resourceController->createAction($request));\n    }\n\n    public function testReturnsANonHtmlResponseForCorrectlyCreatedResources(): void\n    {\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $newResourceMock */\n        $newResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n        $request->setMethod('POST');\n\n        $this->requestConfigurationFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($this->metadataMock, $request)\n            ->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::CREATE)->willReturn('sylius.product.create');\n        $configurationMock->expects($this->once())->method('hasStateMachine')->willReturn(true);\n\n        $this->authorizationCheckerMock\n            ->expects($this->once())\n            ->method('isGranted')\n            ->with($configurationMock, 'sylius.product.create')\n            ->willReturn(true);\n\n        $configurationMock->method('isHtmlRequest')->willReturn(false);\n\n        $this->newResourceFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($configurationMock, $this->factoryMock)\n            ->willReturn($newResourceMock);\n\n        $this->resourceFormFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($configurationMock, $newResourceMock)\n            ->willReturn($formMock);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request);\n        $formMock->expects($this->once())->method('isSubmitted')->willReturn(true);\n        $formMock->expects($this->once())->method('isValid')->willReturn(true);\n        $formMock->expects($this->once())->method('getData')->willReturn($newResourceMock);\n\n        $this->eventDispatcherMock\n            ->expects($this->once())\n            ->method('dispatchPreEvent')\n            ->with(ResourceActions::CREATE, $configurationMock, $newResourceMock)\n            ->willReturn($eventMock);\n\n        $eventMock->method('isStopped')->willReturn(false);\n\n        $this->stateMachineMock\n            ->expects($this->once())\n            ->method('apply')\n            ->with($configurationMock, $newResourceMock);\n\n        $this->repositoryMock\n            ->expects($this->once())\n            ->method('add')\n            ->with($newResourceMock);\n\n        $this->eventDispatcherMock\n            ->expects($this->once())\n            ->method('dispatchPostEvent')\n            ->with(ResourceActions::CREATE, $configurationMock, $newResourceMock);\n\n        $this->flashHelperMock->expects($this->never())->method('addSuccessFlash');\n\n        $expectedView = View::create($newResourceMock, 201);\n\n        $this->viewHandlerMock\n            ->expects($this->once())\n            ->method('handle')\n            ->with(\n                $this->anything(),\n                $this->callback(function ($view) use ($expectedView) {\n                    return $view instanceof View &&\n                        $view->getData() === $expectedView->getData() &&\n                        $view->getStatusCode() === $expectedView->getStatusCode();\n                }),\n            )\n            ->willReturn($responseMock);\n\n        $this->assertSame($responseMock, $this->resourceController->createAction($request));\n    }\n\n    public function testDoesNotCreateTheResourceAndThrowsHttpExceptionForNonHtmlRequestsStoppedViaEvent(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $newResourceMock */\n        $newResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n\n        $request = new Request();\n        $request->setMethod('POST');\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::CREATE)->willReturn('sylius.product.create');\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(false);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.create')->willReturn(true);\n        $this->newResourceFactoryMock->expects($this->once())->method('create')->with($configurationMock, $this->factoryMock)->willReturn($newResourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $newResourceMock)->willReturn($formMock);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request)->willReturn($formMock);\n        $formMock->expects($this->once())->method('isSubmitted')->willReturn(true);\n        $formMock->expects($this->once())->method('isValid')->willReturn(true);\n        $formMock->expects($this->once())->method('getData')->willReturn($newResourceMock);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::CREATE, $configurationMock, $newResourceMock)->willReturn($eventMock);\n        $eventMock->expects($this->once())->method('isStopped')->willReturn(true);\n        $eventMock->expects($this->once())->method('getMessage')->willReturn('You cannot add a new product right now.');\n        $eventMock->expects($this->once())->method('getErrorCode')->willReturn(500);\n\n        $this->repositoryMock->expects($this->never())->method('add')->with($newResourceMock);\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPostEvent')->with(ResourceActions::CREATE, $configurationMock, $newResourceMock);\n        $this->flashHelperMock->expects($this->never())->method('addSuccessFlash');\n\n        $this->expectException(HttpException::class);\n\n        $this->resourceController->createAction($request);\n    }\n\n    public function testThrowsA403ExceptionIfUserIsUnauthorizedToEditASingleResource(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n\n        $request = new Request();\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(false);\n\n        $this->expectException(AccessDeniedException::class);\n\n        $this->resourceController->updateAction($request);\n    }\n\n    public function testThrowsA404ExceptionIfResourceToUpdateIsNotFoundBasedOnConfiguration(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n\n        $request = new Request();\n\n        $this->metadataMock->expects($this->once())->method('getHumanizedName')->willReturn('product');\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn(null);\n\n        $this->expectException(NotFoundHttpException::class);\n        $this->expectExceptionMessage('The \"product\" has not been found');\n\n        $this->resourceController->updateAction($request);\n    }\n\n    public function testReturnsAHtmlResponseForUpdatingResourceForm(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var FormView|MockObject $formViewMock */\n        $formViewMock = $this->createMock(FormView::class);\n        /** @var Environment|MockObject $twigMock */\n        $twigMock = $this->createMock(Environment::class);\n\n        $request = $this->createMock(Request::class);\n        $request->setMethod('GET');\n\n        $this->metadataMock->expects($this->once())->method('getName')->willReturn('product');\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getTemplate')->with(ResourceActions::UPDATE . '.html')->willReturn('@SyliusShop/Product/update.html.twig');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $resourceMock)->willReturn($formMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchInitializeEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($eventMock);\n\n        $eventMock->expects($this->once())->method('getResponse')->willReturn(null);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request)->willReturn($formMock);\n        $formMock->expects($this->once())->method('createView')->willReturn($formViewMock);\n\n        $this->containerMock->method('has')\n            ->willReturnMap([\n                ['templating', false],\n                ['twig', true],\n            ]);\n        $this->containerMock->expects($this->once())->method('get')->with('twig')->willReturn($twigMock);\n\n        $expectedContext = [\n            'configuration' => $configurationMock,\n            'metadata' => $this->metadataMock,\n            'resource' => $resourceMock,\n            'product' => $resourceMock,\n            'form' => $formViewMock,\n        ];\n\n        $twigMock->method('render')->willReturnMap([['@SyliusShop/Product/update.html.twig', $expectedContext, 'view'], ['@SyliusShop/Product/update.html.twig', $expectedContext]]);\n\n        $this->resourceController->updateAction($request);\n    }\n\n    public function testReturnsAHtmlResponseForInvalidFormDuringResourceUpdate(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var FormView|MockObject $formViewMock */\n        $formViewMock = $this->createMock(FormView::class);\n        /** @var Environment|MockObject $twigMock */\n        $twigMock = $this->createMock(Environment::class);\n\n        $request = $this->createMock(Request::class);\n        $request->setMethod('PUT');\n\n        $this->metadataMock->expects($this->once())->method('getName')->willReturn('product');\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getTemplate')->with(ResourceActions::UPDATE . '.html')->willReturn('@SyliusShop/Product/update.html.twig');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $resourceMock)->willReturn($formMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchInitializeEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($eventMock);\n\n        $eventMock->expects($this->once())->method('getResponse')->willReturn(null);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request)->willReturn($formMock);\n        $formMock->method('isSubmitted')->willReturn(true);\n        $formMock->method('isValid')->willReturn(false);\n        $formMock->expects($this->once())->method('createView')->willReturn($formViewMock);\n\n        $this->containerMock->method('has')\n            ->willReturnMap([\n                ['templating', false],\n                ['twig', true],\n            ]);\n        $this->containerMock->expects($this->once())->method('get')->with('twig')->willReturn($twigMock);\n\n        $expectedContext = [\n            'configuration' => $configurationMock,\n            'metadata' => $this->metadataMock,\n            'resource' => $resourceMock,\n            'product' => $resourceMock,\n            'form' => $formViewMock,\n        ];\n\n        $twigMock->method('render')->willReturnMap([['@SyliusShop/Product/update.html.twig', $expectedContext, 'view'], ['@SyliusShop/Product/update.html.twig', $expectedContext]]);\n\n        $this->resourceController->updateAction($request);\n    }\n\n    public function testReturnsAHtmlResponseForNotSubmittedFormDuringResourceUpdate(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var FormView|MockObject $formViewMock */\n        $formViewMock = $this->createMock(FormView::class);\n        /** @var Environment|MockObject $twigMock */\n        $twigMock = $this->createMock(Environment::class);\n        /** @var Request|MockObject $request */\n        $request = new Request();\n        $request->setMethod('PUT');\n\n        $this->metadataMock->expects($this->once())->method('getName')->willReturn('product');\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getTemplate')->with(ResourceActions::UPDATE . '.html')->willReturn('@SyliusShop/Product/update.html.twig');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $resourceMock)->willReturn($formMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchInitializeEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($eventMock);\n\n        $eventMock->expects($this->once())->method('getResponse')->willReturn(null);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request)->willReturn($formMock);\n        $formMock->method('isSubmitted')->willReturn(false);\n        $formMock->expects($this->once())->method('createView')->willReturn($formViewMock);\n\n        $this->containerMock->method('has')\n            ->willReturnMap([\n                ['templating', false],\n                ['twig', true],\n            ]);\n        $this->containerMock->expects($this->once())->method('get')->with('twig')->willReturn($twigMock);\n\n        $expectedContext = [\n            'configuration' => $configurationMock,\n            'metadata' => $this->metadataMock,\n            'resource' => $resourceMock,\n            'product' => $resourceMock,\n            'form' => $formViewMock,\n        ];\n\n        $twigMock->method('render')->willReturnMap([['@SyliusShop/Product/update.html.twig', $expectedContext, 'view'], ['@SyliusShop/Product/update.html.twig', $expectedContext]]);\n\n        $this->resourceController->updateAction($request);\n    }\n\n    public function testReturnsANonHtmlResponseForInvalidFormDuringResourceUpdate(): void\n    {\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n        $request->setMethod('PATCH');\n\n        $this->requestConfigurationFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($this->metadataMock, $request)\n            ->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(false);\n\n        $this->authorizationCheckerMock\n            ->expects($this->once())\n            ->method('isGranted')\n            ->with($configurationMock, 'sylius.product.update')\n            ->willReturn(true);\n\n        $this->singleResourceProviderMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($configurationMock, $this->repositoryMock)\n            ->willReturn($resourceMock);\n\n        $this->resourceFormFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($configurationMock, $resourceMock)\n            ->willReturn($formMock);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request);\n        $formMock->method('isSubmitted')->willReturn(true);\n        $formMock->method('isValid')->willReturn(false);\n\n        $expectedView = View::create($formMock, 400);\n\n        $this->viewHandlerMock\n            ->expects($this->once())\n            ->method('handle')\n            ->with(\n                $this->anything(),\n                $this->callback(function ($view) use ($expectedView) {\n                    return $view instanceof View &&\n                        $view->getData() === $expectedView->getData() &&\n                        $view->getStatusCode() === $expectedView->getStatusCode();\n                }),\n            )\n            ->willReturn($responseMock);\n\n        $this->assertSame($responseMock, $this->resourceController->updateAction($request));\n    }\n\n    public function testReturnsANonHtmlResponseForNotSubmittedFormDuringResourceUpdate(): void\n    {\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n\n        $this->requestConfigurationFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($this->metadataMock, $requestMock)\n            ->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(false);\n\n        $this->authorizationCheckerMock\n            ->expects($this->once())\n            ->method('isGranted')\n            ->with($configurationMock, 'sylius.product.update')\n            ->willReturn(true);\n\n        $this->singleResourceProviderMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($configurationMock, $this->repositoryMock)\n            ->willReturn($resourceMock);\n\n        $this->resourceFormFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($configurationMock, $resourceMock)\n            ->willReturn($formMock);\n\n        $requestMock->method('isMethod')->with('PATCH')->willReturn(true);\n        $requestMock->method('getMethod')->willReturn('PATCH');\n\n        $formMock->expects($this->once())->method('handleRequest')->with($requestMock);\n        $formMock->method('isSubmitted')->willReturn(false);\n\n        $expectedView = View::create($formMock, 400);\n\n        $this->viewHandlerMock\n            ->expects($this->once())\n            ->method('handle')\n            ->with(\n                $this->anything(),\n                $this->callback(function ($view) use ($expectedView) {\n                    return $view instanceof View &&\n                        $view->getData() === $expectedView->getData() &&\n                        $view->getStatusCode() === $expectedView->getStatusCode();\n                }),\n            )\n            ->willReturn($responseMock);\n\n        $this->assertSame($responseMock, $this->resourceController->updateAction($requestMock));\n    }\n\n    public function testDoesNotUpdateTheResourceAndRedirectsToResourceForHtmlRequestIfStoppedViaEvent(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $redirectResponseMock */\n        $redirectResponseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n        $request->setMethod('PUT');\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $resourceMock)->willReturn($formMock);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request)->willReturn($formMock);\n        $formMock->expects($this->once())->method('isSubmitted')->willReturn(true);\n        $formMock->expects($this->once())->method('isValid')->willReturn(true);\n        $formMock->expects($this->once())->method('getData')->willReturn($resourceMock);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($eventMock);\n        $eventMock->method('isStopped')->willReturn(true);\n        $eventMock->expects($this->once())->method('getResponse')->willReturn(null);\n\n        $this->flashHelperMock->expects($this->once())->method('addFlashFromEvent')->with($configurationMock, $eventMock);\n        $this->managerMock->expects($this->never())->method('flush');\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPostEvent');\n        $this->flashHelperMock->expects($this->never())->method('addSuccessFlash');\n        $this->redirectHandlerMock->expects($this->once())->method('redirectToResource')->with($configurationMock, $resourceMock)->willReturn($redirectResponseMock);\n\n        $this->assertSame($redirectResponseMock, $this->resourceController->updateAction($request));\n    }\n\n    public function testRedirectsToUpdatedResource(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var ResourceControllerEvent|MockObject $preEventMock */\n        $preEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var ResourceControllerEvent|MockObject $postEventMock */\n        $postEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $redirectResponseMock */\n        $redirectResponseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n        $request->setMethod('PUT');\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->method('isHtmlRequest')->willReturn(true);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $resourceMock)->willReturn($formMock);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request)->willReturn($formMock);\n        $formMock->expects($this->once())->method('isSubmitted')->willReturn(true);\n        $formMock->expects($this->once())->method('isValid')->willReturn(true);\n        $formMock->expects($this->once())->method('getData')->willReturn($resourceMock);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($preEventMock);\n        $preEventMock->method('isStopped')->willReturn(false);\n\n        $this->resourceUpdateHandlerMock->expects($this->once())->method('handle')->with($resourceMock, $configurationMock, $this->managerMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPostEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($postEventMock);\n\n        $postEventMock->expects($this->once())->method('getResponse')->willReturn(null);\n\n        $this->flashHelperMock->expects($this->once())->method('addSuccessFlash')->with($configurationMock, ResourceActions::UPDATE, $resourceMock);\n        $this->redirectHandlerMock->expects($this->once())->method('redirectToResource')->with($configurationMock, $resourceMock)->willReturn($redirectResponseMock);\n\n        $this->assertSame($redirectResponseMock, $this->resourceController->updateAction($request));\n    }\n\n    public function testUsesResponseFromPostUpdateEventIfDefined(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var ResourceControllerEvent|MockObject $preEventMock */\n        $preEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var ResourceControllerEvent|MockObject $postEventMock */\n        $postEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $redirectResponseMock */\n        $redirectResponseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n        $request->setMethod('PUT');\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->method('isHtmlRequest')->willReturn(true);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $resourceMock)->willReturn($formMock);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request)->willReturn($formMock);\n        $formMock->expects($this->once())->method('isSubmitted')->willReturn(true);\n        $formMock->expects($this->once())->method('isValid')->willReturn(true);\n        $formMock->expects($this->once())->method('getData')->willReturn($resourceMock);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($preEventMock);\n        $preEventMock->method('isStopped')->willReturn(false);\n\n        $this->resourceUpdateHandlerMock->expects($this->once())->method('handle')->with($resourceMock, $configurationMock, $this->managerMock);\n        $this->flashHelperMock->expects($this->once())->method('addSuccessFlash')->with($configurationMock, ResourceActions::UPDATE, $resourceMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPostEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($postEventMock);\n\n        $postEventMock->expects($this->once())->method('getResponse')->willReturn($redirectResponseMock);\n\n        $this->redirectHandlerMock->expects($this->never())->method('redirectToResource')->with($configurationMock, $resourceMock);\n\n        $this->assertSame($redirectResponseMock, $this->resourceController->updateAction($request));\n    }\n\n    public function testUsesResponseFromInitializeCreateEventIfDefined(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $newResourceMock */\n        $newResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceControllerEvent|MockObject $initializeEventMock */\n        $initializeEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n        $request->setMethod('GET');\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::CREATE)->willReturn('sylius.product.create');\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.create')->willReturn(true);\n        $this->newResourceFactoryMock->expects($this->once())->method('create')->with($configurationMock, $this->factoryMock)->willReturn($newResourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $newResourceMock)->willReturn($formMock);\n\n        $formMock->expects($this->never())->method('createView');\n        $formMock->method('handleRequest')->willReturnMap([[$request, $formMock], [$request]]);\n\n        $initializeEventMock->expects($this->once())->method('getResponse')->willReturn($responseMock);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchInitializeEvent')->with(ResourceActions::CREATE, $configurationMock, $newResourceMock)->willReturn($initializeEventMock);\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPreEvent')->with(ResourceActions::CREATE, $configurationMock, $newResourceMock);\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPostEvent')->with(ResourceActions::CREATE, $configurationMock, $newResourceMock);\n        $this->redirectHandlerMock->expects($this->never())->method('redirectToResource')->with($configurationMock, $newResourceMock);\n\n        $this->containerMock->method('has')\n            ->willReturnMap([\n                ['templating', false],\n                ['twig', true],\n            ]);\n\n        $this->resourceController->createAction($request);\n    }\n\n    public function testUsesResponseFromInitializeUpdateEventIfDefined(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var ResourceControllerEvent|MockObject $initializeEventMock */\n        $initializeEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $resourceMock)->willReturn($formMock);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request)->willReturn($formMock);\n\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPreEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock);\n        $this->resourceUpdateHandlerMock->expects($this->never())->method('handle')->with($resourceMock, $configurationMock, $this->managerMock);\n        $this->flashHelperMock->expects($this->never())->method('addSuccessFlash')->with($configurationMock, ResourceActions::UPDATE, $resourceMock);\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPostEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock);\n        $this->redirectHandlerMock->expects($this->never())->method('redirectToResource')->with($configurationMock, $resourceMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchInitializeEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($initializeEventMock);\n\n        $initializeEventMock->expects($this->once())->method('getResponse')->willReturn($responseMock);\n\n        $this->assertSame($responseMock, $this->resourceController->updateAction($request));\n    }\n\n    public function testReturnsANonHtmlResponseForCorrectlyUpdatedResource(): void\n    {\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n\n        /** @var ParameterBagInterface|MockObject $parameterBagMock */\n        $parameterBagMock = $this->createMock(ParameterBagInterface::class);\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n        $request->setMethod('PUT');\n\n        $this->requestConfigurationFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($this->metadataMock, $request)\n            ->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->method('isHtmlRequest')->willReturn(false);\n        $configurationMock->expects($this->once())->method('getParameters')->willReturn($parameterBagMock);\n\n        $parameterBagMock->expects($this->once())->method('get')->with('return_content', false)->willReturn(false);\n\n        $this->authorizationCheckerMock\n            ->expects($this->once())\n            ->method('isGranted')\n            ->with($configurationMock, 'sylius.product.update')\n            ->willReturn(true);\n\n        $this->singleResourceProviderMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($configurationMock, $this->repositoryMock)\n            ->willReturn($resourceMock);\n\n        $this->resourceFormFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($configurationMock, $resourceMock)\n            ->willReturn($formMock);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request);\n        $formMock->expects($this->once())->method('isSubmitted')->willReturn(true);\n        $formMock->expects($this->once())->method('isValid')->willReturn(true);\n        $formMock->expects($this->once())->method('getData')->willReturn($resourceMock);\n\n        $this->eventDispatcherMock\n            ->expects($this->once())\n            ->method('dispatchPreEvent')\n            ->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)\n            ->willReturn($eventMock);\n\n        $eventMock->method('isStopped')->willReturn(false);\n\n        $this->resourceUpdateHandlerMock\n            ->expects($this->once())\n            ->method('handle')\n            ->with($resourceMock, $configurationMock, $this->managerMock);\n\n        $this->eventDispatcherMock\n            ->expects($this->once())\n            ->method('dispatchPostEvent')\n            ->with(ResourceActions::UPDATE, $configurationMock, $resourceMock);\n\n        $expectedView = View::create(null, 204);\n\n        $this->viewHandlerMock\n            ->expects($this->once())\n            ->method('handle')\n            ->with(\n                $this->anything(),\n                $this->callback(function ($view) use ($expectedView) {\n                    return $view instanceof View &&\n                        $view->getData() === $expectedView->getData() &&\n                        $view->getStatusCode() === $expectedView->getStatusCode();\n                }),\n            )\n            ->willReturn($responseMock);\n\n        $this->assertSame($responseMock, $this->resourceController->updateAction($request));\n    }\n\n    public function testDoesNotUpdateTheResourceThrowsAHttpExceptionForNonHtmlRequestsStoppedViaEvent(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n\n        $request = new Request();\n        $request->setMethod('PUT');\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(false);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $resourceMock)->willReturn($formMock);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request)->willReturn($formMock);\n        $formMock->expects($this->once())->method('isSubmitted')->willReturn(true);\n        $formMock->expects($this->once())->method('isValid')->willReturn(true);\n        $formMock->expects($this->once())->method('getData')->willReturn($resourceMock);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($eventMock);\n\n        $eventMock->method('isStopped')->willReturn(true);\n        $eventMock->expects($this->once())->method('getMessage')->willReturn('Cannot update this channel.');\n        $eventMock->expects($this->once())->method('getErrorCode')->willReturn(500);\n\n        $this->managerMock->expects($this->never())->method('flush');\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPostEvent');\n\n        $this->expectException(HttpException::class);\n\n        $this->resourceController->updateAction($request);\n    }\n\n    public function testAppliesStateMachineTransitionToUpdatedResourceIfConfigured(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var Form|MockObject $formMock */\n        $formMock = $this->createMock(Form::class);\n        /** @var ResourceControllerEvent|MockObject $preEventMock */\n        $preEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var ResourceControllerEvent|MockObject $postEventMock */\n        $postEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $redirectResponseMock */\n        $redirectResponseMock = $this->createMock(Response::class);\n        /** @var Request|MockObject $request */\n        $request = new Request();\n        $request->setMethod('PUT');\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->method('isHtmlRequest')->willReturn(true);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n        $this->resourceFormFactoryMock->expects($this->once())->method('create')->with($configurationMock, $resourceMock)->willReturn($formMock);\n\n        $formMock->expects($this->once())->method('handleRequest')->with($request)->willReturn($formMock);\n        $formMock->expects($this->once())->method('isSubmitted')->willReturn(true);\n        $formMock->expects($this->once())->method('isValid')->willReturn(true);\n        $formMock->expects($this->once())->method('getData')->willReturn($resourceMock);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($preEventMock);\n        $preEventMock->method('isStopped')->willReturn(false);\n\n        $this->resourceUpdateHandlerMock->expects($this->once())->method('handle')->with($resourceMock, $configurationMock, $this->managerMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPostEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($postEventMock);\n\n        $postEventMock->expects($this->once())->method('getResponse')->willReturn(null);\n\n        $this->flashHelperMock->expects($this->once())->method('addSuccessFlash')->with($configurationMock, ResourceActions::UPDATE, $resourceMock);\n        $this->redirectHandlerMock->expects($this->once())->method('redirectToResource')->with($configurationMock, $resourceMock)->willReturn($redirectResponseMock);\n\n        $this->assertSame($redirectResponseMock, $this->resourceController->updateAction($request));\n    }\n\n    public function testThrowsA403ExceptionIfUserIsUnauthorizedToDeleteMultipleResources(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n\n        $request = new Request();\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::BULK_DELETE)->willReturn('sylius.product.bulk_delete');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.bulk_delete')->willReturn(false);\n\n        $this->expectException(AccessDeniedException::class);\n\n        $this->resourceController->bulkDeleteAction($request);\n    }\n\n    public function testDeletesMultipleResourcesAndRedirectsToIndexForHtmlRequest(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $firstResourceMock */\n        $firstResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceInterface|MockObject $secondResourceMock */\n        $secondResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var CsrfTokenManagerInterface|MockObject $csrfTokenManagerMock */\n        $csrfTokenManagerMock = $this->createMock(CsrfTokenManagerInterface::class);\n        /** @var ResourceControllerEvent|MockObject $firstPreEventMock */\n        $firstPreEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var ResourceControllerEvent|MockObject $secondPreEventMock */\n        $secondPreEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var ResourceControllerEvent|MockObject $firstPostEventMock */\n        $firstPostEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var ResourceControllerEvent|MockObject $secondPostEventMock */\n        $secondPostEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $redirectResponseMock */\n        $redirectResponseMock = $this->createMock(Response::class);\n\n        $request = new Request(request: ['_csrf_token' => 'xyz']);\n\n        $this->requestConfigurationFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($this->metadataMock, $request)\n            ->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::BULK_DELETE)->willReturn('sylius.product.bulk_delete');\n\n        $this->containerMock->expects($this->once())->method('has')->with('security.csrf.token_manager')->willReturn(true);\n        $this->containerMock->expects($this->once())->method('get')->with('security.csrf.token_manager')->willReturn($csrfTokenManagerMock);\n        $csrfTokenManagerMock->expects($this->once())->method('isTokenValid')->with(new CsrfToken('bulk_delete', 'xyz'))->willReturn(true);\n\n        $this->eventDispatcherMock\n            ->expects($this->once())\n            ->method('dispatchMultiple')\n            ->with(ResourceActions::BULK_DELETE, $configurationMock, [$firstResourceMock, $secondResourceMock]);\n\n        $this->authorizationCheckerMock\n            ->expects($this->once())\n            ->method('isGranted')\n            ->with($configurationMock, 'sylius.product.bulk_delete')\n            ->willReturn(true);\n\n        $this->resourcesCollectionProviderMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($configurationMock, $this->repositoryMock)\n            ->willReturn([$firstResourceMock, $secondResourceMock]);\n\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(true);\n\n        $this->eventDispatcherMock\n            ->expects($this->exactly(2))\n            ->method('dispatchPreEvent')\n            ->willReturnCallback(function ($action, $configuration, $resource) use ($firstResourceMock, $secondResourceMock, $firstPreEventMock, $secondPreEventMock) {\n                if ($resource === $firstResourceMock) {\n                    return $firstPreEventMock;\n                }\n                if ($resource === $secondResourceMock) {\n                    return $secondPreEventMock;\n                }\n\n                return null;\n            });\n\n        $firstPreEventMock->method('isStopped')->willReturn(false);\n        $secondPreEventMock->method('isStopped')->willReturn(false);\n\n        $this->resourceDeleteHandlerMock\n            ->expects($this->exactly(2))\n            ->method('handle')\n            ->willReturnCallback(function ($resource, $repository) use ($firstResourceMock, $secondResourceMock) {\n                static $call = 0;\n                ++$call;\n\n                if ($call === 1) {\n                    $this->assertSame($firstResourceMock, $resource);\n                } elseif ($call === 2) {\n                    $this->assertSame($secondResourceMock, $resource);\n                }\n\n                $this->assertSame($this->repositoryMock, $repository);\n            });\n\n        $this->eventDispatcherMock\n            ->expects($this->exactly(2))\n            ->method('dispatchPostEvent')\n            ->willReturnCallback(function ($action, $configuration, $resource) use ($firstResourceMock, $secondResourceMock, $firstPostEventMock, $secondPostEventMock) {\n                if ($resource === $firstResourceMock) {\n                    return $firstPostEventMock;\n                }\n                if ($resource === $secondResourceMock) {\n                    return $secondPostEventMock;\n                }\n\n                return null;\n            });\n\n        $secondPostEventMock->expects($this->once())->method('getResponse')->willReturn(null);\n\n        $this->flashHelperMock\n            ->expects($this->once())\n            ->method('addSuccessFlash')\n            ->with($configurationMock, ResourceActions::BULK_DELETE);\n\n        $this->redirectHandlerMock\n            ->expects($this->once())\n            ->method('redirectToIndex')\n            ->with($configurationMock)\n            ->willReturn($redirectResponseMock);\n\n        $this->assertSame($redirectResponseMock, $this->resourceController->bulkDeleteAction($request));\n    }\n\n    public function testThrowsA403ExceptionIfUserIsUnauthorizedToDeleteASingleResource(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n\n        $request = new Request();\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::DELETE)->willReturn('sylius.product.delete');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.delete')->willReturn(false);\n\n        $this->expectException(AccessDeniedException::class);\n\n        $this->resourceController->deleteAction($request);\n    }\n\n    public function testThrowsA404ExceptionIfResourceForDeletionIsNotFoundBasedOnConfiguration(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n\n        $requestMock = new Request();\n\n        $this->metadataMock->expects($this->once())->method('getHumanizedName')->willReturn('product');\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $requestMock)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::DELETE)->willReturn('sylius.product.delete');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.delete')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn(null);\n\n        $this->expectException(NotFoundHttpException::class);\n        $this->expectExceptionMessage('The \"product\" has not been found');\n\n        $this->resourceController->deleteAction($requestMock);\n    }\n\n    public function testDeletesAResourceAndRedirectsToIndexByForHtmlRequest(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var CsrfTokenManagerInterface|MockObject $csrfTokenManagerMock */\n        $csrfTokenManagerMock = $this->createMock(CsrfTokenManagerInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var ResourceControllerEvent|MockObject $postEventMock */\n        $postEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $redirectResponseMock */\n        $redirectResponseMock = $this->createMock(Response::class);\n\n        $request = new Request(request: ['_csrf_token' => 'xyz']);\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::DELETE)->willReturn('sylius.product.delete');\n        $configurationMock->method('isHtmlRequest')->willReturn(true);\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(true);\n\n        $this->containerMock->expects($this->once())->method('has')->with('security.csrf.token_manager')->willReturn(true);\n        $this->containerMock->expects($this->once())->method('get')->with('security.csrf.token_manager')->willReturn($csrfTokenManagerMock);\n\n        $csrfTokenManagerMock->expects($this->once())->method('isTokenValid')->with(new CsrfToken('1', 'xyz'))->willReturn(true);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.delete')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n\n        $resourceMock->expects($this->once())->method('getId')->willReturn(1);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::DELETE, $configurationMock, $resourceMock)->willReturn($eventMock);\n\n        $eventMock->method('isStopped')->willReturn(false);\n\n        $this->resourceDeleteHandlerMock->expects($this->once())->method('handle')->with($resourceMock, $this->repositoryMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPostEvent')->with(ResourceActions::DELETE, $configurationMock, $resourceMock)->willReturn($postEventMock);\n\n        $postEventMock->expects($this->once())->method('getResponse')->willReturn(null);\n\n        $this->flashHelperMock->expects($this->once())->method('addSuccessFlash')->with($configurationMock, ResourceActions::DELETE, $resourceMock);\n        $this->redirectHandlerMock->expects($this->once())->method('redirectToIndex')->with($configurationMock, $resourceMock)->willReturn($redirectResponseMock);\n\n        $this->assertSame($redirectResponseMock, $this->resourceController->deleteAction($request));\n    }\n\n    public function testUsesResponseFromPostDeleteEventIfDefined(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var CsrfTokenManagerInterface|MockObject $csrfTokenManagerMock */\n        $csrfTokenManagerMock = $this->createMock(CsrfTokenManagerInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var ResourceControllerEvent|MockObject $postEventMock */\n        $postEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $redirectResponseMock */\n        $redirectResponseMock = $this->createMock(Response::class);\n\n        $request = new Request(request: ['_csrf_token' => 'xyz']);\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::DELETE)->willReturn('sylius.product.delete');\n\n        $this->containerMock->expects($this->once())->method('has')->with('security.csrf.token_manager')->willReturn(true);\n        $this->containerMock->expects($this->once())->method('get')->with('security.csrf.token_manager')->willReturn($csrfTokenManagerMock);\n\n        $csrfTokenManagerMock->expects($this->once())->method('isTokenValid')->with(new CsrfToken('1', 'xyz'))->willReturn(true);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.delete')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n\n        $resourceMock->expects($this->once())->method('getId')->willReturn(1);\n\n        $configurationMock->method('isHtmlRequest')->willReturn(true);\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(true);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::DELETE, $configurationMock, $resourceMock)->willReturn($eventMock);\n        $eventMock->method('isStopped')->willReturn(false);\n\n        $this->resourceDeleteHandlerMock->expects($this->once())->method('handle')->with($resourceMock, $this->repositoryMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPostEvent')->with(ResourceActions::DELETE, $configurationMock, $resourceMock)->willReturn($postEventMock);\n        $this->flashHelperMock->expects($this->once())->method('addSuccessFlash')->with($configurationMock, ResourceActions::DELETE, $resourceMock);\n\n        $postEventMock->expects($this->once())->method('getResponse')->willReturn($redirectResponseMock);\n\n        $this->assertSame($redirectResponseMock, $this->resourceController->deleteAction($request));\n    }\n\n    public function testDoesNotDeleteAResourceAndRedirectsToIndexForHtmlRequestsStoppedViaEvent(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var CsrfTokenManagerInterface|MockObject $csrfTokenManagerMock */\n        $csrfTokenManagerMock = $this->createMock(CsrfTokenManagerInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $redirectResponseMock */\n        $redirectResponseMock = $this->createMock(Response::class);\n\n        $request = new Request(request: ['_csrf_token' => 'xyz']);\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::DELETE)->willReturn('sylius.product.delete');\n\n        $this->containerMock->expects($this->once())->method('has')->with('security.csrf.token_manager')->willReturn(true);\n        $this->containerMock->expects($this->once())->method('get')->with('security.csrf.token_manager')->willReturn($csrfTokenManagerMock);\n\n        $csrfTokenManagerMock->expects($this->once())->method('isTokenValid')->with(new CsrfToken('1', 'xyz'))->willReturn(true);\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.delete')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n\n        $resourceMock->expects($this->once())->method('getId')->willReturn(1);\n\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(true);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::DELETE, $configurationMock, $resourceMock)->willReturn($eventMock);\n        $eventMock->method('isStopped')->willReturn(true);\n        $eventMock->expects($this->once())->method('getResponse')->willReturn(null);\n\n        $this->resourceDeleteHandlerMock->expects($this->never())->method('handle')->with($resourceMock, $this->repositoryMock);\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPostEvent')->with(ResourceActions::DELETE, $configurationMock, $resourceMock);\n        $this->flashHelperMock->expects($this->never())->method('addSuccessFlash')->with($configurationMock, ResourceActions::DELETE, $resourceMock);\n        $this->flashHelperMock->expects($this->once())->method('addFlashFromEvent')->with($configurationMock, $eventMock);\n        $this->redirectHandlerMock->expects($this->once())->method('redirectToIndex')->with($configurationMock, $resourceMock)->willReturn($redirectResponseMock);\n\n        $this->assertSame($redirectResponseMock, $this->resourceController->deleteAction($request));\n    }\n\n    public function testDoesNotDeleteAResourceAndUsesResponseFromEventIfDefined(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var CsrfTokenManagerInterface|MockObject $csrfTokenManagerMock */\n        $csrfTokenManagerMock = $this->createMock(CsrfTokenManagerInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $redirectResponseMock */\n        $redirectResponseMock = $this->createMock(Response::class);\n\n        $request = new Request(request: ['_csrf_token' => 'xyz']);\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::DELETE)->willReturn('sylius.product.delete');\n\n        $this->containerMock->expects($this->once())->method('has')->with('security.csrf.token_manager')->willReturn(true);\n        $this->containerMock->expects($this->once())->method('get')->with('security.csrf.token_manager')->willReturn($csrfTokenManagerMock);\n\n        $csrfTokenManagerMock->expects($this->once())->method('isTokenValid')->with(new CsrfToken('1', 'xyz'))->willReturn(true);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.delete')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n\n        $resourceMock->expects($this->once())->method('getId')->willReturn(1);\n\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(true);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::DELETE, $configurationMock, $resourceMock)->willReturn($eventMock);\n        $eventMock->method('isStopped')->willReturn(true);\n        $eventMock->expects($this->once())->method('getResponse')->willReturn($redirectResponseMock);\n\n        $this->flashHelperMock->expects($this->once())->method('addFlashFromEvent')->with($configurationMock, $eventMock);\n        $this->resourceDeleteHandlerMock->expects($this->never())->method('handle')->with($resourceMock, $this->repositoryMock);\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPostEvent')->with(ResourceActions::DELETE, $configurationMock, $resourceMock);\n        $this->flashHelperMock->expects($this->never())->method('addSuccessFlash')->with($configurationMock, ResourceActions::DELETE, $resourceMock);\n        $this->redirectHandlerMock->expects($this->never())->method('redirectToIndex')->with($configurationMock, $resourceMock);\n\n        $this->assertSame($redirectResponseMock, $this->resourceController->deleteAction($request));\n    }\n\n    public function testDoesNotCorrectlyDeleteAResourceAndReturns500ForNotHtmlResponse(): void\n    {\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var CsrfTokenManagerInterface|MockObject $csrfTokenManagerMock */\n        $csrfTokenManagerMock = $this->createMock(CsrfTokenManagerInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n\n        $request = new Request(request: ['_csrf_token' => 'xyz']);\n\n        $this->requestConfigurationFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($this->metadataMock, $request)\n            ->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::DELETE)->willReturn('sylius.product.delete');\n\n        $this->containerMock->expects($this->once())->method('has')->with('security.csrf.token_manager')->willReturn(true);\n        $this->containerMock->expects($this->once())->method('get')->with('security.csrf.token_manager')->willReturn($csrfTokenManagerMock);\n\n        $csrfTokenManagerMock\n            ->expects($this->once())\n            ->method('isTokenValid')\n            ->with(new CsrfToken('1', 'xyz'))\n            ->willReturn(true);\n\n        $this->authorizationCheckerMock\n            ->expects($this->once())\n            ->method('isGranted')\n            ->with($configurationMock, 'sylius.product.delete')\n            ->willReturn(true);\n\n        $this->singleResourceProviderMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($configurationMock, $this->repositoryMock)\n            ->willReturn($resourceMock);\n\n        $resourceMock->expects($this->once())->method('getId')->willReturn(1);\n\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(false);\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(true);\n\n        $this->eventDispatcherMock\n            ->expects($this->once())\n            ->method('dispatchPreEvent')\n            ->with(ResourceActions::DELETE, $configurationMock, $resourceMock)\n            ->willReturn($eventMock);\n\n        $this->resourceDeleteHandlerMock\n            ->expects($this->once())\n            ->method('handle')\n            ->with($resourceMock, $this->repositoryMock)\n            ->willThrowException(new DeleteHandlingException());\n\n        $this->eventDispatcherMock\n            ->expects($this->never())\n            ->method('dispatchPostEvent');\n\n        $expectedView = View::create(null, 500);\n\n        $this->viewHandlerMock\n            ->expects($this->once())\n            ->method('handle')\n            ->with(\n                $this->anything(),\n                $this->callback(function ($view) use ($expectedView) {\n                    return $view instanceof View &&\n                        $view->getData() === $expectedView->getData() &&\n                        $view->getStatusCode() === $expectedView->getStatusCode();\n                }),\n            )\n            ->willReturn($responseMock);\n\n        $this->assertSame($responseMock, $this->resourceController->deleteAction($request));\n    }\n\n    public function testDeletesAResourceAndReturns204ForNonHtmlRequests(): void\n    {\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var CsrfTokenManagerInterface|MockObject $csrfTokenManagerMock */\n        $csrfTokenManagerMock = $this->createMock(CsrfTokenManagerInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n\n        $request = new Request(request: ['_csrf_token' => 'xyz']);\n\n        $this->requestConfigurationFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($this->metadataMock, $request)\n            ->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::DELETE)->willReturn('sylius.product.delete');\n\n        $this->containerMock->expects($this->once())->method('has')->with('security.csrf.token_manager')->willReturn(true);\n        $this->containerMock->expects($this->once())->method('get')->with('security.csrf.token_manager')->willReturn($csrfTokenManagerMock);\n\n        $csrfTokenManagerMock\n            ->expects($this->once())\n            ->method('isTokenValid')\n            ->with(new CsrfToken('1', 'xyz'))\n            ->willReturn(true);\n\n        $this->authorizationCheckerMock\n            ->expects($this->once())\n            ->method('isGranted')\n            ->with($configurationMock, 'sylius.product.delete')\n            ->willReturn(true);\n\n        $this->singleResourceProviderMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($configurationMock, $this->repositoryMock)\n            ->willReturn($resourceMock);\n\n        $resourceMock->expects($this->once())->method('getId')->willReturn(1);\n\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(true);\n\n        $this->eventDispatcherMock\n            ->expects($this->once())\n            ->method('dispatchPreEvent')\n            ->with(ResourceActions::DELETE, $configurationMock, $resourceMock)\n            ->willReturn($eventMock);\n\n        $this->resourceDeleteHandlerMock\n            ->expects($this->once())\n            ->method('handle')\n            ->with($resourceMock, $this->repositoryMock);\n\n        $this->eventDispatcherMock\n            ->expects($this->once())\n            ->method('dispatchPostEvent')\n            ->with(ResourceActions::DELETE, $configurationMock, $resourceMock);\n\n        $expectedView = View::create(null, 204);\n\n        $this->viewHandlerMock\n            ->expects($this->once())\n            ->method('handle')\n            ->with(\n                $this->anything(),\n                $this->callback(function ($view) use ($expectedView) {\n                    return $view instanceof View &&\n                        $view->getData() === $expectedView->getData() &&\n                        $view->getStatusCode() === $expectedView->getStatusCode();\n                }),\n            )\n            ->willReturn($responseMock);\n\n        $this->assertSame($responseMock, $this->resourceController->deleteAction($request));\n    }\n\n    public function testDoesNotDeleteAResourceAndThrowsHttpExceptionForNonHtmlRequestsStoppedViaEvent(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var CsrfTokenManagerInterface|MockObject $csrfTokenManagerMock */\n        $csrfTokenManagerMock = $this->createMock(CsrfTokenManagerInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n\n        $request = new Request(request: ['_csrf_token' => 'xyz']);\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::DELETE)->willReturn('sylius.product.delete');\n\n        $this->containerMock->expects($this->once())->method('has')->with('security.csrf.token_manager')->willReturn(true);\n        $this->containerMock->expects($this->once())->method('get')->with('security.csrf.token_manager')->willReturn($csrfTokenManagerMock);\n\n        $csrfTokenManagerMock->expects($this->once())->method('isTokenValid')->with(new CsrfToken('1', 'xyz'))->willReturn(true);\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.delete')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n\n        $resourceMock->expects($this->once())->method('getId')->willReturn(1);\n\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(false);\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(true);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::DELETE, $configurationMock, $resourceMock)->willReturn($eventMock);\n\n        $eventMock->expects($this->once())->method('isStopped')->willReturn(true);\n        $eventMock->expects($this->once())->method('getMessage')->willReturn('Cannot delete this product.');\n        $eventMock->expects($this->once())->method('getErrorCode')->willReturn(500);\n\n        $this->resourceDeleteHandlerMock->expects($this->never())->method('handle')->with($resourceMock, $this->repositoryMock);\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPostEvent');\n        $this->flashHelperMock->expects($this->never())->method('addSuccessFlash');\n        $this->flashHelperMock->expects($this->never())->method('addFlashFromEvent');\n\n        $this->expectException(HttpException::class);\n\n        $this->resourceController->deleteAction($request);\n    }\n\n    public function testThrowsA403ExceptionIfCsrfTokenIsInvalidDuringDeleteAction(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var CsrfTokenManagerInterface|MockObject $csrfTokenManagerMock */\n        $csrfTokenManagerMock = $this->createMock(CsrfTokenManagerInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n\n        $request = new Request(request: ['_csrf_token' => 'xyz']);\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::DELETE)->willReturn('sylius.product.delete');\n\n        $this->containerMock->expects($this->once())->method('has')->with('security.csrf.token_manager')->willReturn(true);\n        $this->containerMock->expects($this->once())->method('get')->with('security.csrf.token_manager')->willReturn($csrfTokenManagerMock);\n\n        $csrfTokenManagerMock->expects($this->once())->method('isTokenValid')->with(new CsrfToken('1', 'xyz'))->willReturn(false);\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.delete')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n\n        $resourceMock->expects($this->once())->method('getId')->willReturn(1);\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(true);\n        $eventMock->expects($this->never())->method('isStopped');\n\n        $this->resourceDeleteHandlerMock->expects($this->never())->method('handle')->with($resourceMock, $this->repositoryMock);\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPostEvent');\n        $this->flashHelperMock->expects($this->never())->method('addSuccessFlash');\n        $this->flashHelperMock->expects($this->never())->method('addFlashFromEvent');\n\n        $this->expectException(HttpException::class);\n\n        $this->resourceController->deleteAction($request);\n    }\n\n    public function testThrowsA403ExceptionIfUserIsUnauthorizedToApplyStateMachineTransitionOnResource(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n\n        $request = new Request();\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(false);\n\n        $this->expectException(AccessDeniedException::class);\n\n        $this->resourceController->applyStateMachineTransitionAction($request);\n    }\n\n    public function testThrowsA404ExceptionIfResourceIsNotFoundWhenTryingToApplyStateMachineTransition(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n\n        $request = new Request();\n\n        $this->metadataMock->expects($this->once())->method('getHumanizedName')->willReturn('product');\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn(null);\n\n        $this->expectException(NotFoundHttpException::class);\n        $this->expectExceptionMessage('The \"product\" has not been found');\n\n        $this->resourceController->applyStateMachineTransitionAction($request);\n    }\n\n    public function testDoesNotApplyStateMachineTransitionOnResourceIfNotApplicableAndReturns400BadRequest(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ObjectManager|MockObject $objectManagerMock */\n        $objectManagerMock = $this->createMock(ObjectManager::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var CsrfTokenManagerInterface|MockObject $csrfTokenManagerMock */\n        $csrfTokenManagerMock = $this->createMock(CsrfTokenManagerInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n\n        $request = new Request(request: ['_csrf_token' => 'xyz']);\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(true);\n\n        $resourceMock->expects($this->once())->method('getId')->willReturn('1');\n\n        $this->containerMock->expects($this->once())->method('has')->with('security.csrf.token_manager')->willReturn(true);\n        $this->containerMock->expects($this->once())->method('get')->with('security.csrf.token_manager')->willReturn($csrfTokenManagerMock);\n\n        $csrfTokenManagerMock->expects($this->once())->method('isTokenValid')->with(new CsrfToken('1', 'xyz'))->willReturn(true);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($eventMock);\n        $eventMock->method('isStopped')->willReturn(false);\n\n        $this->stateMachineMock->expects($this->once())->method('can')->with($configurationMock, $resourceMock)->willReturn(false);\n        $this->stateMachineMock->expects($this->never())->method('apply')->with($configurationMock, $resourceMock);\n\n        $objectManagerMock->expects($this->never())->method('flush');\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPostEvent');\n\n        $this->flashHelperMock->expects($this->never())->method('addSuccessFlash');\n        $this->flashHelperMock->expects($this->never())->method('addFlashFromEvent');\n\n        $this->expectException(BadRequestHttpException::class);\n        $this->resourceController->applyStateMachineTransitionAction($request);\n    }\n\n    public function testAppliesStateMachineTransitionToResourceAndRedirectsForHtmlRequest(): void\n    {\n        /** @var CsrfTokenManagerInterface|MockObject $csrfTokenManagerMock */\n        $csrfTokenManagerMock = $this->createMock(CsrfTokenManagerInterface::class);\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var ResourceControllerEvent|MockObject $postEventMock */\n        $postEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $redirectResponseMock */\n        $redirectResponseMock = $this->createMock(Response::class);\n\n        $request = new Request(request: ['_csrf_token' => 'xyz']);\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(true);\n\n        $this->containerMock->expects($this->once())->method('has')->with('security.csrf.token_manager')->willReturn(true);\n        $this->containerMock->expects($this->once())->method('get')->with('security.csrf.token_manager')->willReturn($csrfTokenManagerMock);\n\n        $csrfTokenManagerMock->expects($this->once())->method('isTokenValid')->with(new CsrfToken('1', 'xyz'))->willReturn(true);\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n\n        $resourceMock->expects($this->once())->method('getId')->willReturn('1');\n        $configurationMock->method('isHtmlRequest')->willReturn(true);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($eventMock);\n\n        $eventMock->method('isStopped')->willReturn(false);\n\n        $this->stateMachineMock->expects($this->once())->method('can')->with($configurationMock, $resourceMock)->willReturn(true);\n        $this->resourceUpdateHandlerMock->expects($this->once())->method('handle')->with($resourceMock, $configurationMock, $this->managerMock);\n        $this->flashHelperMock->expects($this->once())->method('addSuccessFlash')->with($configurationMock, ResourceActions::UPDATE, $resourceMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPostEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($postEventMock);\n\n        $postEventMock->expects($this->once())->method('getResponse')->willReturn(null);\n\n        $this->redirectHandlerMock->expects($this->once())->method('redirectToResource')->with($configurationMock, $resourceMock)->willReturn($redirectResponseMock);\n\n        $this->assertSame($redirectResponseMock, $this->resourceController->applyStateMachineTransitionAction($request));\n    }\n\n    public function testUsesResponseFromPostApplyStateMachineTransitionEventIfDefined(): void\n    {\n        /** @var CsrfTokenManagerInterface|MockObject $csrfTokenManagerMock */\n        $csrfTokenManagerMock = $this->createMock(CsrfTokenManagerInterface::class);\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var ResourceControllerEvent|MockObject $postEventMock */\n        $postEventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $redirectResponseMock */\n        $redirectResponseMock = $this->createMock(Response::class);\n\n        $request = new Request(request: ['_csrf_token' => 'xyz']);\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(true);\n\n        $this->containerMock->expects($this->once())->method('has')->with('security.csrf.token_manager')->willReturn(true);\n        $this->containerMock->expects($this->once())->method('get')->with('security.csrf.token_manager')->willReturn($csrfTokenManagerMock);\n\n        $csrfTokenManagerMock->expects($this->once())->method('isTokenValid')->with(new CsrfToken('1', 'xyz'))->willReturn(true);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n\n        $resourceMock->expects($this->once())->method('getId')->willReturn('1');\n        $configurationMock->method('isHtmlRequest')->willReturn(true);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($eventMock);\n        $eventMock->method('isStopped')->willReturn(false);\n\n        $this->stateMachineMock->expects($this->once())->method('can')->with($configurationMock, $resourceMock)->willReturn(true);\n        $this->resourceUpdateHandlerMock->expects($this->once())->method('handle')->with($resourceMock, $configurationMock, $this->managerMock);\n        $this->flashHelperMock->expects($this->once())->method('addSuccessFlash')->with($configurationMock, ResourceActions::UPDATE, $resourceMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPostEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($postEventMock);\n\n        $postEventMock->expects($this->once())->method('getResponse')->willReturn($redirectResponseMock);\n\n        $this->assertSame($redirectResponseMock, $this->resourceController->applyStateMachineTransitionAction($request));\n    }\n\n    public function testDoesNotApplyStateMachineTransitionOnResourceAndRedirectsForHtmlRequestsStoppedViaEvent(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var CsrfTokenManagerInterface|MockObject $csrfTokenManagerMock */\n        $csrfTokenManagerMock = $this->createMock(CsrfTokenManagerInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $redirectResponseMock */\n        $redirectResponseMock = $this->createMock(Response::class);\n\n        $request = new Request(request: ['_csrf_token' => 'xyz']);\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(true);\n\n        $this->containerMock->expects($this->once())->method('has')->with('security.csrf.token_manager')->willReturn(true);\n        $this->containerMock->expects($this->once())->method('get')->with('security.csrf.token_manager')->willReturn($csrfTokenManagerMock);\n\n        $csrfTokenManagerMock->expects($this->once())->method('isTokenValid')->with(new CsrfToken('1', 'xyz'))->willReturn(true);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n\n        $resourceMock->expects($this->once())->method('getId')->willReturn('1');\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($eventMock);\n        $eventMock->method('isStopped')->willReturn(true);\n\n        $this->managerMock->expects($this->never())->method('flush');\n        $this->stateMachineMock->expects($this->never())->method('apply')->with($resourceMock);\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPostEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock);\n        $this->flashHelperMock->expects($this->never())->method('addSuccessFlash')->with($configurationMock, ResourceActions::UPDATE, $resourceMock);\n\n        $eventMock->expects($this->once())->method('getResponse')->willReturn(null);\n\n        $this->flashHelperMock->expects($this->once())->method('addFlashFromEvent')->with($configurationMock, $eventMock);\n        $this->redirectHandlerMock->expects($this->once())->method('redirectToResource')->with($configurationMock, $resourceMock)->willReturn($redirectResponseMock);\n\n        $this->assertSame($redirectResponseMock, $this->resourceController->applyStateMachineTransitionAction($request));\n    }\n\n    public function testDoesNotApplyStateMachineTransitionOnResourceAndReturnEventResponseForHtmlRequestsStoppedViaEvent(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var CsrfTokenManagerInterface|MockObject $csrfTokenManagerMock */\n        $csrfTokenManagerMock = $this->createMock(CsrfTokenManagerInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n\n        $request = new Request(request: ['_csrf_token' => 'xyz']);\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(true);\n\n        $this->containerMock->expects($this->once())->method('has')->with('security.csrf.token_manager')->willReturn(true);\n        $this->containerMock->expects($this->once())->method('get')->with('security.csrf.token_manager')->willReturn($csrfTokenManagerMock);\n\n        $csrfTokenManagerMock->expects($this->once())->method('isTokenValid')->with(new CsrfToken('1', 'xyz'))->willReturn(true);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n\n        $resourceMock->expects($this->once())->method('getId')->willReturn('1');\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($eventMock);\n        $eventMock->method('isStopped')->willReturn(true);\n\n        $this->managerMock->expects($this->never())->method('flush');\n        $this->stateMachineMock->expects($this->never())->method('apply')->with($resourceMock);\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPostEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock);\n        $this->flashHelperMock->expects($this->never())->method('addSuccessFlash')->with($configurationMock, ResourceActions::UPDATE, $resourceMock);\n        $this->flashHelperMock->expects($this->once())->method('addFlashFromEvent')->with($configurationMock, $eventMock);\n\n        $eventMock->expects($this->once())->method('getResponse')->willReturn($responseMock);\n\n        $this->assertSame($responseMock, $this->resourceController->applyStateMachineTransitionAction($request));\n    }\n\n    public function testAppliesStateMachineTransitionOnResourceAndReturns200ForNonHtmlRequests(): void\n    {\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n\n        /** @var ParameterBagInterface|MockObject $parameterBagMock */\n        $parameterBagMock = $this->createMock(ParameterBagInterface::class);\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n\n        $this->requestConfigurationFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($this->metadataMock, $request)\n            ->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('getParameters')->willReturn($parameterBagMock);\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(false);\n        $parameterBagMock->expects($this->once())->method('get')->with('return_content', true)->willReturn(true);\n\n        $this->authorizationCheckerMock\n            ->expects($this->once())\n            ->method('isGranted')\n            ->with($configurationMock, 'sylius.product.update')\n            ->willReturn(true);\n\n        $this->singleResourceProviderMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($configurationMock, $this->repositoryMock)\n            ->willReturn($resourceMock);\n\n        $this->eventDispatcherMock\n            ->expects($this->once())\n            ->method('dispatchPreEvent')\n            ->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)\n            ->willReturn($eventMock);\n\n        $eventMock->method('isStopped')->willReturn(false);\n\n        $this->stateMachineMock\n            ->expects($this->once())\n            ->method('can')\n            ->with($configurationMock, $resourceMock)\n            ->willReturn(true);\n\n        $this->resourceUpdateHandlerMock\n            ->expects($this->once())\n            ->method('handle')\n            ->with($resourceMock, $configurationMock, $this->managerMock);\n\n        $this->eventDispatcherMock\n            ->expects($this->once())\n            ->method('dispatchPostEvent')\n            ->with(ResourceActions::UPDATE, $configurationMock, $resourceMock);\n\n        $expectedView = View::create($resourceMock, 200);\n\n        $this->viewHandlerMock\n            ->expects($this->once())\n            ->method('handle')\n            ->with(\n                $this->anything(),\n                $this->callback(function ($view) use ($expectedView) {\n                    return $view instanceof View &&\n                        $view->getData() === $expectedView->getData() &&\n                        $view->getStatusCode() === $expectedView->getStatusCode();\n                }),\n            )\n            ->willReturn($responseMock);\n\n        $this->assertSame($responseMock, $this->resourceController->applyStateMachineTransitionAction($request));\n    }\n\n    public function testAppliesStateMachineTransitionOnResourceAndReturns204ForNonHtmlRequestsIfAdditionalOptionAdded(): void\n    {\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n\n        /** @var ParameterBagInterface|MockObject $parameterBagMock */\n        $parameterBagMock = $this->createMock(ParameterBagInterface::class);\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n\n        $request = new Request();\n\n        $this->requestConfigurationFactoryMock\n            ->expects($this->once())\n            ->method('create')\n            ->with($this->metadataMock, $request)\n            ->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('getParameters')->willReturn($parameterBagMock);\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(false);\n        $parameterBagMock->expects($this->once())->method('get')->with('return_content', true)->willReturn(false);\n\n        $this->authorizationCheckerMock\n            ->expects($this->once())\n            ->method('isGranted')\n            ->with($configurationMock, 'sylius.product.update')\n            ->willReturn(true);\n\n        $this->singleResourceProviderMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($configurationMock, $this->repositoryMock)\n            ->willReturn($resourceMock);\n\n        $configurationMock->method('isHtmlRequest')->willReturn(false);\n\n        $this->eventDispatcherMock\n            ->expects($this->once())\n            ->method('dispatchPreEvent')\n            ->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)\n            ->willReturn($eventMock);\n\n        $eventMock->method('isStopped')->willReturn(false);\n\n        $this->stateMachineMock\n            ->expects($this->once())\n            ->method('can')\n            ->with($configurationMock, $resourceMock)\n            ->willReturn(true);\n\n        $this->resourceUpdateHandlerMock\n            ->expects($this->once())\n            ->method('handle')\n            ->with($resourceMock, $configurationMock, $this->managerMock);\n\n        $this->eventDispatcherMock\n            ->expects($this->once())\n            ->method('dispatchPostEvent')\n            ->with(ResourceActions::UPDATE, $configurationMock, $resourceMock);\n\n        $expectedView = View::create(null, 204);\n\n        $this->viewHandlerMock\n            ->expects($this->once())\n            ->method('handle')\n            ->with(\n                $this->anything(),\n                $this->callback(function ($view) use ($expectedView) {\n                    return $view instanceof View &&\n                        $view->getData() === $expectedView->getData() &&\n                        $view->getStatusCode() === $expectedView->getStatusCode();\n                }),\n            )\n            ->willReturn($responseMock);\n\n        $this->assertSame($responseMock, $this->resourceController->applyStateMachineTransitionAction($request));\n    }\n\n    public function testDoesNotApplyStateMachineTransitionResourceAndThrowsHttpExceptionForNonHtmlRequestsStoppedViaEvent(): void\n    {\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ObjectManager|MockObject $objectManagerMock */\n        $objectManagerMock = $this->createMock(ObjectManager::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceControllerEvent|MockObject $eventMock */\n        $eventMock = $this->createMock(ResourceControllerEvent::class);\n\n        $request = new Request();\n\n        $this->requestConfigurationFactoryMock->expects($this->once())->method('create')->with($this->metadataMock, $request)->willReturn($configurationMock);\n\n        $configurationMock->expects($this->once())->method('hasPermission')->willReturn(true);\n        $configurationMock->expects($this->once())->method('getPermission')->with(ResourceActions::UPDATE)->willReturn('sylius.product.update');\n        $configurationMock->expects($this->once())->method('isCsrfProtectionEnabled')->willReturn(false);\n        $configurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(false);\n\n        $this->authorizationCheckerMock->expects($this->once())->method('isGranted')->with($configurationMock, 'sylius.product.update')->willReturn(true);\n        $this->singleResourceProviderMock->expects($this->once())->method('get')->with($configurationMock, $this->repositoryMock)->willReturn($resourceMock);\n        $this->eventDispatcherMock->expects($this->once())->method('dispatchPreEvent')->with(ResourceActions::UPDATE, $configurationMock, $resourceMock)->willReturn($eventMock);\n\n        $eventMock->expects($this->once())->method('isStopped')->willReturn(true);\n        $eventMock->expects($this->once())->method('getMessage')->willReturn('Cannot approve this product.');\n        $eventMock->expects($this->once())->method('getErrorCode')->willReturn(500);\n\n        $this->stateMachineMock->expects($this->never())->method('apply')->with($configurationMock, $resourceMock);\n\n        $objectManagerMock->expects($this->never())->method('flush');\n\n        $this->eventDispatcherMock->expects($this->never())->method('dispatchPostEvent');\n        $this->flashHelperMock->expects($this->never())->method('addSuccessFlash');\n        $this->flashHelperMock->expects($this->never())->method('addFlashFromEvent');\n\n        $this->expectException(HttpException::class);\n\n        $this->resourceController->applyStateMachineTransitionAction($request);\n    }\n\n    private function markAsSkippedIfFosRestBundleIsNotAvailable(): void\n    {\n        if (!class_exists(FOSRestBundle::class)) {\n            $this->markTestSkipped('FriendsOfSymfony Rest Bundle is not installed.');\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/ResourceDeleteHandlerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceDeleteHandler;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceDeleteHandlerInterface;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\nfinal class ResourceDeleteHandlerTest extends TestCase\n{\n    private ResourceDeleteHandler $resourceDeleteHandler;\n\n    protected function setUp(): void\n    {\n        $this->resourceDeleteHandler = new ResourceDeleteHandler();\n    }\n\n    public function testImplementsAResourceDeleteHandlerInterface(): void\n    {\n        $this->assertInstanceOf(ResourceDeleteHandlerInterface::class, $this->resourceDeleteHandler);\n    }\n\n    public function testRemovesResourceViaRepository(): void\n    {\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        $repositoryMock->expects($this->once())->method('remove')->with($resourceMock);\n        $this->resourceDeleteHandler->handle($resourceMock, $repositoryMock);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/ResourceFormFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceFormFactory;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceFormFactoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\Form\\FormFactoryInterface;\nuse Symfony\\Component\\Form\\FormInterface;\n\nfinal class ResourceFormFactoryTest extends TestCase\n{\n    /** @var FormFactoryInterface|MockObject */\n    private MockObject $formFactoryMock;\n\n    private ResourceFormFactory $resourceFormFactory;\n\n    protected function setUp(): void\n    {\n        $this->formFactoryMock = $this->createMock(FormFactoryInterface::class);\n        $this->resourceFormFactory = new ResourceFormFactory($this->formFactoryMock);\n    }\n\n    public function testImplementsResourceFormFactoryInterface(): void\n    {\n        $this->assertInstanceOf(ResourceFormFactoryInterface::class, $this->resourceFormFactory);\n    }\n\n    public function testCreatesAppropriateFormBasedOnConfiguration(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var FormInterface|MockObject $formMock */\n        $formMock = $this->createMock(FormInterface::class);\n        $requestConfigurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n        $requestConfigurationMock->expects($this->once())->method('getFormType')->willReturn('sylius_product_pricing');\n        $requestConfigurationMock->expects($this->once())->method('getFormOptions')->willReturn([]);\n        $this->formFactoryMock->expects($this->once())->method('create')->with('sylius_product_pricing', $resourceMock, $this->isType('array'))->willReturn($formMock);\n        $this->assertSame($formMock, $this->resourceFormFactory->create($requestConfigurationMock, $resourceMock));\n    }\n\n    public function testCreatesFormWithoutRootNameAndDisablesCsrfProtectionForNonHtmlRequests(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var FormInterface|MockObject $formMock */\n        $formMock = $this->createMock(FormInterface::class);\n        $requestConfigurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(false);\n        $requestConfigurationMock->expects($this->once())->method('getFormType')->willReturn('sylius_product_api');\n        $requestConfigurationMock->expects($this->once())->method('getFormOptions')->willReturn([]);\n        $this->formFactoryMock->expects($this->once())->method('createNamed')->with('', 'sylius_product_api', $resourceMock, ['csrf_protection' => false])->willReturn($formMock);\n        $this->assertSame($formMock, $this->resourceFormFactory->create($requestConfigurationMock, $resourceMock));\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/ResourceUpdateHandlerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse Doctrine\\Persistence\\ObjectManager;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceUpdateHandler;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceUpdateHandlerInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\StateMachineInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\nfinal class ResourceUpdateHandlerTest extends TestCase\n{\n    /** @var StateMachineInterface|MockObject */\n    private MockObject $stateMachineMock;\n\n    private ResourceUpdateHandler $resourceUpdateHandler;\n\n    protected function setUp(): void\n    {\n        $this->stateMachineMock = $this->createMock(StateMachineInterface::class);\n        $this->resourceUpdateHandler = new ResourceUpdateHandler($this->stateMachineMock);\n    }\n\n    public function testImplementsAResourceUpdateHandlerInterface(): void\n    {\n        $this->assertInstanceOf(ResourceUpdateHandlerInterface::class, $this->resourceUpdateHandler);\n    }\n\n    public function testAppliesAStateMachineTransition(): void\n    {\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ObjectManager|MockObject $managerMock */\n        $managerMock = $this->createMock(ObjectManager::class);\n        $configurationMock->expects($this->once())->method('hasStateMachine')->willReturn(true);\n        $this->stateMachineMock->expects($this->once())->method('apply')->with($configurationMock, $resourceMock);\n        $managerMock->expects($this->once())->method('flush');\n        $this->resourceUpdateHandler->handle($resourceMock, $configurationMock, $managerMock);\n    }\n\n    public function testDoesNotApplyAStateMachineTransition(): void\n    {\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        /** @var RequestConfiguration|MockObject $configurationMock */\n        $configurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var ObjectManager|MockObject $managerMock */\n        $managerMock = $this->createMock(ObjectManager::class);\n        $configurationMock->expects($this->once())->method('hasStateMachine')->willReturn(false);\n        $this->stateMachineMock->expects($this->never())->method('apply')->with($configurationMock, $resourceMock);\n        $managerMock->expects($this->once())->method('flush');\n        $this->resourceUpdateHandler->handle($resourceMock, $configurationMock, $managerMock);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/ResourcesCollectionProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse Hateoas\\Representation\\Factory\\PagerfantaFactory;\nuse Hateoas\\Representation\\PaginatedRepresentation;\nuse Pagerfanta\\Adapter\\ArrayAdapter;\nuse Pagerfanta\\Pagerfanta;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\Parameters;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourcesCollectionProvider;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourcesCollectionProviderInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourcesResolver;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourcesResolverInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridView;\nuse Sylius\\Component\\Grid\\Definition\\Grid;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\HttpFoundation\\InputBag;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class ResourcesCollectionProviderTest extends TestCase\n{\n    /** @var ResourcesResolverInterface|MockObject */\n    private MockObject $resourcesResolverMock;\n\n    private ResourcesCollectionProvider $resourcesCollectionProvider;\n\n    protected function setUp(): void\n    {\n        $this->resourcesResolverMock = $this->createMock(ResourcesResolverInterface::class);\n        $this->resourcesCollectionProvider = new ResourcesCollectionProvider($this->resourcesResolverMock, null);\n    }\n\n    public function testImplementsResourcesCollectionProviderInterface(): void\n    {\n        $this->assertInstanceOf(ResourcesCollectionProviderInterface::class, $this->resourcesCollectionProvider);\n    }\n\n    public function testReturnsResourcesResolvedFromRepository(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var ResourceInterface|MockObject $firstResourceMock */\n        $firstResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceInterface|MockObject $secondResourceMock */\n        $secondResourceMock = $this->createMock(ResourceInterface::class);\n        $this->resourcesResolverMock->expects($this->once())->method('getResources')->with($requestConfigurationMock, $repositoryMock)->willReturn([$firstResourceMock, $secondResourceMock]);\n        $this->assertSame([$firstResourceMock, $secondResourceMock], $this->resourcesCollectionProvider->get($requestConfigurationMock, $repositoryMock));\n    }\n\n    public function testHandlesPagerfanta(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var \\Pagerfanta\\Pagerfanta|MockObject $paginatorMock */\n        $paginatorMock = $this->createMock(Pagerfanta::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        $queryParameters = new InputBag();\n        $queryParameters->set('limit', 5);\n        $queryParameters->set('page', 6);\n        $requestConfigurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n        $requestConfigurationMock->expects($this->once())->method('getPaginationMaxPerPage')->willReturn(5);\n        $this->resourcesResolverMock->expects($this->once())->method('getResources')->with($requestConfigurationMock, $repositoryMock)->willReturn($paginatorMock);\n        $requestConfigurationMock->expects($this->once())->method('getRequest')->willReturn($requestMock);\n        $requestMock->query = $queryParameters;\n        $this->assertEquals(5, $requestMock->query->get('limit'));\n        $this->assertEquals(6, $requestMock->query->get('page'));\n        $paginatorMock->expects($this->once())->method('setMaxPerPage')->with(5);\n        $paginatorMock->expects($this->once())->method('setCurrentPage')->with(6);\n        $paginatorMock->expects($this->once())->method('getCurrentPageResults')->willReturn([]);\n        $this->assertSame($paginatorMock, $this->resourcesCollectionProvider->get($requestConfigurationMock, $repositoryMock));\n    }\n\n    public function testRestrictsMaxPaginationLimitBasedOnGridConfiguration(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var ResourceGridView|MockObject $gridViewMock */\n        $gridViewMock = $this->createMock(ResourceGridView::class);\n        /** @var Grid|MockObject $gridMock */\n        $gridMock = $this->createMock(Grid::class);\n        /** @var \\Pagerfanta\\Pagerfanta|MockObject $paginatorMock */\n        $paginatorMock = $this->createMock(Pagerfanta::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        $queryParameters = new InputBag();\n        $queryParameters->set('limit', 1000);\n        $queryParameters->set('page', 1);\n        $requestConfigurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n        $requestConfigurationMock->expects($this->once())->method('getPaginationMaxPerPage')->willReturn(1000);\n        $gridMock->expects($this->once())->method('getLimits')->willReturn([10, 20, 99]);\n        $gridViewMock->expects($this->once())->method('getDefinition')->willReturn($gridMock);\n        $gridViewMock->expects($this->once())->method('getData')->willReturn($paginatorMock);\n        $this->resourcesResolverMock->expects($this->once())->method('getResources')->with($requestConfigurationMock, $repositoryMock)->willReturn($gridViewMock);\n        $requestConfigurationMock->expects($this->once())->method('getRequest')->willReturn($requestMock);\n        $requestMock->query = $queryParameters;\n        $this->assertEquals(1000, $requestMock->query->get('limit'));\n        $this->assertEquals(1, $requestMock->query->get('page'));\n        $paginatorMock->expects($this->once())->method('setMaxPerPage')->with(99);\n        $paginatorMock->expects($this->once())->method('setCurrentPage')->with(1);\n        $paginatorMock->expects($this->once())->method('getCurrentPageResults')->willReturn([]);\n        $this->assertSame($gridViewMock, $this->resourcesCollectionProvider->get($requestConfigurationMock, $repositoryMock));\n    }\n\n    public function testCreatesAPaginatedRepresentationForPagerfantaForNonHtmlRequests(): void\n    {\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var MetadataInterface|MockObject $metadataMock */\n        $metadataMock = $this->createMock(MetadataInterface::class);\n        if (!class_exists(PagerfantaFactory::class)) {\n            $this->markTestSkipped('PagerfantaFactory is not installed.');\n        }\n        $this->resourcesCollectionProvider = new ResourcesCollectionProvider(new ResourcesResolver(), new PagerfantaFactory());\n        $paginator = new Pagerfanta(new ArrayAdapter([]));\n        $repositoryMock->expects($this->once())->method('createPaginator')->with([], [])->willReturn($paginator);\n        $request = new Request();\n        $request->query = new InputBag(['limit' => 8, 'page' => 1]);\n        $request->attributes = new ParameterBag(['_format' => 'json', '_route' => 'sylius_product_index', '_route_params' => ['slug' => 'foo-bar']]);\n        $requestConfiguration = new RequestConfiguration($metadataMock, $request, new Parameters(['paginate' => true]));\n        $this->assertInstanceOf(PaginatedRepresentation::class, $this->resourcesCollectionProvider->get($requestConfiguration, $repositoryMock));\n    }\n\n    public function testHandlesResourceGridView(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var ResourceGridView|MockObject $resourceGridViewMock */\n        $resourceGridViewMock = $this->createMock(ResourceGridView::class);\n        /** @var Grid|MockObject $gridMock */\n        $gridMock = $this->createMock(Grid::class);\n        /** @var \\Pagerfanta\\Pagerfanta|MockObject $paginatorMock */\n        $paginatorMock = $this->createMock(Pagerfanta::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        $queryParameters = new InputBag();\n        $queryParameters->set('limit', 5);\n        $queryParameters->set('page', 6);\n        $requestConfigurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n        $requestConfigurationMock->expects($this->once())->method('getPaginationMaxPerPage')->willReturn(5);\n        $this->resourcesResolverMock->expects($this->once())->method('getResources')->with($requestConfigurationMock, $repositoryMock)->willReturn($resourceGridViewMock);\n        $resourceGridViewMock->expects($this->once())->method('getData')->willReturn($paginatorMock);\n        $gridMock->expects($this->once())->method('getLimits')->willReturn([10, 25, 50]);\n        $resourceGridViewMock->expects($this->once())->method('getDefinition')->willReturn($gridMock);\n        $requestConfigurationMock->expects($this->once())->method('getRequest')->willReturn($requestMock);\n        $requestMock->query = $queryParameters;\n        $this->assertEquals(5, $requestMock->query->get('limit'));\n        $this->assertEquals(6, $requestMock->query->get('page'));\n        $paginatorMock->expects($this->once())->method('setMaxPerPage')->with(5);\n        $paginatorMock->expects($this->once())->method('setCurrentPage')->with(6);\n        $paginatorMock->expects($this->once())->method('getCurrentPageResults')->willReturn([]);\n        $this->assertSame($resourceGridViewMock, $this->resourcesCollectionProvider->get($requestConfigurationMock, $repositoryMock));\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/ResourcesResolverTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse Pagerfanta\\Pagerfanta;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourcesResolver;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourcesResolverInterface;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\nfinal class ResourcesResolverTest extends TestCase\n{\n    private ResourcesResolver $resourcesResolver;\n\n    protected function setUp(): void\n    {\n        $this->resourcesResolver = new ResourcesResolver();\n    }\n\n    public function testImplementsResourcesResolverInterface(): void\n    {\n        $this->assertInstanceOf(ResourcesResolverInterface::class, $this->resourcesResolver);\n    }\n\n    public function testGetsAllResourcesIfHasNoCriteria(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var ResourceInterface|MockObject $firstResourceMock */\n        $firstResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceInterface|MockObject $secondResourceMock */\n        $secondResourceMock = $this->createMock(ResourceInterface::class);\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryMethod')->willReturn(null);\n        $requestConfigurationMock->expects($this->once())->method('isPaginated')->willReturn(false);\n        $requestConfigurationMock->expects($this->once())->method('isFilterable')->willReturn(false);\n        $requestConfigurationMock->expects($this->once())->method('isSortable')->willReturn(false);\n        $requestConfigurationMock->expects($this->once())->method('getLimit')->willReturn(null);\n        $repositoryMock->expects($this->once())->method('findBy')->with([], [], null)->willReturn([$firstResourceMock, $secondResourceMock]);\n        $this->assertSame([$firstResourceMock, $secondResourceMock], $this->resourcesResolver->getResources($requestConfigurationMock, $repositoryMock));\n    }\n\n    public function testFindsResourcesByCriteriaIfNotPaginated(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var ResourceInterface|MockObject $firstResourceMock */\n        $firstResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceInterface|MockObject $secondResourceMock */\n        $secondResourceMock = $this->createMock(ResourceInterface::class);\n        /** @var ResourceInterface|MockObject $thirdResourceMock */\n        $thirdResourceMock = $this->createMock(ResourceInterface::class);\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryMethod')->willReturn(null);\n        $requestConfigurationMock->expects($this->once())->method('isPaginated')->willReturn(false);\n        $requestConfigurationMock->expects($this->once())->method('isFilterable')->willReturn(true);\n        $requestConfigurationMock->expects($this->once())->method('isSortable')->willReturn(true);\n        $requestConfigurationMock->expects($this->once())->method('getLimit')->willReturn(15);\n        $requestConfigurationMock->expects($this->once())->method('getCriteria')->willReturn(['custom' => 'criteria']);\n        $requestConfigurationMock->expects($this->once())->method('getSorting')->willReturn(['name' => 'desc']);\n        $repositoryMock->expects($this->once())->method('findBy')->with(['custom' => 'criteria'], ['name' => 'desc'], 15)->willReturn([$firstResourceMock, $secondResourceMock, $thirdResourceMock]);\n        $this->assertSame([$firstResourceMock, $secondResourceMock, $thirdResourceMock], $this->resourcesResolver->getResources($requestConfigurationMock, $repositoryMock));\n    }\n\n    public function testUsesCustomMethodAndArgumentsIfSpecified(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var ResourceInterface|MockObject $firstResourceMock */\n        $firstResourceMock = $this->createMock(ResourceInterface::class);\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryMethod')->willReturn('findAll');\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryArguments')->willReturn(['foo']);\n        $repositoryMock->expects($this->once())->method('findAll')->with('foo')->willReturn([$firstResourceMock]);\n        $this->assertSame([$firstResourceMock], $this->resourcesResolver->getResources($requestConfigurationMock, $repositoryMock));\n    }\n\n    public function testUsesCustomRepositoryIfSpecified(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var RepositoryInterface|MockObject $customRepositoryMock */\n        $customRepositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var ResourceInterface|MockObject $firstResourceMock */\n        $firstResourceMock = $this->createMock(ResourceInterface::class);\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryMethod')->willReturn([$customRepositoryMock, 'findBy']);\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryArguments')->willReturn([['foo' => true]]);\n        $customRepositoryMock->expects($this->once())->method('findBy')->with(['foo' => true])->willReturn([$firstResourceMock]);\n        $this->assertSame([$firstResourceMock], $this->resourcesResolver->getResources($requestConfigurationMock, $repositoryMock));\n    }\n\n    public function testCreatesPaginatorByDefault(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var \\Pagerfanta\\Pagerfanta|MockObject $paginatorMock */\n        $paginatorMock = $this->createMock(Pagerfanta::class);\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryMethod')->willReturn(null);\n        $requestConfigurationMock->expects($this->once())->method('isPaginated')->willReturn(true);\n        $requestConfigurationMock->expects($this->once())->method('isFilterable')->willReturn(false);\n        $requestConfigurationMock->expects($this->once())->method('isSortable')->willReturn(false);\n        $repositoryMock->expects($this->once())->method('createPaginator')->with([], [])->willReturn($paginatorMock);\n        $this->assertSame($paginatorMock, $this->resourcesResolver->getResources($requestConfigurationMock, $repositoryMock));\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/SingleResourceProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\SingleResourceProvider;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\SingleResourceProviderInterface;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\HttpFoundation\\ParameterBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class SingleResourceProviderTest extends TestCase\n{\n    private SingleResourceProvider $singleResourceProvider;\n\n    protected function setUp(): void\n    {\n        $this->singleResourceProvider = new SingleResourceProvider();\n    }\n\n    public function testImplementsSingleResourceProviderInterface(): void\n    {\n        $this->assertInstanceOf(SingleResourceProviderInterface::class, $this->singleResourceProvider);\n    }\n\n    public function testLooksForSpecificResourceWithIdByDefault(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var ParameterBag|MockObject $requestAttributesMock */\n        $requestAttributesMock = $this->createMock(ParameterBag::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryMethod')->willReturn(null);\n        $requestConfigurationMock->expects($this->once())->method('getRequest')->willReturn($requestMock);\n        $requestMock->attributes = $requestAttributesMock;\n        $requestAttributesMock->method('has')->with('id')->willReturn(true);\n        $requestAttributesMock->expects($this->once())->method('get')->with('id')->willReturn(5);\n        $repositoryMock->expects($this->once())->method('find')->with(5)->willReturn(null);\n        $this->assertNull($this->singleResourceProvider->get($requestConfigurationMock, $repositoryMock));\n    }\n\n    public function testCanFindSpecificResourceWithIdByDefault(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var ParameterBag|MockObject $requestAttributesMock */\n        $requestAttributesMock = $this->createMock(ParameterBag::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryMethod')->willReturn(null);\n        $requestConfigurationMock->expects($this->once())->method('getRequest')->willReturn($requestMock);\n        $requestMock->attributes = $requestAttributesMock;\n        $requestAttributesMock->method('has')->with('id')->willReturn(true);\n        $requestAttributesMock->expects($this->once())->method('get')->with('id')->willReturn(3);\n        $repositoryMock->expects($this->once())->method('find')->with(3)->willReturn($resourceMock);\n        $this->assertSame($resourceMock, $this->singleResourceProvider->get($requestConfigurationMock, $repositoryMock));\n    }\n\n    public function testCanFindSpecificResourceWithSlugByDefault(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var ParameterBag|MockObject $requestAttributesMock */\n        $requestAttributesMock = $this->createMock(ParameterBag::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        $requestConfigurationMock->expects($this->once())->method('getCriteria')->willReturn([]);\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryMethod')->willReturn(null);\n        $requestConfigurationMock->expects($this->once())->method('getRequest')->willReturn($requestMock);\n        $requestMock->attributes = $requestAttributesMock;\n        $requestAttributesMock->expects($this->exactly(2))->method('has')->willReturnMap([['id', false], ['slug', true]]);\n        $requestAttributesMock->expects($this->once())->method('get')->with('slug')->willReturn('the-most-awesome-hat');\n        $repositoryMock->expects($this->once())->method('findOneBy')->with(['slug' => 'the-most-awesome-hat'])->willReturn($resourceMock);\n        $this->assertSame($resourceMock, $this->singleResourceProvider->get($requestConfigurationMock, $repositoryMock));\n    }\n\n    public function testCanFindSpecificResourceWithCustomCriteria(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var ParameterBag|MockObject $requestAttributesMock */\n        $requestAttributesMock = $this->createMock(ParameterBag::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        $requestConfigurationMock->expects($this->once())->method('getCriteria')->willReturn(['request-configuration-criteria' => '1']);\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryMethod')->willReturn(null);\n        $requestConfigurationMock->expects($this->once())->method('getRequest')->willReturn($requestMock);\n        $requestMock->attributes = $requestAttributesMock;\n        $requestAttributesMock->expects($this->exactly(2))->method('has')->willReturnMap([['id', false], ['slug', false]]);\n        $repositoryMock->expects($this->once())->method('findOneBy')->with(['request-configuration-criteria' => '1'])->willReturn($resourceMock);\n        $this->assertSame($resourceMock, $this->singleResourceProvider->get($requestConfigurationMock, $repositoryMock));\n    }\n\n    public function testCanFindSpecificResourceWithMergedCustomCriteria(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var ParameterBag|MockObject $requestAttributesMock */\n        $requestAttributesMock = $this->createMock(ParameterBag::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        $requestConfigurationMock->expects($this->once())->method('getCriteria')->willReturn(['request-configuration-criteria' => '1']);\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryMethod')->willReturn(null);\n        $requestConfigurationMock->expects($this->once())->method('getRequest')->willReturn($requestMock);\n        $requestMock->attributes = $requestAttributesMock;\n        $requestAttributesMock->expects($this->exactly(2))->method('has')->willReturnMap([['id', false], ['slug', true]]);\n        $requestAttributesMock->expects($this->once())->method('get')->with('slug')->willReturn('banana');\n        $repositoryMock->expects($this->once())->method('findOneBy')->with(['slug' => 'banana', 'request-configuration-criteria' => '1'])->willReturn($resourceMock);\n        $this->assertSame($resourceMock, $this->singleResourceProvider->get($requestConfigurationMock, $repositoryMock));\n    }\n\n    public function testCanFindSpecificResourceWithMergedCustomCriteriaOverwritingTheAttributes(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var Request|MockObject $requestMock */\n        $requestMock = $this->createMock(Request::class);\n        /** @var ParameterBag|MockObject $requestAttributesMock */\n        $requestAttributesMock = $this->createMock(ParameterBag::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        $requestConfigurationMock->expects($this->once())->method('getCriteria')->willReturn(['id' => 5]);\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryMethod')->willReturn(null);\n        $requestConfigurationMock->expects($this->once())->method('getRequest')->willReturn($requestMock);\n        $requestMock->attributes = $requestAttributesMock;\n        $requestAttributesMock->expects($this->exactly(2))->method('has')->willReturnMap([['id', false], ['slug', false]]);\n        $repositoryMock->expects($this->once())->method('findOneBy')->with(['id' => 5])->willReturn($resourceMock);\n        $this->assertSame($resourceMock, $this->singleResourceProvider->get($requestConfigurationMock, $repositoryMock));\n    }\n\n    public function testUsesACustomMethodIfConfigured(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryMethod')->willReturn('find');\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryArguments')->willReturn(['foo']);\n        $repositoryMock->expects($this->once())->method('find')->with('foo')->willReturn($resourceMock);\n        $this->assertSame($resourceMock, $this->singleResourceProvider->get($requestConfigurationMock, $repositoryMock));\n    }\n\n    public function testUsesACustomRepositoryIfConfigured(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var RepositoryInterface|MockObject $repositoryMock */\n        $repositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var RepositoryInterface|MockObject $customRepositoryMock */\n        $customRepositoryMock = $this->createMock(RepositoryInterface::class);\n        /** @var ResourceInterface|MockObject $resourceMock */\n        $resourceMock = $this->createMock(ResourceInterface::class);\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryMethod')->willReturn([$customRepositoryMock, 'find']);\n        $requestConfigurationMock->expects($this->once())->method('getRepositoryArguments')->willReturn(['foo']);\n        $customRepositoryMock->expects($this->once())->method('find')->with('foo')->willReturn($resourceMock);\n        $this->assertSame($resourceMock, $this->singleResourceProvider->get($requestConfigurationMock, $repositoryMock));\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/StateMachineTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse SM\\Factory\\FactoryInterface;\nuse SM\\StateMachine\\StateMachineInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\StateMachine;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\StateMachineInterface as ResourceStateMachineInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse winzou\\Bundle\\StateMachineBundle\\winzouStateMachineBundle;\n\nfinal class StateMachineTest extends TestCase\n{\n    private MockObject $stateMachineFactoryMock;\n\n    private StateMachine $stateMachine;\n\n    protected function setUp(): void\n    {\n        $this->markAsSkippedIfWinzouStateMachineIsNotAvailable();\n\n        $this->stateMachineFactoryMock = $this->createMock(FactoryInterface::class);\n        $this->stateMachine = new StateMachine($this->stateMachineFactoryMock);\n    }\n\n    public function testImplementsStateMachineInterface(): void\n    {\n        $this->assertInstanceOf(ResourceStateMachineInterface::class, $this->stateMachine);\n    }\n\n    public function testThrowsAnExceptionIfTransitionIsNotDefinedDuringCan(): void\n    {\n        $requestConfiguration = $this->createRequestConfigurationWithoutStateMachine();\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage('State machine must be configured to apply transition, check your routing.');\n\n        $this->stateMachine->can($requestConfiguration, $resource);\n    }\n\n    public function testThrowsAnExceptionIfTransitionIsNotDefinedDuringApply(): void\n    {\n        $requestConfiguration = $this->createRequestConfigurationWithoutStateMachine();\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage('State machine must be configured to apply transition, check your routing.');\n\n        $this->stateMachine->apply($requestConfiguration, $resource);\n    }\n\n    public function testReturnsIfConfiguredStateMachineCanTransition(): void\n    {\n        $requestConfiguration = $this->createRequestConfiguration('sylius_product_review_state', 'reject');\n        $resource = $this->createMock(ResourceInterface::class);\n        $stateMachineMock = $this->createStateMachineMock();\n\n        $this->stateMachineFactoryMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($resource, 'sylius_product_review_state')\n            ->willReturn($stateMachineMock);\n\n        $stateMachineMock\n            ->expects($this->once())\n            ->method('can')\n            ->with('reject')\n            ->willReturn(true);\n\n        $this->assertTrue($this->stateMachine->can($requestConfiguration, $resource));\n    }\n\n    public function testAppliesConfiguredStateMachineTransitionWithoutGraphConfiguration(): void\n    {\n        $requestConfiguration = $this->createRequestConfiguration(null, 'reject');\n        $resource = $this->createMock(ResourceInterface::class);\n        $stateMachineMock = $this->createStateMachineMock();\n\n        $this->stateMachineFactoryMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($resource, 'default')\n            ->willReturn($stateMachineMock);\n\n        $stateMachineMock\n            ->expects($this->once())\n            ->method('apply')\n            ->with('reject');\n\n        $this->stateMachine->apply($requestConfiguration, $resource);\n    }\n\n    public function testAppliesConfiguredStateMachineTransitionWithGraphConfiguration(): void\n    {\n        $requestConfiguration = $this->createRequestConfiguration('sylius_product_review_state', 'reject');\n        $resource = $this->createMock(ResourceInterface::class);\n        $stateMachineMock = $this->createStateMachineMock();\n\n        $this->stateMachineFactoryMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($resource, 'sylius_product_review_state')\n            ->willReturn($stateMachineMock);\n\n        $stateMachineMock\n            ->expects($this->once())\n            ->method('apply')\n            ->with('reject');\n\n        $this->stateMachine->apply($requestConfiguration, $resource);\n    }\n\n    /**\n     * @return MockObject&RequestConfiguration\n     */\n    private function createRequestConfigurationWithoutStateMachine(): MockObject\n    {\n        /** @var MockObject&RequestConfiguration $requestConfiguration */\n        $requestConfiguration = $this->createMock(RequestConfiguration::class);\n        $requestConfiguration->method('hasStateMachine')->willReturn(false);\n\n        return $requestConfiguration;\n    }\n\n    /**\n     * @return MockObject&RequestConfiguration\n     */\n    private function createRequestConfiguration(?string $graph, string $transition): MockObject\n    {\n        /** @var MockObject&RequestConfiguration $requestConfiguration */\n        $requestConfiguration = $this->createMock(RequestConfiguration::class);\n        $requestConfiguration->method('hasStateMachine')->willReturn(true);\n        $requestConfiguration->method('getStateMachineGraph')->willReturn($graph);\n        $requestConfiguration->method('getStateMachineTransition')->willReturn($transition);\n\n        return $requestConfiguration;\n    }\n\n    /**\n     * @return MockObject&StateMachineInterface\n     */\n    private function createStateMachineMock(): MockObject\n    {\n        /** @var MockObject&StateMachineInterface $stateMachine */\n        $stateMachine = $this->createMock(StateMachineInterface::class);\n\n        return $stateMachine;\n    }\n\n    private function markAsSkippedIfWinzouStateMachineIsNotAvailable(): void\n    {\n        if (!class_exists(winzouStateMachineBundle::class)) {\n            $this->markTestSkipped('Winzou State machine is not available.');\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/ViewHandlerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse FOS\\RestBundle\\Context\\Context;\nuse FOS\\RestBundle\\FOSRestBundle;\nuse FOS\\RestBundle\\View\\ConfigurableViewHandlerInterface;\nuse FOS\\RestBundle\\View\\View;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ViewHandler;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ViewHandlerInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nfinal class ViewHandlerTest extends TestCase\n{\n    /** @var ConfigurableViewHandlerInterface|MockObject */\n    private MockObject $restViewHandlerMock;\n\n    private ViewHandler $viewHandler;\n\n    protected function setUp(): void\n    {\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n\n        $this->restViewHandlerMock = $this->createMock(ConfigurableViewHandlerInterface::class);\n        $this->viewHandler = new ViewHandler($this->restViewHandlerMock);\n    }\n\n    public function testImplementsViewHandlerInterface(): void\n    {\n        $this->assertInstanceOf(ViewHandlerInterface::class, $this->viewHandler);\n    }\n\n    public function testHandlesViewNormallyForHtmlRequests(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n        $requestConfigurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(true);\n        $view = View::create();\n        $this->restViewHandlerMock->expects($this->once())->method('handle')->with($view)->willReturn($responseMock);\n        $this->assertSame($responseMock, $this->viewHandler->handle($requestConfigurationMock, $view));\n    }\n\n    public function testSetsProperValuesForNonHtmlRequests(): void\n    {\n        /** @var RequestConfiguration|MockObject $requestConfigurationMock */\n        $requestConfigurationMock = $this->createMock(RequestConfiguration::class);\n        /** @var Response|MockObject $responseMock */\n        $responseMock = $this->createMock(Response::class);\n        $requestConfigurationMock->expects($this->once())->method('isHtmlRequest')->willReturn(false);\n        $view = View::create();\n        $view->setContext(new Context());\n        $requestConfigurationMock->expects($this->once())->method('getSerializationGroups')->willReturn(['Detailed']);\n        $requestConfigurationMock->expects($this->once())->method('getSerializationVersion')->willReturn('2.0.0');\n        $this->restViewHandlerMock->expects($this->once())->method('setExclusionStrategyGroups')->with(['Detailed']);\n        $this->restViewHandlerMock->expects($this->once())->method('setExclusionStrategyVersion')->with('2.0.0');\n        $this->restViewHandlerMock->expects($this->once())->method('handle')->with($view)->willReturn($responseMock);\n        $this->assertSame($responseMock, $this->viewHandler->handle($requestConfigurationMock, $view));\n    }\n\n    private function markAsSkippedIfFosRestBundleIsNotAvailable(): void\n    {\n        if (!class_exists(FOSRestBundle::class)) {\n            $this->markTestSkipped('FriendsOfSymfony Rest Bundle is not installed.');\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Controller/WorkflowTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Controller;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\StateMachineInterface as ResourceStateMachineInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\Workflow;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\Workflow\\Marking;\nuse Symfony\\Component\\Workflow\\Registry;\nuse Symfony\\Component\\Workflow\\Workflow as SymfonyWorkflow;\n\nfinal class WorkflowTest extends TestCase\n{\n    private MockObject $registryMock;\n\n    private Workflow $workflow;\n\n    protected function setUp(): void\n    {\n        $this->markAsSkippedIfSymfonyWorkflowIsNotAvailable();\n\n        $this->registryMock = $this->createMock(Registry::class);\n        $this->workflow = new Workflow($this->registryMock);\n    }\n\n    public function testImplementsStateMachineInterface(): void\n    {\n        $this->assertInstanceOf(ResourceStateMachineInterface::class, $this->workflow);\n    }\n\n    public function testThrowsAnExceptionIfTransitionIsNotDefinedDuringCan(): void\n    {\n        $requestConfiguration = $this->createRequestConfigurationWithoutStateMachine();\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage('State machine must be configured to apply transition, check your routing.');\n\n        $this->workflow->can($requestConfiguration, $resource);\n    }\n\n    public function testThrowsAnExceptionIfTransitionIsNotDefinedDuringApply(): void\n    {\n        $requestConfiguration = $this->createRequestConfigurationWithoutStateMachine();\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage('State machine must be configured to apply transition, check your routing.');\n\n        $this->workflow->apply($requestConfiguration, $resource);\n    }\n\n    public function testReturnsIfConfiguredStateMachineCanTransitionWithoutGraphConfiguration(): void\n    {\n        $requestConfiguration = $this->createRequestConfiguration(null, 'reject');\n        $resource = $this->createMock(ResourceInterface::class);\n        $workflowMock = $this->createWorkflowMock();\n\n        $this->registryMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($resource, null)\n            ->willReturn($workflowMock);\n\n        $workflowMock\n            ->expects($this->once())\n            ->method('can')\n            ->with($resource, 'reject')\n            ->willReturn(true);\n\n        $this->assertTrue($this->workflow->can($requestConfiguration, $resource));\n    }\n\n    public function testReturnsIfConfiguredStateMachineCanTransitionWithGraphConfiguration(): void\n    {\n        $requestConfiguration = $this->createRequestConfiguration('pull_request', 'reject');\n        $resource = $this->createMock(ResourceInterface::class);\n        $workflowMock = $this->createWorkflowMock();\n\n        $this->registryMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($resource, 'pull_request')\n            ->willReturn($workflowMock);\n\n        $workflowMock\n            ->expects($this->once())\n            ->method('can')\n            ->with($resource, 'reject')\n            ->willReturn(true);\n\n        $this->assertTrue($this->workflow->can($requestConfiguration, $resource));\n    }\n\n    public function testAppliesConfiguredStateMachineTransitionWithoutGraphConfiguration(): void\n    {\n        $requestConfiguration = $this->createRequestConfiguration(null, 'reject');\n        $resource = $this->createMock(ResourceInterface::class);\n        $workflowMock = $this->createWorkflowMock();\n        $marking = $this->createMock(Marking::class);\n\n        $this->registryMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($resource, null)\n            ->willReturn($workflowMock);\n\n        $workflowMock\n            ->expects($this->once())\n            ->method('apply')\n            ->with($resource, 'reject')\n            ->willReturn($marking);\n\n        $this->workflow->apply($requestConfiguration, $resource);\n    }\n\n    public function testAppliesConfiguredStateMachineTransitionWithGraphConfiguration(): void\n    {\n        $requestConfiguration = $this->createRequestConfiguration('pull_request', 'reject');\n        $resource = $this->createMock(ResourceInterface::class);\n        $workflowMock = $this->createWorkflowMock();\n        $marking = $this->createMock(Marking::class);\n\n        $this->registryMock\n            ->expects($this->once())\n            ->method('get')\n            ->with($resource, 'pull_request')\n            ->willReturn($workflowMock);\n\n        $workflowMock\n            ->expects($this->once())\n            ->method('apply')\n            ->with($resource, 'reject')\n            ->willReturn($marking);\n\n        $this->workflow->apply($requestConfiguration, $resource);\n    }\n\n    /**\n     * @return MockObject&RequestConfiguration\n     */\n    private function createRequestConfigurationWithoutStateMachine(): MockObject\n    {\n        /** @var MockObject&RequestConfiguration $requestConfiguration */\n        $requestConfiguration = $this->createMock(RequestConfiguration::class);\n        $requestConfiguration->method('hasStateMachine')->willReturn(false);\n\n        return $requestConfiguration;\n    }\n\n    /**\n     * @return MockObject&RequestConfiguration\n     */\n    private function createRequestConfiguration(?string $graph, string $transition): MockObject\n    {\n        /** @var MockObject&RequestConfiguration $requestConfiguration */\n        $requestConfiguration = $this->createMock(RequestConfiguration::class);\n        $requestConfiguration->method('hasStateMachine')->willReturn(true);\n        $requestConfiguration->method('getStateMachineGraph')->willReturn($graph);\n        $requestConfiguration->method('getStateMachineTransition')->willReturn($transition);\n\n        return $requestConfiguration;\n    }\n\n    /**\n     * @return MockObject&SymfonyWorkflow\n     */\n    private function createWorkflowMock(): MockObject\n    {\n        /** @var MockObject&SymfonyWorkflow $workflow */\n        $workflow = $this->createMock(SymfonyWorkflow::class);\n\n        return $workflow;\n    }\n\n    private function markAsSkippedIfSymfonyWorkflowIsNotAvailable(): void\n    {\n        if (!class_exists(Registry::class)) {\n            $this->markTestSkipped('Symfony Workflow is not available.');\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Compiler/DoctrineTargetEntitiesResolverPassTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Compiler;\n\nuse Matthias\\SymfonyDependencyInjectionTest\\PhpUnit\\AbstractCompilerPassTestCase;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\DoctrineTargetEntitiesResolverPass;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\Helper\\TargetEntitiesResolverInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Definition;\n\nfinal class DoctrineTargetEntitiesResolverPassTest extends AbstractCompilerPassTestCase\n{\n    /**\n     * @test\n     */\n    public function it_adds_method_call_to_resolve_doctrine_target_entities(): void\n    {\n        $this->setDefinition('doctrine.orm.listeners.resolve_target_entity', new Definition());\n\n        $this->setParameter(\n            'sylius.resources',\n            ['app.loremipsum' => ['classes' => ['model' => \\stdClass::class, 'interface' => \\Countable::class]]],\n        );\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'doctrine.orm.listeners.resolve_target_entity',\n            'addResolveTargetEntity',\n            [\\Countable::class, \\stdClass::class, []],\n        );\n    }\n\n    /**\n     * @test\n     */\n    public function it_adds_doctrine_event_listener_tag_to_target_entities_resolver_if_not_exists(): void\n    {\n        $this->setDefinition('doctrine.orm.listeners.resolve_target_entity', new Definition());\n        $this->setParameter('sylius.resources', []);\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasServiceDefinitionWithTag(\n            'doctrine.orm.listeners.resolve_target_entity',\n            'doctrine.event_listener',\n            ['event' => 'loadClassMetadata'],\n        );\n\n        $this->assertContainerBuilderHasServiceDefinitionWithTag(\n            'doctrine.orm.listeners.resolve_target_entity',\n            'doctrine.event_listener',\n            ['event' => 'onClassMetadataNotFound'],\n        );\n    }\n\n    protected function registerCompilerPass(ContainerBuilder $container): void\n    {\n        $targetEntitiesResolver = new class() implements TargetEntitiesResolverInterface {\n            public function resolve(array $resourcesConfiguration): array\n            {\n                if ($resourcesConfiguration === ['app.loremipsum' => ['classes' => ['model' => \\stdClass::class, 'interface' => \\Countable::class]]]) {\n                    return [\\Countable::class => \\stdClass::class];\n                }\n\n                return [];\n            }\n        };\n\n        $container->addCompilerPass(new DoctrineTargetEntitiesResolverPass($targetEntitiesResolver));\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Compiler/Helper/TargetEntitiesResolverTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Compiler\\Helper;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\Helper\\TargetEntitiesResolver;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\Helper\\TargetEntitiesResolverInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures\\AnimalInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures\\Bear;\nuse Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures\\BearInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures\\Fly;\nuse Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures\\FlyInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures\\MammalInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures\\Resource;\n\nfinal class TargetEntitiesResolverTest extends TestCase\n{\n    private TargetEntitiesResolverInterface $resolver;\n\n    protected function setUp(): void\n    {\n        $this->resolver = new TargetEntitiesResolver();\n    }\n\n    public function testItIsATargetEntitiesResolver(): void\n    {\n        $this->assertInstanceOf(TargetEntitiesResolverInterface::class, $this->resolver);\n    }\n\n    public function testItSkipsResourceInterface(): void\n    {\n        $emptyConfig = ['app.resource' => ['classes' => ['model' => Resource::class]]];\n\n        $this->assertSame([], $this->resolver->resolve($emptyConfig));\n    }\n\n    public function testItAutodiscoversInterfacesBasedOnTheModelClass(): void\n    {\n        $flyConfig = ['app.fly' => ['classes' => ['model' => Fly::class]]];\n\n        $resolved = $this->resolver->resolve($flyConfig);\n\n        $this->assertCount(2, $resolved);\n        $this->assertSame(Fly::class, $resolved[FlyInterface::class]);\n        $this->assertSame(Fly::class, $resolved[AnimalInterface::class]);\n\n        $bearConfig = ['app.bear' => ['classes' => ['model' => Bear::class]]];\n\n        $resolved = $this->resolver->resolve($bearConfig);\n\n        $this->assertCount(3, $resolved);\n        $this->assertSame(Bear::class, $resolved[BearInterface::class]);\n        $this->assertSame(Bear::class, $resolved[MammalInterface::class]);\n        $this->assertSame(Bear::class, $resolved[AnimalInterface::class]);\n    }\n\n    public function testItAutodiscoversOnlyUniqueInterfacesBasedOnModelClasses(): void\n    {\n        $config = [\n            'app.fly' => ['classes' => ['model' => Fly::class]],\n            'app.bear' => ['classes' => ['model' => Bear::class]],\n        ];\n\n        $resolved = $this->resolver->resolve($config);\n\n        $this->assertCount(3, $resolved);\n        $this->assertSame(Bear::class, $resolved[BearInterface::class]);\n        $this->assertSame(Bear::class, $resolved[MammalInterface::class]);\n        $this->assertSame(Fly::class, $resolved[FlyInterface::class]);\n\n        $this->assertArrayNotHasKey(AnimalInterface::class, $resolved);\n    }\n\n    public function testItAutodiscoversInterfacesOnModelsWhenPassedMultipleTimes(): void\n    {\n        $config = [\n            'app.fly' => ['classes' => ['model' => Fly::class]],\n            'app.another_resource_with_fly_model' => ['classes' => ['model' => Fly::class]],\n        ];\n\n        $resolved = $this->resolver->resolve($config);\n\n        $this->assertCount(2, $resolved);\n        $this->assertSame(Fly::class, $resolved[FlyInterface::class]);\n        $this->assertSame(Fly::class, $resolved[AnimalInterface::class]);\n    }\n\n    public function testItUsesTheInterfaceDefinedInTheConfig(): void\n    {\n        $config = [\n            'app.deprecated' => ['classes' => ['model' => Resource::class, 'interface' => \\Countable::class]],\n        ];\n\n        $resolved = @$this->resolver->resolve($config);\n\n        $this->assertCount(1, $resolved);\n        $this->assertSame(Resource::class, $resolved[\\Countable::class]);\n    }\n\n    public function testItUsesTheInterfaceDefinedExplicitlyOverTheAutodiscoveredOne(): void\n    {\n        $config = [\n            'app.deprecated' => ['classes' => ['model' => Resource::class, 'interface' => MammalInterface::class]],\n            'app.bear' => ['classes' => ['model' => Bear::class]],\n        ];\n\n        $resolved = @$this->resolver->resolve($config);\n\n        $this->assertCount(3, $resolved);\n        $this->assertSame(Resource::class, $resolved[MammalInterface::class]);\n        $this->assertSame(Bear::class, $resolved[AnimalInterface::class]);\n        $this->assertSame(Bear::class, $resolved[BearInterface::class]);\n    }\n\n    public function testItThrowsAnExceptionIfModelClassCannotBeResolved(): void\n    {\n        $config = ['app.error' => ['classes' => ['interface' => \\Countable::class]]];\n\n        $this->expectException(\\InvalidArgumentException::class);\n\n        $this->resolver->resolve($config);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Compiler/PagerfantaBridgePassTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Compiler;\n\nuse Matthias\\SymfonyDependencyInjectionTest\\PhpUnit\\AbstractCompilerPassTestCase;\nuse Pagerfanta\\Twig\\Extension\\PagerfantaExtension;\nuse Pagerfanta\\View\\ViewFactory;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\PagerfantaBridgePass;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\n\nfinal class PagerfantaBridgePassTest extends AbstractCompilerPassTestCase\n{\n    /**\n     * @test\n     */\n    public function it_creates_aliased_services_and_changes_the_view_factory_class(): void\n    {\n        $this->registerService('pagerfanta.twig_extension', PagerfantaExtension::class);\n        $this->registerService('pagerfanta.view_factory', ViewFactory::class);\n\n        $this->setParameter('white_october_pagerfanta.view_factory.class', 'My\\ViewFactory');\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasAlias('twig.extension.pagerfanta', 'pagerfanta.twig_extension');\n        $this->assertContainerBuilderHasAlias('white_october_pagerfanta.view_factory', 'pagerfanta.view_factory');\n        $this->assertContainerBuilderHasService('pagerfanta.view_factory', 'My\\ViewFactory');\n    }\n\n    protected function registerCompilerPass(ContainerBuilder $container): void\n    {\n        $container->addCompilerPass(new PagerfantaBridgePass());\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Compiler/RegisterFormBuilderPassTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Compiler;\n\nuse Matthias\\SymfonyDependencyInjectionTest\\PhpUnit\\AbstractCompilerPassTestCase;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\RegisterFormBuilderPass;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Definition;\nuse Symfony\\Component\\DependencyInjection\\Reference;\n\nfinal class RegisterFormBuilderPassTest extends AbstractCompilerPassTestCase\n{\n    /** @test */\n    public function it_registers_default_form_builder(): void\n    {\n        $this->setDefinition('sylius.registry.form_builder', new Definition());\n\n        $this->setDefinition(\n            'default_form_builder',\n            (new Definition())\n                ->addTag('sylius.default_resource_form.builder', ['type' => 'foo'])\n                ->addTag('sylius.default_resource_form.builder', ['type' => 'bar']),\n        );\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.registry.form_builder',\n            'register',\n            ['foo', new Reference('default_form_builder')],\n        );\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.registry.form_builder',\n            'register',\n            ['bar', new Reference('default_form_builder')],\n        );\n    }\n\n    protected function registerCompilerPass(ContainerBuilder $container): void\n    {\n        $container->addCompilerPass(new RegisterFormBuilderPass());\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Compiler/RegisterFqcnControllersPassTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Compiler;\n\nuse Matthias\\SymfonyDependencyInjectionTest\\PhpUnit\\AbstractCompilerPassTestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceController;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\RegisterFqcnControllersPass;\nuse Sylius\\Component\\Resource\\Model\\ResourceInterface as LegacyResourceInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Definition;\nuse Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException;\n\nfinal class RegisterFqcnControllersPassTest extends AbstractCompilerPassTestCase\n{\n    /** @test */\n    public function it_registers_alias_for_resource_controller_as_a_FQCN(): void\n    {\n        $this->setDefinition('sylius.resource_registry', new Definition());\n        $this->setDefinition('app.controller.book', new Definition());\n\n        $this->setParameter(\n            'sylius.resources',\n            [\n                'app.book' => [\n                    'driver' => 'doctrine/orm',\n                    'classes' => ['model' => BookTestClass::class, 'controller' => BookTestController::class],\n                ],\n            ],\n        );\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasService(BookTestController::class);\n    }\n\n    /** @test */\n    public function it_skips_the_alias_if_controller_class_is_not_defined(): void\n    {\n        $this->setDefinition('sylius.resource_registry', new Definition());\n        $this->setDefinition('app.controller.book', new Definition());\n\n        $this->setParameter(\n            'sylius.resources',\n            [\n                'app.book' => [\n                    'driver' => 'doctrine/orm',\n                    'classes' => ['model' => BookTestClass::class],\n                ],\n            ],\n        );\n\n        $this->compile();\n\n        $this->assertContainerBuilderNotHasService(BookTestController::class);\n    }\n\n    /** @test */\n    public function it_works_with_legacy_resource_interface(): void\n    {\n        $this->setDefinition('sylius.resource_registry', new Definition());\n        $this->setDefinition('app.controller.book', new Definition());\n\n        $this->setParameter(\n            'sylius.resources',\n            [\n                'app.book' => [\n                    'driver' => 'doctrine/orm',\n                    'classes' => ['model' => LegacyBookTestClass::class, 'controller' => BookTestController::class],\n                ],\n            ],\n        );\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasService(BookTestController::class);\n    }\n\n    /** @test */\n    public function it_throws_exception_if_class_does_not_implement_resource_interface(): void\n    {\n        $this->expectException(InvalidArgumentException::class);\n\n        $this->setParameter(\n            'sylius.resources',\n            [\n                'app.normalClass' => [\n                    'driver' => 'doctrine/orm',\n                    'classes' => ['model' => NormalClass::class, 'controller' => BookTestController::class],\n                ],\n            ],\n        );\n\n        $this->compile();\n    }\n\n    protected function registerCompilerPass(ContainerBuilder $container): void\n    {\n        $container->addCompilerPass(new RegisterFqcnControllersPass());\n    }\n}\n\nclass BookTestClass implements ResourceInterface\n{\n    public function getId()\n    {\n    }\n}\n\nclass NormalClass\n{\n}\n\nclass BookTestController extends ResourceController\n{\n}\n\nclass LegacyBookTestClass implements LegacyResourceInterface\n{\n    public function getId()\n    {\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Compiler/RegisterResourceRepositoryPassTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Compiler;\n\nuse Matthias\\SymfonyDependencyInjectionTest\\PhpUnit\\AbstractCompilerPassTestCase;\nuse Matthias\\SymfonyDependencyInjectionTest\\PhpUnit\\DefinitionHasMethodCallConstraint;\nuse PHPUnit\\Framework\\Constraint\\LogicalNot;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\RegisterResourceRepositoryPass;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Definition;\nuse Symfony\\Component\\DependencyInjection\\Reference;\n\nfinal class RegisterResourceRepositoryPassTest extends AbstractCompilerPassTestCase\n{\n    /**\n     * @test\n     */\n    public function it_adds_resource_repository_to_resource_repository_registry(): void\n    {\n        $this->setDefinition('sylius.registry.resource_repository', new Definition());\n        $this->setDefinition('sylius.repository.product', new Definition());\n\n        $this->setParameter(\n            'sylius.resources',\n            ['sylius.product' => []],\n        );\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.registry.resource_repository',\n            'register',\n            ['sylius.product', new Reference('sylius.repository.product')],\n        );\n    }\n\n    /**\n     * @test\n     *\n     * @doesNotPerformAssertions\n     */\n    public function it_does_not_add_resource_repository_to_resource_repository_registry_if_registry_does_not_exist(): void\n    {\n        $this->setDefinition('sylius.repository.product', new Definition());\n\n        $this->setParameter(\n            'sylius.resources',\n            ['sylius.product' => []],\n        );\n\n        $this->compile();\n    }\n\n    /**\n     * @test\n     */\n    public function it_does_not_add_resource_repository_to_resource_repository_registry_if_resources_do_not_exist(): void\n    {\n        $this->setDefinition('sylius.registry.resource_repository', new Definition());\n        $this->setDefinition('sylius.repository.product', new Definition());\n\n        $this->compile();\n\n        $this->assertContainerBuilderNotHasServiceDefinitionWithMethodCall(\n            'sylius.registry.resource_repository',\n            'register',\n            ['sylius.product', new Reference('sylius.repository.product')],\n        );\n    }\n\n    /**\n     * @test\n     */\n    public function it_does_not_add_resource_repository_to_resource_repository_registry_if_resource_repository_does_not_exist(): void\n    {\n        $this->setDefinition('sylius.registry.resource_repository', new Definition());\n\n        $this->setParameter(\n            'sylius.resources',\n            ['sylius.product' => []],\n        );\n\n        $this->compile();\n\n        $this->assertContainerBuilderNotHasServiceDefinitionWithMethodCall(\n            'sylius.registry.resource_repository',\n            'register',\n            ['sylius.product', new Reference('sylius.repository.product')],\n        );\n    }\n\n    protected function registerCompilerPass(ContainerBuilder $container): void\n    {\n        $container->addCompilerPass(new RegisterResourceRepositoryPass());\n    }\n\n    private function assertContainerBuilderNotHasServiceDefinitionWithMethodCall(\n        string $serviceId,\n        string $method,\n        array $arguments,\n    ): void {\n        $definition = $this->container->findDefinition($serviceId);\n\n        self::assertThat(\n            $definition,\n            new LogicalNot(new DefinitionHasMethodCallConstraint($method, $arguments)),\n        );\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Compiler/RegisterResourceStateMachinePassTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Compiler;\n\nuse Matthias\\SymfonyDependencyInjectionTest\\PhpUnit\\AbstractCompilerPassTestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\StateMachine;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\Workflow;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\RegisterResourceStateMachinePass;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Definition;\n\nfinal class RegisterResourceStateMachinePassTest extends AbstractCompilerPassTestCase\n{\n    /** @test */\n    public function it_registers_state_machine_components_for_resources(): void\n    {\n        $this->registerService('sylius.resource_controller.state_machine', StateMachine::class);\n        $this->makeSymfonyWorkflowAvailable();\n        $this->makeWinzouStateMachineAvailable();\n\n        $this->setDefinition('sylius.resource_registry', new Definition());\n\n        $this->setParameter(\n            'sylius.resources',\n            [\n                'app.book' => ['state_machine_component' => 'symfony', 'classes' => ['model' => BookClass::class]],\n                'app.author' => ['state_machine_component' => 'winzou', 'classes' => ['model' => AuthorClass::class]],\n                'app.pull_request' => ['classes' => ['model' => PullRequestClass::class]],\n            ],\n        );\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasAlias('app.controller_state_machine.book', 'sylius.resource_controller.state_machine.symfony');\n        $this->assertContainerBuilderHasAlias('app.controller_state_machine.author', 'sylius.resource_controller.state_machine.winzou');\n        $this->assertContainerBuilderHasAlias('app.controller_state_machine.pull_request', 'sylius.resource_controller.state_machine');\n    }\n\n    /** @test */\n    public function it_throws_an_exception_when_specific_symfony_state_machine_component_is_not_available(): void\n    {\n        $this->registerService('sylius.resource_controller.state_machine', StateMachine::class);\n        $this->makeWinzouStateMachineAvailable();\n\n        $this->setDefinition('sylius.resource_registry', new Definition());\n\n        $this->setParameter(\n            'sylius.resources',\n            [\n                'app.book' => ['state_machine_component' => 'symfony', 'classes' => ['model' => BookClass::class]],\n                'app.author' => ['state_machine_component' => 'winzou', 'classes' => ['model' => AuthorClass::class]],\n                'app.pull_request' => ['classes' => ['model' => PullRequestClass::class]],\n            ],\n        );\n\n        $error = false;\n\n        try {\n            $this->compile();\n        } catch (\\LogicException $exception) {\n            $error = true;\n            $message = $exception->getMessage();\n        }\n\n        $this->assertTrue($error, 'Should not compile');\n        $this->assertEquals('State machine \"symfony\" is not available.', $message);\n    }\n\n    /** @test */\n    public function it_throws_an_exception_when_specific_winzou_state_machine_component_is_not_available(): void\n    {\n        $this->registerService('sylius.resource_controller.state_machine', Workflow::class);\n        $this->makeSymfonyWorkflowAvailable();\n\n        $this->setDefinition('sylius.resource_registry', new Definition());\n\n        $this->setParameter(\n            'sylius.resources',\n            [\n                'app.book' => ['state_machine_component' => 'symfony', 'classes' => ['model' => BookClass::class]],\n                'app.author' => ['state_machine_component' => 'winzou', 'classes' => ['model' => AuthorClass::class]],\n                'app.pull_request' => ['classes' => ['model' => PullRequestClass::class]],\n            ],\n        );\n\n        $error = false;\n\n        try {\n            $this->compile();\n        } catch (\\LogicException $exception) {\n            $error = true;\n            $message = $exception->getMessage();\n        }\n\n        $this->assertTrue($error, 'Should not compile');\n        $this->assertEquals('State machine \"winzou\" is not available.', $message);\n    }\n\n    protected function registerCompilerPass(ContainerBuilder $container): void\n    {\n        $container->addCompilerPass(new RegisterResourceStateMachinePass());\n    }\n\n    private function makeWinzouStateMachineAvailable(): void\n    {\n        $this->registerService('sylius.resource_controller.state_machine.winzou', StateMachine::class);\n    }\n\n    private function makeSymfonyWorkflowAvailable(): void\n    {\n        $this->registerService('sylius.resource_controller.state_machine.symfony', Workflow::class);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Compiler/RegisterResourcesPassTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Compiler;\n\nuse Matthias\\SymfonyDependencyInjectionTest\\PhpUnit\\AbstractCompilerPassTestCase;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\RegisterResourcesPass;\nuse Sylius\\Component\\Resource\\Model\\ResourceInterface as LegacyResourceInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\Definition;\n\nclass RegisterResourcesPassTest extends AbstractCompilerPassTestCase\n{\n    /**\n     * @test\n     */\n    public function it_adds_method_call_to_resource_registry_if_resources_exist()\n    {\n        $this->setDefinition('sylius.resource_registry', new Definition());\n\n        $this->setParameter(\n            'sylius.resources',\n            [\n                'app.book' => ['classes' => ['model' => BookClass::class]],\n                'app.author' => ['classes' => ['model' => AuthorClass::class]],\n                'app.legacy_book' => ['classes' => ['model' => LegacyBookClass::class]],\n            ],\n        );\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.resource_registry',\n            'addFromAliasAndConfiguration',\n            ['app.book', ['classes' => ['model' => BookClass::class]]],\n        );\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.resource_registry',\n            'addFromAliasAndConfiguration',\n            ['app.author', ['classes' => ['model' => AuthorClass::class]]],\n        );\n\n        $this->assertContainerBuilderHasServiceDefinitionWithMethodCall(\n            'sylius.resource_registry',\n            'addFromAliasAndConfiguration',\n            ['app.legacy_book', ['classes' => ['model' => LegacyBookClass::class]]],\n        );\n    }\n\n    protected function registerCompilerPass(ContainerBuilder $container): void\n    {\n        $container->addCompilerPass(new RegisterResourcesPass());\n    }\n}\n\nclass AbstractResource implements ResourceInterface\n{\n    public function getId()\n    {\n        return;\n    }\n}\n\nclass BookClass extends AbstractResource\n{\n}\nclass AuthorClass extends AbstractResource\n{\n}\n\nclass PullRequestClass extends AbstractResource\n{\n}\n\nclass LegacyBookClass implements LegacyResourceInterface\n{\n    public function getId()\n    {\n        return;\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Compiler/RegisterStateMachinePassTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Compiler;\n\nuse Matthias\\SymfonyDependencyInjectionTest\\PhpUnit\\AbstractCompilerPassTestCase;\nuse SM\\Factory\\Factory;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\StateMachine;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\Workflow;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\RegisterStateMachinePass;\nuse Sylius\\Bundle\\ResourceBundle\\ResourceBundleInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\Workflow\\Workflow as SymfonyWorkflow;\nuse winzou\\Bundle\\StateMachineBundle\\winzouStateMachineBundle;\n\nfinal class RegisterStateMachinePassTest extends AbstractCompilerPassTestCase\n{\n    /** @test */\n    public function it_does_nothing_when_no_state_machine_are_available(): void\n    {\n        $this->setParameter('sylius.resource.settings', ['state_machine_component' => null]);\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasParameter('sylius.state_machine_component.default', null);\n        $this->assertContainerBuilderNotHasService('sylius.resource_controller.state_machine');\n        $this->assertContainerBuilderNotHasService('sylius.resource_controller.state_machine.symfony');\n        $this->assertContainerBuilderNotHasService('sylius.resource_controller.state_machine.winzou');\n    }\n\n    /** @test */\n    public function it_registers_state_machine_controller_with_symfony_workflow_when_its_configured_to(): void\n    {\n        $this->setParameter('sylius.resource.settings', ['state_machine_component' => ResourceBundleInterface::STATE_MACHINE_SYMFONY]);\n        $this->makeSymfonyWorkflowAvailable();\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasParameter('sylius.state_machine_component.default', 'symfony');\n        $this->assertContainerBuilderHasService('sylius.resource_controller.state_machine', Workflow::class);\n        $this->assertContainerBuilderHasService('sylius.resource_controller.state_machine.symfony', Workflow::class);\n        $this->assertContainerBuilderNotHasService('sylius.resource_controller.state_machine.winzou');\n    }\n\n    /** @test */\n    public function it_registers_state_machine_controller_with_winzou_when_its_configured_to(): void\n    {\n        $this->setParameter('sylius.resource.settings', ['state_machine_component' => ResourceBundleInterface::STATE_MACHINE_WINZOU]);\n        $this->makeWinzouStateMachineAvailable();\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasParameter('sylius.state_machine_component.default', 'winzou');\n        $this->assertContainerBuilderHasService('sylius.resource_controller.state_machine', StateMachine::class);\n        $this->assertContainerBuilderHasService('sylius.resource_controller.state_machine.winzou', StateMachine::class);\n        $this->assertContainerBuilderNotHasService('sylius.resource_controller.state_machine.symfony');\n    }\n\n    /** @test */\n    public function it_registers_state_machine_controller_with_symfony_workflow_by_default_when_only_this_one_is_available(): void\n    {\n        $this->setParameter('sylius.resource.settings', ['state_machine_component' => null]);\n        $this->makeSymfonyWorkflowAvailable();\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasParameter('sylius.state_machine_component.default', 'symfony');\n        $this->assertContainerBuilderHasService('sylius.resource_controller.state_machine', Workflow::class);\n        $this->assertContainerBuilderHasService('sylius.resource_controller.state_machine.symfony', Workflow::class);\n        $this->assertContainerBuilderNotHasService('sylius.resource_controller.state_machine.winzou');\n    }\n\n    /** @test */\n    public function it_registers_state_machine_controller_with_winzou_by_default_when_only_this_one_is_available(): void\n    {\n        $this->setParameter('sylius.resource.settings', ['state_machine_component' => null]);\n        $this->makeWinzouStateMachineAvailable();\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasParameter('sylius.state_machine_component.default', 'winzou');\n        $this->assertContainerBuilderHasService('sylius.resource_controller.state_machine', StateMachine::class);\n        $this->assertContainerBuilderHasService('sylius.resource_controller.state_machine.winzou', StateMachine::class);\n        $this->assertContainerBuilderNotHasService('sylius.resource_controller.state_machine.symfony');\n    }\n\n    /** @test */\n    public function it_registers_state_machine_controller_with_winzou_by_default_when_both_are_available(): void\n    {\n        $this->setParameter('sylius.resource.settings', ['state_machine_component' => null]);\n        $this->makeWinzouStateMachineAvailable();\n        $this->makeSymfonyWorkflowAvailable();\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasParameter('sylius.state_machine_component.default', 'winzou');\n        $this->assertContainerBuilderHasService('sylius.resource_controller.state_machine', StateMachine::class);\n        $this->assertContainerBuilderHasService('sylius.resource_controller.state_machine.winzou', StateMachine::class);\n        $this->assertContainerBuilderHasService('sylius.resource_controller.state_machine.symfony', Workflow::class);\n    }\n\n    protected function registerCompilerPass(ContainerBuilder $container): void\n    {\n        $this->setParameter('kernel.bundles', []);\n        $this->setParameter('sylius.resource.settings', ['state_machine_component' => null]);\n\n        $container->addCompilerPass(new RegisterStateMachinePass());\n    }\n\n    private function makeWinzouStateMachineAvailable(): void\n    {\n        $this->setParameter('kernel.bundles', ['Winzou/StateMachine' => winzouStateMachineBundle::class]);\n        $this->registerService('sm.factory', Factory::class);\n    }\n\n    private function makeSymfonyWorkflowAvailable(): void\n    {\n        $this->registerService('workflow.registry', SymfonyWorkflow::class);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Compiler/UnregisterFosRestDefinitionsPassTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Bundle\\DependencyInjection\\Compiler;\n\nuse FOS\\RestBundle\\FOSRestBundle;\nuse Matthias\\SymfonyDependencyInjectionTest\\PhpUnit\\AbstractCompilerPassTestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ViewHandler;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\UnregisterFosRestDefinitionsPass;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\n\nfinal class UnregisterFosRestDefinitionsPassTest extends AbstractCompilerPassTestCase\n{\n    /** @test */\n    public function it_remove_view_handler_if_fos_rest_is_not_available(): void\n    {\n        $this->setParameter('kernel.bundles', []);\n\n        $this->compile();\n\n        $this->assertContainerBuilderNotHasService('sylius.resource_controller.view_handler');\n    }\n\n    /** @test */\n    public function it_keeps_the_view_handler_if_fos_rest_is_available(): void\n    {\n        $this->markAsSkippedIfFosRestBundleIsNotAvailable();\n\n        $this->setParameter('kernel.bundles', [FOSRestBundle::class]);\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasService('sylius.resource_controller.view_handler');\n    }\n\n    protected function registerCompilerPass(ContainerBuilder $container): void\n    {\n        $this->registerService('sylius.resource_controller.view_handler', ViewHandler::class);\n        $this->setParameter('kernel.bundles', []);\n\n        $container->addCompilerPass(new UnregisterFosRestDefinitionsPass());\n    }\n\n    private function markAsSkippedIfFosRestBundleIsNotAvailable(): void\n    {\n        if (!class_exists(FOSRestBundle::class)) {\n            $this->markTestSkipped('FriendsOfSymfony Rest Bundle is not installed.');\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Compiler/UnregisterHateoasDefinitionsPassTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Bundle\\DependencyInjection\\Compiler;\n\nuse Bazinga\\Bundle\\HateoasBundle\\BazingaHateoasBundle;\nuse Hateoas\\Representation\\Factory\\PagerfantaFactory;\nuse Matthias\\SymfonyDependencyInjectionTest\\PhpUnit\\AbstractCompilerPassTestCase;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Compiler\\UnregisterHateoasDefinitionsPass;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\n\nfinal class UnregisterHateoasDefinitionsPassTest extends AbstractCompilerPassTestCase\n{\n    /** @test */\n    public function it_remove_pagerfanta_representation_factory_if_hateoas_is_not_available(): void\n    {\n        $this->setParameter('kernel.bundles', []);\n\n        $this->compile();\n\n        $this->assertContainerBuilderNotHasService('sylius.resource_controller.pagerfanta_representation_factory');\n    }\n\n    /** @test */\n    public function it_keeps_the_view_handler_if_fos_rest_is_available(): void\n    {\n        $this->markAsSkippedIfHateoasIsNotAvailable();\n\n        $this->setParameter('kernel.bundles', [BazingaHateoasBundle::class]);\n\n        $this->compile();\n\n        $this->assertContainerBuilderHasService('sylius.resource_controller.pagerfanta_representation_factory');\n    }\n\n    protected function registerCompilerPass(ContainerBuilder $container): void\n    {\n        $this->registerService('sylius.resource_controller.pagerfanta_representation_factory', PagerfantaFactory::class);\n        $this->setParameter('kernel.bundles', []);\n\n        $container->addCompilerPass(new UnregisterHateoasDefinitionsPass());\n    }\n\n    private function markAsSkippedIfHateoasIsNotAvailable(): void\n    {\n        if (!class_exists(BazingaHateoasBundle::class)) {\n            $this->markTestSkipped('HateoasBundle is not installed.');\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Compiler/WinzouStateMachinePassTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Compiler;\n\nuse PHPUnit\\Framework\\Assert;\nuse SM\\Callback\\CallbackFactoryInterface;\nuse SM\\Callback\\CascadeTransitionCallback;\nuse SM\\Factory\\FactoryInterface;\nuse Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\ContainerInterface;\n\nfinal class WinzouStateMachinePassTest extends WebTestCase\n{\n    /** @test */\n    public function all_winzou_services_are_public(): void\n    {\n        if (!class_exists(FactoryInterface::class)) {\n            self::markTestSkipped('State machine is not installed');\n        }\n\n        /** @var ContainerBuilder $container */\n        $container = self::createClient()->getContainer();\n\n        $services = [\n            'sm.factory',\n            'sm.callback_factory',\n            'sm.callback.cascade_transition',\n            FactoryInterface::class,\n            CallbackFactoryInterface::class,\n            CascadeTransitionCallback::class,\n        ];\n\n        foreach ($services as $id) {\n            Assert::assertNotNull(\n                $container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE),\n                sprintf('Service \"%s\" could not be found', $id),\n            );\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Driver/Exception/InvalidDriverExceptionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Driver\\Exception;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Exception\\InvalidDriverException;\n\nfinal class InvalidDriverExceptionTest extends TestCase\n{\n    private InvalidDriverException $invalidDriverException;\n\n    protected function setUp(): void\n    {\n        $this->invalidDriverException = new InvalidDriverException('driver', 'className');\n    }\n\n    public function testHasAMessage(): void\n    {\n        $this->assertSame(\n            'Driver \"driver\" is not supported by className.',\n            $this->invalidDriverException->getMessage(),\n        );\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Driver/Exception/UnknownDriverExceptionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Driver\\Exception;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\Driver\\Exception\\UnknownDriverException;\n\nfinal class UnknownDriverExceptionTest extends TestCase\n{\n    private UnknownDriverException $unknownDriverException;\n\n    protected function setUp(): void\n    {\n        $this->unknownDriverException = new UnknownDriverException('driver');\n    }\n\n    public function testHasAMessage(): void\n    {\n        $this->assertSame('Unknown driver \"driver\".', $this->unknownDriverException->getMessage());\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Dummy/BookWithAliasResource.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\n\n#[AsResource(alias: 'app.book')]\nfinal class BookWithAliasResource\n{\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Dummy/BookWithApplicationNameResource.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\n\n#[AsResource(applicationName: 'myApp')]\nfinal class BookWithApplicationNameResource\n{\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Dummy/DummyResource.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\n\n#[AsResource]\nfinal class DummyResource\n{\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/Dummy/NoDriverResource.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Dummy;\n\nuse Sylius\\Resource\\Metadata\\AsResource;\n\n#[AsResource(driver: false)]\nfinal class NoDriverResource\n{\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/PagerfantaExtensionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection;\n\nuse BabDev\\PagerfantaBundle\\BabDevPagerfantaBundle;\nuse BabDev\\PagerfantaBundle\\DependencyInjection\\BabDevPagerfantaExtension;\nuse Matthias\\SymfonyDependencyInjectionTest\\PhpUnit\\AbstractExtensionTestCase;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\PagerfantaExtension;\nuse Symfony\\Bundle\\TwigBundle\\TwigBundle;\n\nfinal class PagerfantaExtensionTest extends AbstractExtensionTestCase\n{\n    /**\n     * @test\n     */\n    public function it_prepends_the_white_october_bundle_configuration_to_the_babdev_bundle(): void\n    {\n        $this->container->setParameter(\n            'kernel.bundles',\n            [\n                'BabDevPagerfantaBundle' => BabDevPagerfantaBundle::class,\n                'TwigBundle' => TwigBundle::class,\n            ],\n        );\n\n        $bundleConfig = [\n            'default_view' => 'twitter_bootstrap',\n            'exceptions_strategy' => [\n                'out_of_range_page' => 'custom',\n                'not_valid_current_page' => 'to_http_not_found',\n            ],\n        ];\n\n        // Prepend config now to allow the prepend pass to work\n        $this->container->prependExtensionConfig('white_october_pagerfanta', $bundleConfig);\n\n        $this->load($bundleConfig);\n\n        $this->assertSame([$bundleConfig], $this->container->getExtensionConfig('babdev_pagerfanta'));\n        $this->assertContainerBuilderHasParameter('white_october_pagerfanta.default_view', $bundleConfig['default_view']);\n    }\n\n    protected function getContainerExtensions(): array\n    {\n        return [\n            new PagerfantaExtension(),\n            new BabDevPagerfantaExtension(),\n        ];\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/SyliusResourceExtensionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection;\n\nuse App\\Entity\\Book;\nuse App\\Entity\\BookTranslation;\nuse App\\Entity\\ComicBook;\nuse App\\Factory\\BookFactory;\nuse App\\Form\\Type\\BookType;\nuse Behat\\Transliterator\\Transliterator;\nuse Matthias\\SymfonyDependencyInjectionTest\\PhpUnit\\AbstractExtensionTestCase;\nuse PHPUnit\\Framework\\Attributes\\CoversClass;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceController;\nuse Sylius\\Bundle\\ResourceBundle\\DependencyInjection\\SyliusResourceExtension;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ResourceMappingDriverChain;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\DefaultResourceType;\nuse Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Dummy\\BookWithAliasResource;\nuse Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Dummy\\BookWithApplicationNameResource;\nuse Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Dummy\\DummyResource;\nuse Sylius\\Bundle\\ResourceBundle\\Tests\\DependencyInjection\\Dummy\\NoDriverResource;\nuse Sylius\\Resource\\Doctrine\\Common\\State\\PersistProcessor;\nuse Sylius\\Resource\\Doctrine\\Common\\State\\RemoveProcessor;\nuse Sylius\\Resource\\Factory\\Factory;\n\n#[CoversClass(SyliusResourceExtension::class)]\nfinal class SyliusResourceExtensionTest extends AbstractExtensionTestCase\n{\n    /** @test */\n    public function it_registers_services_and_parameters_for_resources(): void\n    {\n        $this->load([\n            'resources' => [\n                'app.book' => [\n                    'classes' => [\n                        'model' => Book::class,\n                        'form' => BookType::class,\n                    ],\n                    'translation' => [\n                        'classes' => [\n                            'model' => BookTranslation::class,\n                         ],\n                    ],\n                ],\n            ],\n        ]);\n\n        $this->assertContainerBuilderHasService('app.factory.book');\n        $this->assertContainerBuilderHasService('app.repository.book');\n        $this->assertContainerBuilderHasService('app.controller.book');\n        $this->assertContainerBuilderHasService('app.manager.book');\n        $this->assertContainerBuilderNotHasService(ResourceController::class);\n\n        $this->assertContainerBuilderHasParameter('app.model.book.class', Book::class);\n        $this->assertContainerBuilderHasParameter('app.model.book_translation.class', BookTranslation::class);\n\n        $this->assertContainerBuilderHasParameter('app.form.book.class', BookType::class);\n    }\n\n    /** @test */\n    public function it_aliases_authorization_checker_with_the_one_given_in_configuration(): void\n    {\n        $this->load([\n            'authorization_checker' => 'custom_service',\n        ]);\n\n        $this->assertContainerBuilderHasAlias('sylius.resource_controller.authorization_checker', 'custom_service');\n    }\n\n    /** @test */\n    public function it_registers_default_translation_parameters(): void\n    {\n        $this->load([\n            'translation' => [\n                'locale_provider' => 'test.custom_locale_provider',\n            ],\n         ]);\n\n        $this->assertContainerBuilderHasAlias('sylius.translation_locale_provider', 'test.custom_locale_provider');\n    }\n\n    /** @test */\n    public function it_does_not_break_when_aliasing_two_resources_use_same_factory_class(): void\n    {\n        $this->load([\n            'resources' => [\n                'app.book' => [\n                    'classes' => [\n                        'model' => Book::class,\n                        'factory' => BookFactory::class,\n                    ],\n                ],\n                'app.comic_book' => [\n                    'classes' => [\n                        'model' => ComicBook::class,\n                        'factory' => BookFactory::class,\n                    ],\n                ],\n            ],\n        ]);\n        $this->assertContainerBuilderHasService('app.factory.book');\n        $this->assertContainerBuilderHasService('app.factory.comic_book');\n\n        $this->assertContainerBuilderHasAlias(sprintf('%s $bookFactory', BookFactory::class), 'app.factory.book');\n        $this->assertContainerBuilderHasAlias(sprintf('%s $comicBookFactory', BookFactory::class), 'app.factory.comic_book');\n    }\n\n    /** @test */\n    public function it_registers_parameter_for_paths(): void\n    {\n        $this->load([\n            'mapping' => [\n                'paths' => [\n                    __DIR__ . '/Dummy',\n                ],\n            ],\n        ]);\n\n        $this->assertContainerBuilderHasParameter('sylius.resource.mapping', [\n            'imports' => [],\n            'paths' => [\n                __DIR__ . '/Dummy',\n            ],\n        ]);\n    }\n\n    /** @test */\n    public function it_auto_registers_resources(): void\n    {\n        $this->load([\n            'mapping' => [\n                'paths' => [\n                    __DIR__ . '/Dummy',\n                ],\n            ],\n        ]);\n\n        $this->assertContainerBuilderHasParameter('sylius.resources', [\n            'app.book' => [\n                'classes' => [\n                    'model' => BookWithAliasResource::class,\n                    'controller' => ResourceController::class,\n                    'factory' => Factory::class,\n                    'form' => DefaultResourceType::class,\n                ],\n                'driver' => 'doctrine/orm',\n            ],\n            'my_app.book_with_application_name' => [\n                'classes' => [\n                    'model' => BookWithApplicationNameResource::class,\n                    'controller' => ResourceController::class,\n                    'factory' => Factory::class,\n                    'form' => DefaultResourceType::class,\n                ],\n                'driver' => 'doctrine/orm',\n            ],\n            'app.dummy' => [\n                'classes' => [\n                    'model' => DummyResource::class,\n                    'controller' => ResourceController::class,\n                    'factory' => Factory::class,\n                    'form' => DefaultResourceType::class,\n                ],\n                'driver' => 'doctrine/orm',\n            ],\n            'app.no_driver' => [\n                'classes' => [\n                    'model' => NoDriverResource::class,\n                    'controller' => ResourceController::class,\n                    'factory' => Factory::class,\n                    'form' => DefaultResourceType::class,\n                ],\n                'driver' => false,\n            ],\n        ]);\n    }\n\n    /** @test */\n    public function it_registers_doctrine_related_services_when_doctrine_is_available(): void\n    {\n        $this->load();\n\n        $this->assertContainerBuilderHasService(ResourceMappingDriverChain::class);\n        $this->assertContainerBuilderHasService(PersistProcessor::class);\n        $this->assertContainerBuilderHasService(RemoveProcessor::class);\n    }\n\n    public function testItRegistersMetadataConfigurationWithADirectoryAsImportPath(): void\n    {\n        $this->load([\n            'mapping' => [\n                'imports' => [\n                    __DIR__ . '/php',\n                ],\n            ],\n        ]);\n\n        $emptyPhpFile = realpath(__DIR__ . '/php/empty_file.php');\n        $this->assertContainerBuilderHasService('sylius.metadata.resource_extractor.php_file');\n        $this->assertSame([$emptyPhpFile], $this->container->getDefinition('sylius.metadata.resource_extractor.php_file')->getArgument(0));\n    }\n\n    public function testItRegistersMetadataConfigurationWithAFileAsImportPath(): void\n    {\n        $this->load([\n            'mapping' => [\n                'imports' => [\n                    __DIR__ . '/php/empty_file.php',\n                ],\n            ],\n        ]);\n\n        $emptyPhpFile = realpath(__DIR__ . '/php/empty_file.php');\n        $this->assertContainerBuilderHasService('sylius.metadata.resource_extractor.php_file');\n        $this->assertSame([$emptyPhpFile], $this->container->getDefinition('sylius.metadata.resource_extractor.php_file')->getArgument(0));\n    }\n\n    public function testItRegistersRoutingPathBcLayerAutomatically(): void\n    {\n        $this->load();\n\n        if (class_exists(Transliterator::class)) {\n            $this->assertTrue($this->container->getParameter('sylius.routing_path_bc_layer'));\n\n            return;\n        }\n\n        $this->assertFalse($this->container->getParameter('sylius.routing_path_bc_layer'));\n    }\n\n    public function testRoutingPathBcLayerCanBeEnabled(): void\n    {\n        if (!class_exists(Transliterator::class)) {\n            $this->markTestSkipped('This test requires Transliterator.');\n        }\n\n        $this->load([\n            'routing_path_bc_layer' => true,\n        ]);\n\n        $this->assertTrue($this->container->getParameter('sylius.routing_path_bc_layer'));\n    }\n\n    public function testRoutingPathBcLayerCanBeDisabled(): void\n    {\n        $this->load([\n            'routing_path_bc_layer' => false,\n        ]);\n\n        $this->assertFalse($this->container->getParameter('sylius.routing_path_bc_layer'));\n    }\n\n    public function testItRegistersDashPathSegmentNameGeneratorByDefault(): void\n    {\n        $this->load();\n\n        $this->assertSame('sylius.metadata.path_segment_name_generator.dash', $this->container->getAlias('sylius.path_segment_name_generator')->__toString());\n    }\n\n    public function testItRegistersCustomPathSegmentNameGenerator(): void\n    {\n        $this->load([\n            'path_segment_name_generator' => 'sylius.metadata.path_segment_name_generator.underscore',\n        ]);\n\n        $this->assertSame('sylius.metadata.path_segment_name_generator.underscore', $this->container->getAlias('sylius.path_segment_name_generator')->__toString());\n    }\n\n    protected function getContainerExtensions(): array\n    {\n        $this->setParameter('kernel.bundles', []);\n\n        return [\n            new SyliusResourceExtension(),\n        ];\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/DependencyInjection/php/empty_file.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n"
  },
  {
    "path": "tests/Bundle/Doctrine/ODM/PHPCR/EventListener/DefaultParentListenerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Doctrine\\ODM\\PHPCR\\EventListener;\n\nuse Doctrine\\ODM\\PHPCR\\DocumentManagerInterface;\nuse Doctrine\\ODM\\PHPCR\\Mapping\\ClassMetadata;\nuse PHPCR\\NodeInterface;\nuse PHPCR\\SessionInterface;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ODM\\PHPCR\\EventListener\\DefaultParentListener;\nuse Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent;\n\n/**\n * @require Doctrine\\ODM\\PHPCR\\DocumentManagerInterface\n */\nfinal class DefaultParentListenerTest extends TestCase\n{\n    private DocumentManagerInterface|MockObject $documentManagerMock;\n\n    private DefaultParentListener $defaultParentListener;\n\n    private ResourceControllerEvent|MockObject $eventMock;\n\n    private ClassMetadata|MockObject $documentMetadataMock;\n\n    protected function setUp(): void\n    {\n        if (!interface_exists(DocumentManagerInterface::class)) {\n            $this->markTestSkipped('Doctrine PHPCR ODM not installed');\n        }\n\n        $this->documentManagerMock = $this->createMock(DocumentManagerInterface::class);\n        $this->defaultParentListener = new DefaultParentListener($this->documentManagerMock, '/path/to');\n        $this->eventMock = $this->createMock(ResourceControllerEvent::class);\n        $this->documentMetadataMock = $this->createMock(ClassMetadata::class);\n    }\n\n    public function testThrowAnExceptionIfNoParentMappingExists(): void\n    {\n        $this->eventMock->expects($this->once())->method('getSubject')->willReturn(new \\stdClass());\n\n        $this->documentManagerMock\n            ->expects($this->once())\n            ->method('getClassMetadata')\n            ->with(\\stdClass::class)\n            ->willReturn($this->documentMetadataMock)\n        ;\n\n        $this->documentMetadataMock->parentMapping = null;\n\n        $this->expectException(\\RuntimeException::class);\n        $this->expectExceptionMessage(\n            'A default parent path has been specified, but no parent mapping has been applied to document \"stdClass\"',\n        );\n\n        $this->defaultParentListener->onPreCreate($this->eventMock);\n    }\n\n    public function testThrowAnExceptionIfTheParentDoesNotExistAndAutocreateIsFalse(): void\n    {\n        $this->defaultParentListener = new DefaultParentListener($this->documentManagerMock, '/path/to', false);\n\n        $this->eventMock->expects($this->once())->method('getSubject')->willReturn(new \\stdClass());\n\n        $this->documentManagerMock\n            ->expects($this->once())\n            ->method('getClassMetadata')\n            ->with(\\stdClass::class)\n            ->willReturn($this->documentMetadataMock)\n        ;\n\n        $this->documentMetadataMock->parentMapping = 'parent';\n\n        $this->documentManagerMock\n            ->expects($this->once())\n            ->method('find')\n            ->with(null, '/path/to')\n            ->willReturn(null)\n        ;\n\n        $this->expectException(\\RuntimeException::class);\n\n        $this->expectExceptionMessage(\n            'Document at default parent path \"/path/to\" does not exist. `autocreate` was set to \"false\"',\n        );\n        $this->defaultParentListener->onPreCreate($this->eventMock);\n    }\n\n    public function testSetTheParentDocument(): void\n    {\n        $subjectDocument = new \\stdClass();\n\n        $parentDocument = new \\stdClass();\n\n        $this->eventMock->expects($this->once())->method('getSubject')->willReturn($subjectDocument);\n\n        $this->documentManagerMock\n            ->expects($this->once())\n            ->method('getClassMetadata')\n            ->with(\\stdClass::class)\n            ->willReturn($this->documentMetadataMock)\n        ;\n\n        $this->documentMetadataMock->parentMapping = 'parent';\n\n        $this->documentMetadataMock\n            ->expects($this->once())\n            ->method('getFieldValue')\n            ->with($subjectDocument, 'parent')\n            ->willReturn(null)\n        ;\n\n        $this->documentManagerMock\n            ->expects($this->once())\n            ->method('find')\n            ->with(null, '/path/to')\n            ->willReturn($parentDocument)\n        ;\n\n        $this->documentMetadataMock\n            ->expects($this->once())\n            ->method('setFieldValue')\n            ->with($subjectDocument, 'parent', $parentDocument)\n        ;\n\n        $this->defaultParentListener->onPreCreate($this->eventMock);\n    }\n\n    public function testAutocreateAndSetTheParentDocument(): void\n    {\n        /** @var SessionInterface|MockObject $sessionMock */\n        $sessionMock = $this->createMock(SessionInterface::class);\n        /** @var NodeInterface|MockObject $nodeMock */\n        $nodeMock = $this->createMock(NodeInterface::class);\n\n        $this->defaultParentListener = new DefaultParentListener($this->documentManagerMock, '/path/to', true);\n\n        $subjectDocument = new \\stdClass();\n\n        $parentDocument = new \\stdClass();\n\n        $this->eventMock->expects($this->once())->method('getSubject')->willReturn($subjectDocument);\n\n        $this->documentManagerMock\n            ->expects($this->once())\n            ->method('getClassMetadata')\n            ->with(\\stdClass::class)\n            ->willReturn($this->documentMetadataMock)\n        ;\n\n        $this->documentMetadataMock->parentMapping = 'parent';\n\n        $this->documentManagerMock\n            ->expects($this->exactly(2))\n            ->method('find')\n            ->with(null, '/path/to')\n            ->willReturn(null, $parentDocument)\n        ;\n        $this->documentManagerMock\n            ->expects($this->once())\n            ->method('getPhpcrSession')\n            ->willReturn($sessionMock)\n        ;\n\n        $sessionMock->expects($this->once())->method('getRootNode')->willReturn($nodeMock);\n\n        // we need to mock the behavior of the node helper\n        // see: https://github.com/phpcr/phpcr-utils/issues/106\n        $nodeMock\n            ->expects($this->exactly(2))\n            ->method('hasNode')\n            ->with($this->anything())\n            ->willReturn(true)\n        ;\n        $nodeMock\n            ->expects($this->exactly(2))\n            ->method('getNode')\n            ->with($this->anything())\n            ->willReturn($nodeMock)\n        ;\n\n        $this->documentMetadataMock\n            ->expects($this->once())\n            ->method('setFieldValue')\n            ->with($subjectDocument, 'parent', $parentDocument)\n        ;\n\n        $this->defaultParentListener->onPreCreate($this->eventMock);\n    }\n\n    public function testSetTheParentDocumentIfForceIsTrueAndTheParentIsAlreadySet(): void\n    {\n        $this->defaultParentListener = new DefaultParentListener($this->documentManagerMock, '/path/to', false, true);\n\n        $subjectDocument = new \\stdClass();\n\n        $parentDocument = new \\stdClass();\n\n        $this->eventMock->expects($this->once())->method('getSubject')->willReturn($subjectDocument);\n\n        $this->documentManagerMock\n            ->expects($this->once())\n            ->method('getClassMetadata')\n            ->with(\\stdClass::class)\n            ->willReturn($this->documentMetadataMock)\n        ;\n\n        $this->documentMetadataMock\n            ->expects($this->never())\n            ->method('getFieldValue')\n            ->with($subjectDocument, 'parent')\n        ;\n        $this->documentMetadataMock\n            ->expects($this->once())\n            ->method('setFieldValue')\n            ->with($subjectDocument, 'parent', $parentDocument)\n        ;\n        $this->documentMetadataMock->parentMapping = 'parent';\n\n        $this->documentManagerMock\n            ->expects($this->once())\n            ->method('find')\n            ->with(null, '/path/to')\n            ->willReturn($parentDocument)\n        ;\n\n        $this->defaultParentListener->onPreCreate($this->eventMock);\n    }\n\n    public function testReturnEarlyIfForceIsFalseAndSubjectAlreadyHasAParent(): void\n    {\n        $subjectDocument = new \\stdClass();\n\n        $this->eventMock->expects($this->once())->method('getSubject')->willReturn($subjectDocument);\n\n        $this->documentManagerMock\n            ->expects($this->once())\n            ->method('getClassMetadata')\n            ->with(\\stdClass::class)\n            ->willReturn($this->documentMetadataMock)\n        ;\n\n        $this->documentMetadataMock->parentMapping = 'parent';\n        $this->documentMetadataMock\n            ->expects($this->once())\n            ->method('getFieldValue')\n            ->with($subjectDocument, 'parent')\n            ->willReturn(new \\stdClass())\n        ;\n\n        $this->documentManagerMock->expects($this->never())->method('find')->with(null, '/path/to');\n\n        $this->defaultParentListener->onPreCreate($this->eventMock);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Doctrine/ODM/PHPCR/EventListener/NameFilterListenerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Doctrine\\ODM\\PHPCR\\EventListener;\n\nuse Doctrine\\ODM\\PHPCR\\DocumentManagerInterface;\nuse Doctrine\\ODM\\PHPCR\\Mapping\\ClassMetadata;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ODM\\PHPCR\\EventListener\\NameFilterListener;\nuse Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent;\n\n/**\n * @require Doctrine\\ODM\\PHPCR\\DocumentManagerInterface\n */\nfinal class NameFilterListenerTest extends TestCase\n{\n    private DocumentManagerInterface|MockObject $documentManagerMock;\n\n    private NameFilterListener $nameFilterListener;\n\n    private ResourceControllerEvent|MockObject $eventMock;\n\n    private ClassMetadata|MockObject $metadataMock;\n\n    private \\stdClass $document;\n\n    protected function setUp(): void\n    {\n        if (!interface_exists(DocumentManagerInterface::class)) {\n            $this->markTestSkipped('Doctrine PHPCR ODM not installed');\n        }\n\n        $this->documentManagerMock = $this->createMock(DocumentManagerInterface::class);\n        $this->nameFilterListener = new NameFilterListener($this->documentManagerMock);\n        $this->eventMock = $this->createMock(ResourceControllerEvent::class);\n        $this->metadataMock = $this->createMock(ClassMetadata::class);\n        $this->document = new \\stdClass();\n    }\n\n    public function testThrowsAnExceptionIfNodenameIsNotMapped(): void\n    {\n        $this->eventMock->expects($this->once())->method('getSubject')->willReturn($this->document);\n\n        $this->documentManagerMock->expects($this->once())->method('getClassMetadata')->with('stdClass')->willReturn($this->metadataMock);\n\n        $this->metadataMock->nodename = null;\n\n        $this->expectException(\\RuntimeException::class);\n        $this->expectExceptionMessage('In order to use the node name filter on \"stdClass\" it is necessary to map a field as the \"nodename\"');\n\n        $this->nameFilterListener->onEvent($this->eventMock);\n    }\n\n    public function testCleanTheName(): void\n    {\n        $this->eventMock->expects($this->once())->method('getSubject')->willReturn($this->document);\n\n        $this->documentManagerMock->expects($this->once())->method('getClassMetadata')->with('stdClass')->willReturn($this->metadataMock);\n\n        $this->metadataMock->nodename = 'foobar';\n        $this->metadataMock->expects($this->once())->method('getFieldValue')->with($this->document, 'foobar')->willReturn('Hello//Foo');\n        $this->metadataMock->expects($this->once())->method('setFieldValue')->with($this->document, 'foobar', 'Hello  Foo');\n\n        $this->nameFilterListener->onEvent($this->eventMock);\n    }\n\n    public function testUseTheGivenReplacementChar(): void\n    {\n        $this->nameFilterListener = new NameFilterListener($this->documentManagerMock, '_');\n\n        $this->eventMock->expects($this->once())->method('getSubject')->willReturn($this->document);\n\n        $this->documentManagerMock->expects($this->once())->method('getClassMetadata')->with('stdClass')->willReturn($this->metadataMock);\n\n        $this->metadataMock->nodename = 'foobar';\n        $this->metadataMock->expects($this->once())->method('getFieldValue')->with($this->document, 'foobar')->willReturn('Hello//Foo');\n        $this->metadataMock->expects($this->once())->method('setFieldValue')->with($this->document, 'foobar', 'Hello__Foo');\n\n        $this->nameFilterListener->onEvent($this->eventMock);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Doctrine/ODM/PHPCR/EventListener/NameResolverListenerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Doctrine\\ODM\\PHPCR\\EventListener;\n\nuse Doctrine\\ODM\\PHPCR\\DocumentManagerInterface;\nuse Doctrine\\ODM\\PHPCR\\Mapping\\ClassMetadata;\nuse PHPCR\\NodeInterface;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ODM\\PHPCR\\EventListener\\NameResolverListener;\nuse Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent;\n\n/**\n * @require Doctrine\\ODM\\PHPCR\\DocumentManagerInterface\n */\nfinal class NameResolverListenerTest extends TestCase\n{\n    private DocumentManagerInterface|MockObject $documentManagerMock;\n\n    private NameResolverListener $nameResolverListener;\n\n    private ResourceControllerEvent|MockObject $eventMock;\n\n    private ClassMetadata|MockObject $metadataMock;\n\n    private NodeInterface|MockObject $nodeMock;\n\n    private \\stdClass $document;\n\n    private \\stdClass $parentDocument;\n\n    protected function setUp(): void\n    {\n        if (!interface_exists(DocumentManagerInterface::class)) {\n            $this->markTestSkipped('Doctrine PHPCR ODM not installed');\n        }\n\n        $this->documentManagerMock = $this->createMock(DocumentManagerInterface::class);\n        $this->nameResolverListener = new NameResolverListener($this->documentManagerMock);\n        $this->eventMock = $this->createMock(ResourceControllerEvent::class);\n        $this->metadataMock = $this->createMock(ClassMetadata::class);\n        $this->nodeMock = $this->createMock(NodeInterface::class);\n        $this->document = new \\stdClass();\n        $this->parentDocument = new \\stdClass();\n    }\n\n    public function testThrowsAnExceptionWhenTheGeneratorTypeIsNotParent(): void\n    {\n        $this->eventMock->expects($this->once())->method('getSubject')->willReturn($this->document);\n\n        $this->documentManagerMock\n            ->expects($this->once())\n            ->method('getClassMetadata')\n            ->with('stdClass')\n            ->willReturn($this->metadataMock)\n        ;\n\n        $this->metadataMock->idGenerator = 1;\n\n        $this->expectException(\\RuntimeException::class);\n        $this->expectExceptionMessage('Document of class \"stdClass\" must be using the GENERATOR_TYPE_PARENT identificatio strategy (value 3), it is current using \"1\" (this may be an automatic configuration: be sure to map both the `nodename` and the `parentDocument`).');\n\n        $this->nameResolverListener->onEvent($this->eventMock);\n    }\n\n    public function testRetainTheOriginalNameWhenNoConflictExists(): void\n    {\n        $this->eventMock->expects($this->once())->method('getSubject')->willReturn($this->document);\n\n        $this->documentManagerMock->expects($this->once())->method('getClassMetadata')->with('stdClass')->willReturn($this->metadataMock);\n\n        $this->documentManagerMock\n            ->expects($this->once())\n            ->method('getNodeForDocument')\n            ->with($this->parentDocument)\n            ->willReturn($this->nodeMock)\n        ;\n\n        $this->metadataMock->idGenerator = ClassMetadata::GENERATOR_TYPE_PARENT;\n        $this->metadataMock->nodename = 'title';\n        $this->metadataMock->parentMapping = 'parent';\n        $this->metadataMock\n            ->expects($this->exactly(2))\n            ->method('getFieldValue')\n            ->willReturnMap([\n                [$this->document, 'parent', $this->parentDocument],\n                [$this->document, 'title', 'Hello World'],\n            ])\n        ;\n\n        $this->nodeMock->expects($this->once())->method('getPath')->willReturn('/path/to');\n\n        $this->documentManagerMock->expects($this->once())->method('find')->with(null, '/path/to/Hello World')->willReturn(null);\n\n        $this->metadataMock->expects($this->once())->method('setFieldValue')->with($this->document, 'title', 'Hello World');\n\n        $this->nameResolverListener->onEvent($this->eventMock);\n    }\n\n    public function testAutoIncrementTheNameIfAConflictExists(): void\n    {\n        $existingDocument = new \\stdClass();\n\n        $this->eventMock->expects($this->once())->method('getSubject')->willReturn($this->document);\n\n        $this->documentManagerMock\n            ->expects($this->once())\n            ->method('getClassMetadata')\n            ->with('stdClass')\n            ->willReturn($this->metadataMock)\n        ;\n\n        $this->metadataMock->idGenerator = ClassMetadata::GENERATOR_TYPE_PARENT;\n        $this->metadataMock->nodename = 'title';\n        $this->metadataMock->parentMapping = 'parent';\n        $this->metadataMock\n            ->expects($this->exactly(2))\n            ->method('getFieldValue')\n            ->willReturnMap([\n                [$this->document, 'parent', $this->parentDocument],\n                [$this->document, 'title', 'Hello World'],\n            ])\n        ;\n\n        $this->documentManagerMock->expects($this->once())->method('getNodeForDocument')->with($this->parentDocument)->willReturn($this->nodeMock);\n\n        $this->nodeMock->expects($this->once())->method('getPath')->willReturn('/path/to');\n\n        $this->documentManagerMock\n            ->expects($this->exactly(4))\n            ->method('find')\n            ->willReturnMap([\n                [null, '/path/to/Hello World', $existingDocument],\n                [null, '/path/to/Hello World-1', $existingDocument],\n                [null, '/path/to/Hello World-2', $existingDocument],\n                [null, '/path/to/Hello World-3', null],\n            ])\n        ;\n\n        $this->metadataMock->expects($this->once())->method('setFieldValue')->with($this->document, 'title', 'Hello World-3');\n\n        $this->nameResolverListener->onEvent($this->eventMock);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Doctrine/ORM/Form/Builder/DefaultFormBuilderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Doctrine\\ORM\\Form\\Builder;\n\nuse Doctrine\\DBAL\\Types\\Types;\nuse Doctrine\\ORM\\EntityManagerInterface;\nuse Doctrine\\ORM\\Mapping\\ClassMetadata;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Doctrine\\ORM\\Form\\Builder\\DefaultFormBuilder;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Builder\\DefaultFormBuilderInterface;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\n\nfinal class DefaultFormBuilderTest extends TestCase\n{\n    private EntityManagerInterface|MockObject $entityManagerMock;\n\n    private DefaultFormBuilder $defaultFormBuilder;\n\n    private MetadataInterface|MockObject $metadataMock;\n\n    private FormBuilderInterface|MockObject $formBuilderMock;\n\n    private ClassMetadata|MockObject $classMetadataMock;\n\n    protected function setUp(): void\n    {\n        $this->entityManagerMock = $this->createMock(EntityManagerInterface::class);\n        $this->defaultFormBuilder = new DefaultFormBuilder($this->entityManagerMock);\n        $this->metadataMock = $this->createMock(MetadataInterface::class);\n        $this->formBuilderMock = $this->createMock(FormBuilderInterface::class);\n        $this->classMetadataMock = $this->createMock(ClassMetadata::class);\n    }\n\n    public function testADefaultFormBuilder(): void\n    {\n        $this->assertInstanceOf(DefaultFormBuilderInterface::class, $this->defaultFormBuilder);\n    }\n\n    public function testDoesNotSupportEntitiesWithMultiplePrimaryKeys(): void\n    {\n        $this->metadataMock->expects($this->once())->method('getClass')->with('model')->willReturn('AppBundle\\Entity\\Book');\n\n        $this->entityManagerMock->expects($this->once())->method('getClassMetadata')->with('AppBundle\\Entity\\Book')->willReturn($this->classMetadataMock);\n\n        $this->classMetadataMock->identifier = ['id', 'slug'];\n\n        $this->expectException(\\RuntimeException::class);\n\n        $this->defaultFormBuilder->build($this->metadataMock, $this->formBuilderMock, []);\n    }\n\n    public function testExcludesNonNaturalIdentifierFromTheFieldList(): void\n    {\n        $this->metadataMock->expects($this->once())->method('getClass')->with('model')->willReturn('AppBundle\\Entity\\Book');\n\n        $this->entityManagerMock->expects($this->once())->method('getClassMetadata')->with('AppBundle\\Entity\\Book')->willReturn($this->classMetadataMock);\n\n        $this->classMetadataMock->fieldNames = ['id', 'name', 'description', 'enabled'];\n        $this->classMetadataMock->identifier = ['id'];\n        $this->classMetadataMock->expects($this->once())->method('isIdentifierNatural')->willReturn(false);\n        $this->classMetadataMock->expects($this->once())->method('getAssociationMappings')->willReturn([]);\n        $this->classMetadataMock\n            ->expects($this->exactly(3))\n            ->method('getTypeOfField')\n            ->willReturnMap([\n                ['name', Types::STRING],\n                ['description', Types::TEXT],\n                ['enabled', Types::BOOLEAN],\n            ])\n        ;\n\n        $this->formBuilderMock\n            ->expects($this->exactly(3))\n            ->method('add')\n            ->willReturnMap([\n                ['name', null, [], $this->formBuilderMock],\n                ['description', null, [], $this->formBuilderMock],\n                ['enabled', null, [], $this->formBuilderMock],\n            ])\n        ;\n\n        $this->defaultFormBuilder->build($this->metadataMock, $this->formBuilderMock, []);\n    }\n\n    public function testDoesNotExcludeNaturalIdentifierFromTheFieldList(): void\n    {\n        $this->metadataMock->expects($this->once())->method('getClass')->with('model')->willReturn('AppBundle\\Entity\\Book');\n\n        $this->entityManagerMock->expects($this->once())->method('getClassMetadata')->with('AppBundle\\Entity\\Book')->willReturn($this->classMetadataMock);\n\n        $this->classMetadataMock->fieldNames = ['id', 'name', 'description', 'enabled'];\n        $this->classMetadataMock->identifier = ['id'];\n        $this->classMetadataMock->expects($this->once())->method('isIdentifierNatural')->willReturn(true);\n        $this->classMetadataMock->expects($this->once())->method('getAssociationMappings')->willReturn([]);\n        $this->classMetadataMock\n            ->expects($this->exactly(4))\n            ->method('getTypeOfField')\n            ->willReturnMap([\n                ['id', Types::INTEGER],\n                ['name', Types::STRING],\n                ['description', Types::TEXT],\n                ['enabled', Types::BOOLEAN],\n            ])\n        ;\n\n        $this->formBuilderMock\n            ->expects($this->exactly(4))\n            ->method('add')\n            ->willReturnMap([\n                ['id', null, [], $this->formBuilderMock],\n                ['name', null, [], $this->formBuilderMock],\n                ['description', null, [], $this->formBuilderMock],\n                ['enabled', null, [], $this->formBuilderMock],\n            ])\n        ;\n\n        $this->defaultFormBuilder->build($this->metadataMock, $this->formBuilderMock, []);\n    }\n\n    public function testUsesMetadataToCreateAppropriateFields(): void\n    {\n        $this->metadataMock->expects($this->once())->method('getClass')->with('model')->willReturn('AppBundle\\Entity\\Book');\n\n        $this->entityManagerMock->expects($this->once())->method('getClassMetadata')->with('AppBundle\\Entity\\Book')->willReturn($this->classMetadataMock);\n\n        $this->classMetadataMock->fieldNames = ['name', 'description', 'enabled'];\n        $this->classMetadataMock->expects($this->once())->method('isIdentifierNatural')->willReturn(true);\n        $this->classMetadataMock->expects($this->once())->method('getAssociationMappings')->willReturn([]);\n        $this->classMetadataMock\n            ->expects($this->exactly(3))\n            ->method('getTypeOfField')\n            ->willReturnMap([\n                ['name', Types::STRING],\n                ['description', Types::TEXT],\n                ['enabled', Types::BOOLEAN],\n            ])\n        ;\n\n        $this->formBuilderMock\n            ->expects($this->exactly(3))\n            ->method('add')\n            ->willReturnMap([\n                ['name', null, [], $this->formBuilderMock],\n                ['description', null, [], $this->formBuilderMock],\n                ['enabled', null, [], $this->formBuilderMock],\n            ])\n        ;\n\n        $this->defaultFormBuilder->build($this->metadataMock, $this->formBuilderMock, []);\n    }\n\n    public function testUsesSingleTextWidgetForDatetimeField(): void\n    {\n        $this->metadataMock->expects($this->once())->method('getClass')->with('model')->willReturn('AppBundle\\Entity\\Book');\n\n        $this->entityManagerMock->expects($this->once())->method('getClassMetadata')->with('AppBundle\\Entity\\Book')->willReturn($this->classMetadataMock);\n\n        $this->classMetadataMock->fieldNames = ['name', 'description', 'enabled', 'publishedAt'];\n        $this->classMetadataMock->expects($this->once())->method('isIdentifierNatural')->willReturn(true);\n        $this->classMetadataMock->expects($this->once())->method('getAssociationMappings')->willReturn([]);\n        $this->classMetadataMock\n            ->expects($this->exactly(4))\n            ->method('getTypeOfField')\n            ->willReturnMap([\n                ['name', Types::STRING],\n                ['description', Types::TEXT],\n                ['enabled', Types::BOOLEAN],\n                ['publishedAt', Types::DATETIME_MUTABLE],\n            ])\n        ;\n\n        $this->formBuilderMock\n            ->expects($this->exactly(4))\n            ->method('add')\n            ->willReturnMap([\n                ['name', null, [], $this->formBuilderMock],\n                ['description', null, [], $this->formBuilderMock],\n                ['enabled', null, [], $this->formBuilderMock],\n                ['publishedAt', null, ['widget' => 'single_text'], $this->formBuilderMock],\n            ])\n        ;\n\n        $this->defaultFormBuilder->build($this->metadataMock, $this->formBuilderMock, []);\n    }\n\n    public function testAlsoCreatesFieldsForRelationsOtherThanOneToMany(): void\n    {\n        $this->metadataMock->expects($this->once())->method('getClass')->with('model')->willReturn('AppBundle\\Entity\\Book');\n\n        $this->entityManagerMock->expects($this->once())->method('getClassMetadata')->with('AppBundle\\Entity\\Book')->willReturn($this->classMetadataMock);\n\n        $this->classMetadataMock->fieldNames = ['name', 'description', 'enabled', 'publishedAt'];\n        $this->classMetadataMock->expects($this->once())->method('isIdentifierNatural')->willReturn(true);\n        $this->classMetadataMock->expects($this->once())->method('getAssociationMappings')->willReturn([\n            'category' => ['type' => ClassMetadata::MANY_TO_ONE],\n            'users' => ['type' => ClassMetadata::ONE_TO_MANY],\n        ]);\n        $this->classMetadataMock\n            ->expects($this->exactly(4))\n            ->method('getTypeOfField')\n            ->willReturnMap([\n                ['name', Types::STRING],\n                ['description', Types::TEXT],\n                ['enabled', Types::BOOLEAN],\n                ['publishedAt', Types::DATETIME_MUTABLE],\n            ])\n        ;\n\n        $this->formBuilderMock\n            ->expects($this->exactly(5))\n            ->method('add')\n            ->willReturnMap([\n                ['name', null, [], $this->formBuilderMock],\n                ['description', null, [], $this->formBuilderMock],\n                ['enabled', null, [], $this->formBuilderMock],\n                ['publishedAt', null, ['widget' => 'single_text'], $this->formBuilderMock],\n                ['category', null, ['choice_label' => 'id'], $this->formBuilderMock],\n            ])\n        ;\n\n        $this->defaultFormBuilder->build($this->metadataMock, $this->formBuilderMock, []);\n    }\n\n    public function testExcludesCommonFieldsLikeCreatedAtAndUpdatedAt(): void\n    {\n        $this->metadataMock->expects($this->once())->method('getClass')->with('model')->willReturn('AppBundle\\Entity\\Book');\n\n        $this->entityManagerMock->expects($this->once())->method('getClassMetadata')->with('AppBundle\\Entity\\Book')->willReturn($this->classMetadataMock);\n\n        $this->classMetadataMock->fieldNames = ['name', 'description', 'enabled', 'createdAt', 'updatedAt'];\n        $this->classMetadataMock->expects($this->once())->method('isIdentifierNatural')->willReturn(true);\n        $this->classMetadataMock->expects($this->once())->method('getAssociationMappings')->willReturn([]);\n        $this->classMetadataMock\n            ->expects($this->exactly(3))\n            ->method('getTypeOfField')\n            ->willReturnMap([\n                ['name', Types::STRING],\n                ['description', Types::TEXT],\n                ['enabled', Types::BOOLEAN],\n                ['createdAt', Types::DATETIME_MUTABLE],\n                ['updatedAt', Types::DATETIME_MUTABLE],\n            ])\n        ;\n\n        $this->formBuilderMock\n            ->expects($this->exactly(3))\n            ->method('add')\n            ->willReturnMap([\n                ['name', null, [], $this->formBuilderMock],\n                ['description', null, [], $this->formBuilderMock],\n                ['enabled', null, [], $this->formBuilderMock],\n            ])\n        ;\n\n        $this->defaultFormBuilder->build($this->metadataMock, $this->formBuilderMock, []);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Event/ResourceControllerEventTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Bundle\\Event;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Event\\ResourceControllerEvent;\nuse Sylius\\Resource\\Symfony\\EventDispatcher\\GenericEvent;\nuse Symfony\\Component\\HttpFoundation\\Response;\n\nfinal class ResourceControllerEventTest extends TestCase\n{\n    private ResourceControllerEvent $event;\n\n    protected function setUp(): void\n    {\n        $this->event = new ResourceControllerEvent();\n        $this->event->setMessage('message');\n    }\n\n    public function testItHasEmptyMessageByDefault(): void\n    {\n        $event = new ResourceControllerEvent();\n\n        $this->assertSame('', $event->getMessage());\n    }\n\n    public function testItCanSetAndGetMessage(): void\n    {\n        $this->event->setMessage('custom_message');\n\n        $this->assertSame('custom_message', $this->event->getMessage());\n    }\n\n    public function testItHasEmptyMessageTypeByDefault(): void\n    {\n        $this->assertSame('', $this->event->getMessageType());\n    }\n\n    public function testItCanSetAndGetMessageType(): void\n    {\n        $this->event->setMessageType(GenericEvent::TYPE_SUCCESS);\n\n        $this->assertSame(GenericEvent::TYPE_SUCCESS, $this->event->getMessageType());\n    }\n\n    public function testItHasEmptyMessageParametersByDefault(): void\n    {\n        $this->assertSame([], $this->event->getMessageParameters());\n    }\n\n    public function testItCanSetAndGetMessageParameters(): void\n    {\n        $this->event->setMessageParameters(['parameter_1', 'parameter_2']);\n\n        $this->assertSame(['parameter_1', 'parameter_2'], $this->event->getMessageParameters());\n    }\n\n    public function testItIsNotStoppedByDefault(): void\n    {\n        $this->assertFalse($this->event->isStopped());\n    }\n\n    public function testItCanBeStopped(): void\n    {\n        $this->event->stop('error_message');\n\n        $this->assertTrue($this->event->isStopped());\n    }\n\n    public function testItStopsPropagationWhenStopped(): void\n    {\n        $this->event->stop('error_message', GenericEvent::TYPE_SUCCESS, ['parameter']);\n\n        $this->assertTrue($this->event->isPropagationStopped());\n        $this->assertSame('error_message', $this->event->getMessage());\n        $this->assertSame(GenericEvent::TYPE_SUCCESS, $this->event->getMessageType());\n        $this->assertSame(['parameter'], $this->event->getMessageParameters());\n    }\n\n    public function testItDoesNotHaveResponseByDefault(): void\n    {\n        $this->assertFalse($this->event->hasResponse());\n    }\n\n    public function testItCanSetAndGetResponse(): void\n    {\n        $response = new Response();\n\n        $this->event->setResponse($response);\n\n        $this->assertSame($response, $this->event->getResponse());\n        $this->assertTrue($this->event->hasResponse());\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/EventListener/AbstractDoctrineListenerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Bundle\\EventListener;\n\nuse App\\Entity\\Book;\nuse App\\Entity\\User;\nuse Doctrine\\ORM\\EntityManagerInterface;\nuse Doctrine\\Persistence\\Mapping\\ClassMetadata;\nuse Doctrine\\Persistence\\Mapping\\ReflectionService;\nuse Doctrine\\Persistence\\Mapping\\RuntimeReflectionService;\nuse Sylius\\Bundle\\ResourceBundle\\EventListener\\AbstractDoctrineListener;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase;\n\nfinal class AbstractDoctrineListenerTest extends KernelTestCase\n{\n    private EntityManagerInterface $entityManager;\n\n    private AbstractDoctrineListener $listener;\n\n    protected function setUp(): void\n    {\n        self::bootKernel();\n        $this->entityManager = $this->getContainer()->get(EntityManagerInterface::class);\n\n        $resourceRegistry = $this->getContainer()->get(RegistryInterface::class);\n        $this->listener = new class($resourceRegistry) extends AbstractDoctrineListener {\n            public function publicIsResource(ClassMetadata $metadata): bool\n            {\n                return $this->isResource($metadata);\n            }\n\n            public function publicGetReflectionService(): \\Doctrine\\Persistence\\Mapping\\ReflectionService\n            {\n                return $this->getReflectionService();\n            }\n        };\n    }\n\n    public function testIsResourceReturnsTrueForResourceInterface(): void\n    {\n        $metadata = $this->getClassMetadata(Book::class);\n\n        $result = $this->listener->publicIsResource($metadata);\n\n        $this->assertTrue($result);\n    }\n\n    public function testGetReflectionServiceReturnsRuntimeReflectionService(): void\n    {\n        $reflectionService = $this->listener->publicGetReflectionService();\n\n        $this->assertInstanceOf(RuntimeReflectionService::class, $reflectionService);\n    }\n\n    public function testGetReflectionServiceReturnsSameInstanceOnMultipleCalls(): void\n    {\n        $firstCall = $this->listener->publicGetReflectionService();\n        $secondCall = $this->listener->publicGetReflectionService();\n\n        $this->assertSame($firstCall, $secondCall);\n    }\n\n    public function testConstructorAcceptsResourceRegistry(): void\n    {\n        $resourceRegistry = $this->getContainer()->get(RegistryInterface::class);\n        $listener = new class($resourceRegistry) extends AbstractDoctrineListener {\n        };\n\n        $this->assertInstanceOf(AbstractDoctrineListener::class, $listener);\n    }\n\n    public function testIsResourceWorksWithDifferentEntities(): void\n    {\n        $bookMetadata = $this->getClassMetadata(Book::class);\n        $userMetadata = $this->getClassMetadata(User::class);\n\n        $this->assertTrue($this->listener->publicIsResource($bookMetadata));\n        $this->assertTrue($this->listener->publicIsResource($userMetadata));\n    }\n\n    public function testReflectionServiceImplementsCorrectInterface(): void\n    {\n        $reflectionService = $this->listener->publicGetReflectionService();\n\n        $this->assertInstanceOf(ReflectionService::class, $reflectionService);\n    }\n\n    public function testReflectionServiceIsLazilyInitialized(): void\n    {\n        $resourceRegistry = $this->getContainer()->get(RegistryInterface::class);\n        $newListener = new class($resourceRegistry) extends AbstractDoctrineListener {\n            public function hasReflectionService(): bool\n            {\n                return $this->getReflectionService() instanceof RuntimeReflectionService;\n            }\n        };\n\n        $this->assertTrue($newListener->hasReflectionService());\n    }\n\n    private function getClassMetadata(string $className): ClassMetadata\n    {\n        return $this->entityManager->getClassMetadata($className);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/EventListener/ODMRepositoryClassSubscriberTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Bundle\\EventListener;\n\nuse Doctrine\\Common\\EventSubscriber;\nuse Doctrine\\ODM\\MongoDB\\DocumentManager;\nuse Doctrine\\ODM\\MongoDB\\Event\\LoadClassMetadataEventArgs;\nuse Doctrine\\ODM\\MongoDB\\Events;\nuse Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\EventListener\\ODMRepositoryClassSubscriber;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\n\nfinal class ODMRepositoryClassSubscriberTest extends TestCase\n{\n    /** @var RegistryInterface&MockObject */\n    private RegistryInterface $registry;\n\n    private ODMRepositoryClassSubscriber $subscriber;\n\n    protected function setUp(): void\n    {\n        if (!class_exists(Events::class)) {\n            $this->markTestSkipped('Doctrine MongoDB ODM is not installed.');\n        }\n\n        $this->registry = $this->createMock(RegistryInterface::class);\n        $this->subscriber = new ODMRepositoryClassSubscriber($this->registry);\n    }\n\n    public function testItImplementsEventSubscriberInterface(): void\n    {\n        $this->assertInstanceOf(EventSubscriber::class, $this->subscriber);\n    }\n\n    public function testItSubscribesToLoadClassMetadataEvent(): void\n    {\n        $this->assertSame([Events::loadClassMetadata], $this->subscriber->getSubscribedEvents());\n    }\n\n    public function testItSetsCustomRepositoryClassWhenConfigured(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $metadata\n            ->expects($this->once())\n            ->method('hasClass')\n            ->with('repository')\n            ->willReturn(true);\n        $metadata\n            ->expects($this->once())\n            ->method('getClass')\n            ->with('repository')\n            ->willReturn('FooRepository');\n\n        $this->registry\n            ->expects($this->once())\n            ->method('getByClass')\n            ->with('Foo')\n            ->willReturn($metadata);\n\n        $classMetadata = $this->createMock(ClassMetadata::class);\n        $classMetadata\n            ->expects($this->once())\n            ->method('getName')\n            ->willReturn('Foo');\n        $classMetadata\n            ->expects($this->once())\n            ->method('setCustomRepositoryClass')\n            ->with('FooRepository');\n\n        $documentManager = $this->createMock(DocumentManager::class);\n        $event = new LoadClassMetadataEventArgs($classMetadata, $documentManager);\n\n        $this->subscriber->loadClassMetadata($event);\n    }\n\n    public function testItDoesNotSetCustomRepositoryClassWhenNotConfigured(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $metadata\n            ->expects($this->once())\n            ->method('hasClass')\n            ->with('repository')\n            ->willReturn(false);\n\n        $this->registry\n            ->expects($this->once())\n            ->method('getByClass')\n            ->with('Foo')\n            ->willReturn($metadata);\n\n        $classMetadata = $this->createMock(ClassMetadata::class);\n        $classMetadata\n            ->expects($this->once())\n            ->method('getName')\n            ->willReturn('Foo');\n        $classMetadata\n            ->expects($this->never())\n            ->method('setCustomRepositoryClass');\n\n        $documentManager = $this->createMock(DocumentManager::class);\n        $event = new LoadClassMetadataEventArgs($classMetadata, $documentManager);\n\n        $this->subscriber->loadClassMetadata($event);\n    }\n\n    public function testItDoesNotSetCustomRepositoryClassWhenClassNotInRegistry(): void\n    {\n        $this->registry\n            ->expects($this->once())\n            ->method('getByClass')\n            ->with('Foo')\n            ->willThrowException(new \\InvalidArgumentException());\n\n        $classMetadata = $this->createMock(ClassMetadata::class);\n        $classMetadata\n            ->expects($this->once())\n            ->method('getName')\n            ->willReturn('Foo');\n        $classMetadata\n            ->expects($this->never())\n            ->method('setCustomRepositoryClass');\n\n        $documentManager = $this->createMock(DocumentManager::class);\n        $event = new LoadClassMetadataEventArgs($classMetadata, $documentManager);\n\n        $this->subscriber->loadClassMetadata($event);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/EventListener/ORMMappedSuperClassSubscriberTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Bundle\\EventListener;\n\nuse Doctrine\\ORM\\Configuration;\nuse Doctrine\\ORM\\EntityManagerInterface;\nuse Doctrine\\ORM\\Event\\LoadClassMetadataEventArgs;\nuse Doctrine\\ORM\\Mapping\\ClassMetadata;\nuse Doctrine\\ORM\\Mapping\\DefaultNamingStrategy;\nuse Doctrine\\Persistence\\Mapping\\ClassMetadata as ClassMetadataInterface;\nuse Doctrine\\Persistence\\Mapping\\Driver\\MappingDriver;\nuse Doctrine\\Persistence\\Mapping\\RuntimeReflectionService;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\EventListener\\ORMMappedSuperClassSubscriber;\nuse Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures\\ChildEntity;\nuse Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures\\ParentEntity;\nuse Sylius\\Resource\\Metadata\\Registry;\n\nfinal class ORMMappedSuperClassSubscriberTest extends TestCase\n{\n    public function testItUpdatesSourceEntityWhenCopyingParentAssociationMappings(): void\n    {\n        $subscriber = new ORMMappedSuperClassSubscriber(new Registry());\n\n        $namingStrategy = new DefaultNamingStrategy();\n\n        $childMetadata = new ClassMetadata(ChildEntity::class, $namingStrategy);\n        $childMetadata->wakeupReflection(new RuntimeReflectionService());\n\n        $configuration = new Configuration();\n        $configuration->setNamingStrategy($namingStrategy);\n        $configuration->setMetadataDriverImpl(new class() implements MappingDriver {\n            /** @param ClassMetadata $metadata */\n            public function loadMetadataForClass(string $className, ClassMetadataInterface $metadata): void\n            {\n                if ($className !== ParentEntity::class) {\n                    return;\n                }\n\n                $metadata->isMappedSuperclass = true;\n                $metadata->mapOneToOne([\n                    'fieldName' => 'relatedEntity',\n                    'targetEntity' => ParentEntity::class,\n                    'joinColumns' => [['name' => 'related_entity_id', 'referencedColumnName' => 'id']],\n                ]);\n            }\n\n            /** @return list<string> */\n            public function getAllClassNames(): array\n            {\n                return [ParentEntity::class];\n            }\n\n            public function isTransient(string $className): bool\n            {\n                return false;\n            }\n        });\n\n        $em = $this->createMock(EntityManagerInterface::class);\n        $em->method('getConfiguration')->willReturn($configuration);\n\n        $event = new LoadClassMetadataEventArgs($childMetadata, $em);\n        $subscriber->loadClassMetadata($event);\n\n        self::assertArrayHasKey('relatedEntity', $childMetadata->associationMappings);\n\n        $association = $childMetadata->associationMappings['relatedEntity'];\n        $sourceEntity = \\is_array($association) ? $association['sourceEntity'] : $association->sourceEntity;\n\n        self::assertSame(ChildEntity::class, $sourceEntity);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/EventListener/ORMRepositoryClassSubscriberTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Bundle\\EventListener;\n\nuse Doctrine\\Common\\EventSubscriber;\nuse Doctrine\\ORM\\Event\\LoadClassMetadataEventArgs;\nuse Doctrine\\ORM\\Events;\nuse Doctrine\\ORM\\Mapping\\ClassMetadata;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\EventListener\\ORMRepositoryClassSubscriber;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\n\nfinal class ORMRepositoryClassSubscriberTest extends TestCase\n{\n    /** @var RegistryInterface&\\PHPUnit\\Framework\\MockObject\\MockObject */\n    private RegistryInterface $registry;\n\n    private ORMRepositoryClassSubscriber $subscriber;\n\n    protected function setUp(): void\n    {\n        $this->registry = $this->createMock(RegistryInterface::class);\n        $this->subscriber = new ORMRepositoryClassSubscriber($this->registry);\n    }\n\n    public function testItImplementsEventSubscriberInterface(): void\n    {\n        $this->assertInstanceOf(EventSubscriber::class, $this->subscriber);\n    }\n\n    public function testItSubscribesToLoadClassMetadataEvent(): void\n    {\n        $this->assertSame([Events::loadClassMetadata], $this->subscriber->getSubscribedEvents());\n    }\n\n    public function testItSetsCustomRepositoryClassWhenConfigured(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $metadata\n            ->expects($this->once())\n            ->method('hasClass')\n            ->with('repository')\n            ->willReturn(true);\n        $metadata\n            ->expects($this->once())\n            ->method('getClass')\n            ->with('repository')\n            ->willReturn('FooRepository');\n\n        $this->registry\n            ->expects($this->once())\n            ->method('getByClass')\n            ->with('Foo')\n            ->willReturn($metadata);\n\n        $classMetadata = $this->createMock(ClassMetadata::class);\n        $classMetadata\n            ->expects($this->once())\n            ->method('getName')\n            ->willReturn('Foo');\n        $classMetadata\n            ->expects($this->once())\n            ->method('setCustomRepositoryClass')\n            ->with('FooRepository');\n\n        $event = $this->createMock(LoadClassMetadataEventArgs::class);\n        $event\n            ->expects($this->once())\n            ->method('getClassMetadata')\n            ->willReturn($classMetadata);\n\n        $this->subscriber->loadClassMetadata($event);\n    }\n\n    public function testItDoesNotSetCustomRepositoryClassWhenNotConfigured(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $metadata\n            ->expects($this->once())\n            ->method('hasClass')\n            ->with('repository')\n            ->willReturn(false);\n\n        $this->registry\n            ->expects($this->once())\n            ->method('getByClass')\n            ->with('Foo')\n            ->willReturn($metadata);\n\n        $classMetadata = $this->createMock(ClassMetadata::class);\n        $classMetadata\n            ->expects($this->once())\n            ->method('getName')\n            ->willReturn('Foo');\n        $classMetadata\n            ->expects($this->never())\n            ->method('setCustomRepositoryClass');\n\n        $event = $this->createMock(LoadClassMetadataEventArgs::class);\n        $event\n            ->expects($this->once())\n            ->method('getClassMetadata')\n            ->willReturn($classMetadata);\n\n        $this->subscriber->loadClassMetadata($event);\n    }\n\n    public function testItDoesNotSetCustomRepositoryClassWhenClassNotInRegistry(): void\n    {\n        $this->registry\n            ->expects($this->once())\n            ->method('getByClass')\n            ->with('Foo')\n            ->willThrowException(new \\InvalidArgumentException());\n\n        $classMetadata = $this->createMock(ClassMetadata::class);\n        $classMetadata\n            ->expects($this->once())\n            ->method('getName')\n            ->willReturn('Foo');\n        $classMetadata\n            ->expects($this->never())\n            ->method('setCustomRepositoryClass');\n\n        $event = $this->createMock(LoadClassMetadataEventArgs::class);\n        $event\n            ->expects($this->once())\n            ->method('getClassMetadata')\n            ->willReturn($classMetadata);\n\n        $this->subscriber->loadClassMetadata($event);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/EventListener/ORMTranslatableListenerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Bundle\\EventListener;\n\nuse App\\Entity\\BookTranslationInterface;\nuse Doctrine\\ORM\\EntityManagerInterface;\nuse Doctrine\\ORM\\EntityRepository;\nuse Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase;\n\nfinal class ORMTranslatableListenerTest extends KernelTestCase\n{\n    public function testGettingTranslationRepositoryByItsInterface(): void\n    {\n        self::bootKernel();\n\n        $this->assertInstanceOf(\n            EntityRepository::class,\n            $this->getEntityManager()->getRepository(BookTranslationInterface::class),\n        );\n    }\n\n    private function getEntityManager(): EntityManagerInterface\n    {\n        return $this->getContainer()->get(EntityManagerInterface::class);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/ExpressionLanguage/ExpressionLanguageTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\ExpressionLanguage;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Psr\\Cache\\CacheItemPoolInterface;\nuse Sylius\\Bundle\\ResourceBundle\\ExpressionLanguage\\ExpressionLanguage;\nuse Symfony\\Component\\ExpressionLanguage\\ExpressionFunctionProviderInterface;\n\nfinal class ExpressionLanguageTest extends TestCase\n{\n    public function testItCanBeInstantiatedWithoutCache(): void\n    {\n        $expressionLanguage = new ExpressionLanguage();\n\n        $this->assertInstanceOf(ExpressionLanguage::class, $expressionLanguage);\n    }\n\n    public function testItCanBeInstantiatedWithCacheItemPool(): void\n    {\n        $cache = $this->createMock(CacheItemPoolInterface::class);\n\n        $expressionLanguage = new ExpressionLanguage($cache);\n\n        $this->assertInstanceOf(ExpressionLanguage::class, $expressionLanguage);\n    }\n\n    public function testItCanBeInstantiatedWithProviders(): void\n    {\n        $provider = $this->createMock(ExpressionFunctionProviderInterface::class);\n        $provider->method('getFunctions')->willReturn([]);\n\n        $expressionLanguage = new ExpressionLanguage(null, [$provider]);\n\n        $this->assertInstanceOf(ExpressionLanguage::class, $expressionLanguage);\n    }\n\n    public function testItThrowsExceptionForInvalidCacheType(): void\n    {\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage('Cache argument has to implement Psr\\Cache\\CacheItemPoolInterface');\n\n        new ExpressionLanguage('invalid');\n    }\n\n    public function testItRegistersNotNullExpressionFunctionProvider(): void\n    {\n        $expressionLanguage = new ExpressionLanguage();\n\n        $result = $expressionLanguage->evaluate('notFoundOnNull(value)', ['value' => 'test']);\n\n        $this->assertSame('test', $result);\n    }\n\n    public function testItCompilesExpressionsWithNotFoundOnNullFunction(): void\n    {\n        $expressionLanguage = new ExpressionLanguage();\n\n        $compiled = $expressionLanguage->compile('notFoundOnNull(value)', ['value']);\n\n        $this->assertStringContainsString('null !== ', $compiled);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/ExpressionLanguage/NotNullExpressionFunctionProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\ExpressionLanguage;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\ExpressionLanguage\\NotNullExpressionFunctionProvider;\nuse Symfony\\Component\\ExpressionLanguage\\ExpressionFunction;\nuse Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException;\n\nfinal class NotNullExpressionFunctionProviderTest extends TestCase\n{\n    private NotNullExpressionFunctionProvider $provider;\n\n    protected function setUp(): void\n    {\n        $this->provider = new NotNullExpressionFunctionProvider();\n    }\n\n    public function testItProvidesExpressionFunctions(): void\n    {\n        $functions = $this->provider->getFunctions();\n\n        $this->assertIsArray($functions);\n        $this->assertCount(1, $functions);\n        $this->assertInstanceOf(ExpressionFunction::class, $functions[0]);\n    }\n\n    public function testItProvidesNotFoundOnNullFunction(): void\n    {\n        $functions = $this->provider->getFunctions();\n\n        $this->assertSame('notFoundOnNull', $functions[0]->getName());\n    }\n\n    public function testItReturnsValueWhenNotNull(): void\n    {\n        $functions = $this->provider->getFunctions();\n        $evaluator = $functions[0]->getEvaluator();\n\n        $result = $evaluator([], 'some value');\n\n        $this->assertSame('some value', $result);\n    }\n\n    public function testItThrowsNotFoundExceptionWhenNull(): void\n    {\n        $functions = $this->provider->getFunctions();\n        $evaluator = $functions[0]->getEvaluator();\n\n        $this->expectException(NotFoundHttpException::class);\n        $this->expectExceptionMessage('Requested page is invalid.');\n\n        $evaluator([], null);\n    }\n\n    public function testItCompilesExpressionCorrectly(): void\n    {\n        $functions = $this->provider->getFunctions();\n        $compiler = $functions[0]->getCompiler();\n\n        $compiled = $compiler('$result');\n\n        $this->assertStringContainsString('null !== $result', $compiled);\n        $this->assertStringContainsString('$result', $compiled);\n        $this->assertStringContainsString('throw new NotFoundHttpException', $compiled);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Fixtures/AnimalInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures;\n\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\ninterface AnimalInterface extends ResourceInterface\n{\n}\n"
  },
  {
    "path": "tests/Bundle/Fixtures/Bear.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures;\n\nfinal class Bear implements BearInterface\n{\n    public function getId(): int\n    {\n        return 42;\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Fixtures/BearInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures;\n\ninterface BearInterface extends MammalInterface\n{\n}\n"
  },
  {
    "path": "tests/Bundle/Fixtures/ChildEntity.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures;\n\nclass ChildEntity extends ParentEntity\n{\n}\n"
  },
  {
    "path": "tests/Bundle/Fixtures/Fly.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures;\n\nfinal class Fly implements FlyInterface\n{\n    public function getId(): int\n    {\n        return 42;\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Fixtures/FlyInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures;\n\ninterface FlyInterface extends AnimalInterface\n{\n}\n"
  },
  {
    "path": "tests/Bundle/Fixtures/MammalInterface.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures;\n\ninterface MammalInterface extends AnimalInterface\n{\n}\n"
  },
  {
    "path": "tests/Bundle/Fixtures/ParentEntity.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures;\n\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\nclass ParentEntity implements ResourceInterface\n{\n    private ?int $id = null;\n\n    private ?object $relatedEntity = null;\n\n    public function getId(): ?int\n    {\n        return $this->id;\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Fixtures/Resource.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Fixtures;\n\nuse Sylius\\Resource\\Model\\ResourceInterface;\n\nfinal class Resource implements ResourceInterface\n{\n    public function getId()\n    {\n        return 42;\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Form/DataTransformer/CollectionToStringTransformerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Form\\DataTransformer;\n\nuse Doctrine\\Common\\Collections\\ArrayCollection;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\DataTransformer\\CollectionToStringTransformer;\nuse Symfony\\Component\\Form\\DataTransformerInterface;\nuse Symfony\\Component\\Form\\Exception\\TransformationFailedException;\n\nfinal class CollectionToStringTransformerTest extends TestCase\n{\n    private CollectionToStringTransformer $transformer;\n\n    protected function setUp(): void\n    {\n        $this->transformer = new CollectionToStringTransformer(',');\n    }\n\n    public function testImplementsDataTransformerInterface(): void\n    {\n        self::assertInstanceOf(DataTransformerInterface::class, $this->transformer);\n    }\n\n    public function testTransformsCollectionToString(): void\n    {\n        $collection = new ArrayCollection(['abc', 'def', 'ghi', 'jkl']);\n\n        $result = $this->transformer->transform($collection);\n\n        self::assertSame('abc,def,ghi,jkl', $result);\n    }\n\n    public function testTransformsEmptyCollectionToEmptyString(): void\n    {\n        $result = $this->transformer->transform(new ArrayCollection());\n\n        self::assertSame('', $result);\n    }\n\n    public function testTransformsStringToCollection(): void\n    {\n        $result = $this->transformer->reverseTransform('abc,def,ghi,jkl');\n\n        self::assertEquals(new ArrayCollection(['abc', 'def', 'ghi', 'jkl']), $result);\n    }\n\n    public function testTransformsEmptyStringToEmptyCollection(): void\n    {\n        $result = $this->transformer->reverseTransform('');\n\n        self::assertEquals(new ArrayCollection(), $result);\n    }\n\n    public function testTransformsCollectionWithSingleElement(): void\n    {\n        $result = $this->transformer->transform(new ArrayCollection(['single']));\n\n        self::assertSame('single', $result);\n    }\n\n    public function testReverseTransformsSingleValue(): void\n    {\n        $result = $this->transformer->reverseTransform('single');\n\n        self::assertEquals(new ArrayCollection(['single']), $result);\n    }\n\n    public function testThrowsExceptionWhenTransformingNonCollection(): void\n    {\n        self::expectException(TransformationFailedException::class);\n        self::expectExceptionMessage('Expected \"Doctrine\\Common\\Collections\\Collection\", but got \"stdClass\"');\n\n        $this->transformer->transform(new \\stdClass());\n    }\n\n    public function testThrowsExceptionWhenReverseTransformingNonString(): void\n    {\n        self::expectException(TransformationFailedException::class);\n        self::expectExceptionMessage('Expected string, but got \"stdClass\"');\n\n        $this->transformer->reverseTransform(new \\stdClass());\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Form/DataTransformer/RecursiveTransformerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Form\\DataTransformer;\n\nuse Doctrine\\Common\\Collections\\ArrayCollection;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\DataTransformer\\RecursiveTransformer;\nuse Symfony\\Component\\Form\\DataTransformerInterface;\nuse Symfony\\Component\\Form\\Exception\\TransformationFailedException;\n\nfinal class RecursiveTransformerTest extends TestCase\n{\n    /** @var DataTransformerInterface<string, string>&MockObject */\n    private DataTransformerInterface $decoratedTransformer;\n\n    private RecursiveTransformer $transformer;\n\n    protected function setUp(): void\n    {\n        $this->decoratedTransformer = $this->createMock(DataTransformerInterface::class);\n        $this->transformer = new RecursiveTransformer($this->decoratedTransformer);\n    }\n\n    public function testImplementsDataTransformerInterface(): void\n    {\n        self::assertInstanceOf(DataTransformerInterface::class, $this->transformer);\n    }\n\n    public function testReturnsEmptyCollectionWhenTransformingNull(): void\n    {\n        $this->decoratedTransformer\n            ->expects(self::never())\n            ->method('transform');\n\n        $result = $this->transformer->transform(null);\n\n        self::assertEquals(new ArrayCollection(), $result);\n    }\n\n    public function testReturnsEmptyCollectionWhenReverseTransformingNull(): void\n    {\n        $this->decoratedTransformer\n            ->expects(self::never())\n            ->method('reverseTransform');\n\n        $result = $this->transformer->reverseTransform(null);\n\n        self::assertEquals(new ArrayCollection(), $result);\n    }\n\n    public function testTransformsCollectionRecursively(): void\n    {\n        $this->decoratedTransformer\n            ->expects(self::exactly(3))\n            ->method('transform')\n            ->willReturnCallback(fn (string $value): string => strtolower($value));\n\n        $result = $this->transformer->transform(new ArrayCollection(['ABC', 'CDE', 'FGH']));\n\n        self::assertEquals(new ArrayCollection(['abc', 'cde', 'fgh']), $result);\n    }\n\n    public function testReverseTransformsCollectionRecursively(): void\n    {\n        $this->decoratedTransformer\n            ->expects(self::exactly(3))\n            ->method('reverseTransform')\n            ->willReturnCallback(fn (string $value): string => strtoupper($value));\n\n        $result = $this->transformer->reverseTransform(new ArrayCollection(['abc', 'cde', 'fgh']));\n\n        self::assertEquals(new ArrayCollection(['ABC', 'CDE', 'FGH']), $result);\n    }\n\n    public function testThrowsExceptionWhenTransformingNonCollection(): void\n    {\n        self::expectException(TransformationFailedException::class);\n        self::expectExceptionMessage('Expected \"Doctrine\\Common\\Collections\\Collection\", but got \"stdClass\"');\n\n        /** @phpstan-ignore argument.type */\n        $this->transformer->transform(new \\stdClass());\n    }\n\n    public function testThrowsExceptionWhenReverseTransformingNonCollection(): void\n    {\n        self::expectException(TransformationFailedException::class);\n        self::expectExceptionMessage('Expected \"Doctrine\\Common\\Collections\\Collection\", but got \"stdClass\"');\n\n        /** @phpstan-ignore argument.type */\n        $this->transformer->reverseTransform(new \\stdClass());\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Form/DataTransformer/ResourceToIdentifierTransformerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Form\\DataTransformer;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\DataTransformer\\ResourceToIdentifierTransformer;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\Form\\DataTransformerInterface;\nuse Symfony\\Component\\Form\\Exception\\TransformationFailedException;\n\nfinal class ResourceToIdentifierTransformerTest extends TestCase\n{\n    /** @var RepositoryInterface<ResourceInterface>&MockObject */\n    private RepositoryInterface $repository;\n\n    private ResourceToIdentifierTransformer $transformer;\n\n    protected function setUp(): void\n    {\n        $this->repository = $this->createMock(RepositoryInterface::class);\n        $this->transformer = new ResourceToIdentifierTransformer($this->repository, 'id');\n    }\n\n    public function testImplementsDataTransformerInterface(): void\n    {\n        self::assertInstanceOf(DataTransformerInterface::class, $this->transformer);\n    }\n\n    public function testTransformsNullValueToNull(): void\n    {\n        $result = $this->transformer->transform(null);\n\n        self::assertNull($result);\n    }\n\n    public function testTransformsResourceToIdentifier(): void\n    {\n        $resource = $this->createMock(ResourceInterface::class);\n        $resource\n            ->expects(self::once())\n            ->method('getId')\n            ->willReturn(6);\n\n        $this->repository\n            ->expects(self::once())\n            ->method('getClassName')\n            ->willReturn(ResourceInterface::class);\n\n        $result = $this->transformer->transform($resource);\n\n        self::assertSame(6, $result);\n    }\n\n    public function testReverseTransformsNullToNull(): void\n    {\n        $result = $this->transformer->reverseTransform(null);\n\n        self::assertNull($result);\n    }\n\n    public function testReverseTransformsIdentifierToResource(): void\n    {\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->repository\n            ->expects(self::once())\n            ->method('findOneBy')\n            ->with(['id' => 5])\n            ->willReturn($resource);\n\n        $result = $this->transformer->reverseTransform(5);\n\n        self::assertSame($resource, $result);\n    }\n\n    public function testThrowsExceptionWhenResourceDoesNotExist(): void\n    {\n        $this->repository\n            ->expects(self::once())\n            ->method('findOneBy')\n            ->with(['id' => 6])\n            ->willReturn(null);\n\n        $this->repository\n            ->expects(self::once())\n            ->method('getClassName')\n            ->willReturn(ResourceInterface::class);\n\n        self::expectException(TransformationFailedException::class);\n        self::expectExceptionMessage('Object \"Sylius\\Resource\\Model\\ResourceInterface\" with identifier \"id\"=\"6\" does not exist.');\n\n        $this->transformer->reverseTransform(6);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Form/EventSubscriber/AddCodeFormSubscriberTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Form\\EventSubscriber;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\EventSubscriber\\AddCodeFormSubscriber;\nuse Sylius\\Resource\\Exception\\UnexpectedTypeException;\nuse Sylius\\Resource\\Model\\CodeAwareInterface;\nuse Symfony\\Component\\EventDispatcher\\EventSubscriberInterface;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType;\nuse Symfony\\Component\\Form\\FormEvent;\nuse Symfony\\Component\\Form\\FormEvents;\nuse Symfony\\Component\\Form\\FormInterface;\n\nfinal class AddCodeFormSubscriberTest extends TestCase\n{\n    public function testImplementsEventSubscriberInterface(): void\n    {\n        $subscriber = new AddCodeFormSubscriber();\n\n        self::assertInstanceOf(EventSubscriberInterface::class, $subscriber);\n    }\n\n    public function testSubscribesToPreSetDataEvent(): void\n    {\n        $events = AddCodeFormSubscriber::getSubscribedEvents();\n\n        self::assertSame([FormEvents::PRE_SET_DATA => 'preSetData'], $events);\n    }\n\n    private function createFormEvent(mixed $data, FormInterface $form): FormEvent\n    {\n        $event = $this->createMock(FormEvent::class);\n        $event->method('getData')->willReturn($data);\n        $event->method('getForm')->willReturn($form);\n\n        return $event;\n    }\n\n    public function testAddsEnabledCodeFieldWhenResourceIsNew(): void\n    {\n        $subscriber = new AddCodeFormSubscriber();\n        $resource = $this->createMock(CodeAwareInterface::class);\n        $resource->method('getCode')->willReturn(null);\n\n        $form = $this->createMock(FormInterface::class);\n        $form\n            ->expects(self::once())\n            ->method('add')\n            ->with(\n                'code',\n                TextType::class,\n                self::callback(fn (array $options): bool => $options['disabled'] === false),\n            )\n            ->willReturn($form);\n\n        $subscriber->preSetData($this->createFormEvent($resource, $form));\n    }\n\n    public function testAddsDisabledCodeFieldWhenResourceHasCode(): void\n    {\n        $subscriber = new AddCodeFormSubscriber();\n        $resource = $this->createMock(CodeAwareInterface::class);\n        $resource->method('getCode')->willReturn('existing_code');\n\n        $form = $this->createMock(FormInterface::class);\n        $form\n            ->expects(self::once())\n            ->method('add')\n            ->with(\n                'code',\n                TextType::class,\n                self::callback(fn (array $options): bool => $options['disabled'] === true),\n            )\n            ->willReturn($form);\n\n        $subscriber->preSetData($this->createFormEvent($resource, $form));\n    }\n\n    public function testAddsEnabledCodeFieldWhenResourceIsNull(): void\n    {\n        $subscriber = new AddCodeFormSubscriber();\n        $form = $this->createMock(FormInterface::class);\n        $form\n            ->expects(self::once())\n            ->method('add')\n            ->with(\n                'code',\n                TextType::class,\n                self::callback(fn (array $options): bool => $options['disabled'] === false),\n            )\n            ->willReturn($form);\n\n        $subscriber->preSetData($this->createFormEvent(null, $form));\n    }\n\n    public function testThrowsExceptionWhenResourceDoesNotImplementCodeAwareInterface(): void\n    {\n        $subscriber = new AddCodeFormSubscriber();\n        $event = $this->createMock(FormEvent::class);\n        $event->method('getData')->willReturn(new \\stdClass());\n\n        self::expectException(UnexpectedTypeException::class);\n\n        $subscriber->preSetData($event);\n    }\n\n    public function testUsesCustomTypeAndOptions(): void\n    {\n        $subscriber = new AddCodeFormSubscriber(FormType::class, ['label' => 'custom.label']);\n        $resource = $this->createMock(CodeAwareInterface::class);\n        $resource->method('getCode')->willReturn('code');\n\n        $form = $this->createMock(FormInterface::class);\n        $form\n            ->expects(self::once())\n            ->method('add')\n            ->with(\n                'code',\n                FormType::class,\n                self::callback(function (array $options): bool {\n                    return $options['label'] === 'custom.label' &&\n                        $options['disabled'] === true;\n                }),\n            )\n            ->willReturn($form);\n\n        $subscriber->preSetData($this->createFormEvent($resource, $form));\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Form/Extension/CollectionTypeExtensionTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Form\\Extension;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Extension\\CollectionTypeExtension;\nuse Symfony\\Component\\Form\\AbstractTypeExtension;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\CollectionType;\nuse Symfony\\Component\\Form\\FormInterface;\nuse Symfony\\Component\\Form\\FormView;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolver;\n\nfinal class CollectionTypeExtensionTest extends TestCase\n{\n    private CollectionTypeExtension $extension;\n\n    protected function setUp(): void\n    {\n        $this->extension = new CollectionTypeExtension();\n    }\n\n    public function testExtendsAbstractTypeExtension(): void\n    {\n        self::assertInstanceOf(AbstractTypeExtension::class, $this->extension);\n    }\n\n    public function testGetExtendedType(): void\n    {\n        self::assertSame(CollectionType::class, $this->extension->getExtendedType());\n    }\n\n    public function testGetExtendedTypes(): void\n    {\n        self::assertSame([CollectionType::class], $this->extension->getExtendedTypes());\n    }\n\n    public function testConfigureOptionsWithDefaults(): void\n    {\n        $resolver = new OptionsResolver();\n\n        $this->extension->configureOptions($resolver);\n\n        $options = $resolver->resolve();\n\n        self::assertSame('sylius.form.collection.add', $options['button_add_label']);\n        self::assertSame('sylius.form.collection.delete', $options['button_delete_label']);\n    }\n\n    public function testConfigureOptionsWithCustomLabels(): void\n    {\n        $resolver = new OptionsResolver();\n\n        $this->extension->configureOptions($resolver);\n\n        $options = $resolver->resolve([\n            'button_add_label' => 'custom.add',\n            'button_delete_label' => 'custom.delete',\n        ]);\n\n        self::assertSame('custom.add', $options['button_add_label']);\n        self::assertSame('custom.delete', $options['button_delete_label']);\n    }\n\n    public function testBuildViewAddsButtonLabelsToViewVars(): void\n    {\n        $view = new FormView();\n        $form = $this->createMock(FormInterface::class);\n        $options = [\n            'button_add_label' => 'app.add_item',\n            'button_delete_label' => 'app.remove_item',\n        ];\n\n        $this->extension->buildView($view, $form, $options);\n\n        self::assertArrayHasKey('button_add_label', $view->vars);\n        self::assertArrayHasKey('button_delete_label', $view->vars);\n        self::assertSame('app.add_item', $view->vars['button_add_label']);\n        self::assertSame('app.remove_item', $view->vars['button_delete_label']);\n    }\n\n    public function testBuildViewAddsDefaultLabelsToViewVars(): void\n    {\n        $view = new FormView();\n        $form = $this->createMock(FormInterface::class);\n        $options = [\n            'button_add_label' => 'sylius.form.collection.add',\n            'button_delete_label' => 'sylius.form.collection.delete',\n        ];\n\n        $this->extension->buildView($view, $form, $options);\n\n        self::assertSame('sylius.form.collection.add', $view->vars['button_add_label']);\n        self::assertSame('sylius.form.collection.delete', $view->vars['button_delete_label']);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Form/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Form\\Extension\\HttpFoundation;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Extension\\HttpFoundation\\HttpFoundationRequestHandler;\nuse Symfony\\Component\\Form\\Exception\\UnexpectedTypeException;\nuse Symfony\\Component\\Form\\FormConfigInterface;\nuse Symfony\\Component\\Form\\FormInterface;\nuse Symfony\\Component\\Form\\RequestHandlerInterface;\nuse Symfony\\Component\\Form\\Util\\ServerParams;\nuse Symfony\\Component\\HttpFoundation\\File\\File;\nuse Symfony\\Component\\HttpFoundation\\File\\UploadedFile;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class HttpFoundationRequestHandlerTest extends TestCase\n{\n    private HttpFoundationRequestHandler $handler;\n\n    protected function setUp(): void\n    {\n        $this->handler = new HttpFoundationRequestHandler();\n    }\n\n    public function testImplementsRequestHandlerInterface(): void\n    {\n        self::assertInstanceOf(RequestHandlerInterface::class, $this->handler);\n    }\n\n    public function testThrowsExceptionWhenRequestIsNotHttpFoundationRequest(): void\n    {\n        $form = $this->createMock(FormInterface::class);\n\n        self::expectException(UnexpectedTypeException::class);\n\n        $this->handler->handleRequest($form, new \\stdClass());\n    }\n\n    public function testSubmitsGetRequestWithEmptyFormName(): void\n    {\n        $form = $this->createFormMock('');\n        $request = Request::create('/', 'GET', ['foo' => 'bar']);\n\n        $form\n            ->expects(self::once())\n            ->method('submit')\n            ->with(['foo' => 'bar'], true);\n\n        $this->handler->handleRequest($form, $request);\n    }\n\n    public function testDoesNotSubmitGetRequestWhenFormNameNotInQuery(): void\n    {\n        $form = $this->createFormMock('user');\n        $request = Request::create('/', 'GET', ['foo' => 'bar']);\n\n        $form\n            ->expects(self::never())\n            ->method('submit');\n\n        $this->handler->handleRequest($form, $request);\n    }\n\n    public function testSubmitsGetRequestWithFormNameInQuery(): void\n    {\n        $form = $this->createFormMock('user');\n        $request = Request::create('/', 'GET', ['user' => ['name' => 'John']]);\n\n        $form\n            ->expects(self::once())\n            ->method('submit')\n            ->with(['name' => 'John'], true);\n\n        $this->handler->handleRequest($form, $request);\n    }\n\n    public function testSubmitsPostRequestWithEmptyFormName(): void\n    {\n        $form = $this->createFormMock('');\n        $request = Request::create('/', 'POST', ['foo' => 'bar']);\n\n        $form\n            ->expects(self::once())\n            ->method('submit')\n            ->with(['foo' => 'bar'], true);\n\n        $this->handler->handleRequest($form, $request);\n    }\n\n    public function testDoesNotSubmitPostRequestWhenFormNameNotInRequest(): void\n    {\n        $form = $this->createFormMock('user');\n        $request = Request::create('/', 'POST', ['foo' => 'bar']);\n\n        $form\n            ->expects(self::never())\n            ->method('submit');\n\n        $this->handler->handleRequest($form, $request);\n    }\n\n    public function testSubmitsPostRequestWithFormNameInRequest(): void\n    {\n        $form = $this->createFormMock('user');\n        $request = Request::create('/', 'POST', ['user' => ['name' => 'John']]);\n\n        $form\n            ->expects(self::once())\n            ->method('submit')\n            ->with(['name' => 'John'], true);\n\n        $this->handler->handleRequest($form, $request);\n    }\n\n    public function testSubmitsPatchRequestWithoutClearingMissingFields(): void\n    {\n        $form = $this->createFormMock('user');\n        $request = Request::create('/', 'PATCH', ['user' => ['name' => 'John']]);\n\n        $form\n            ->expects(self::once())\n            ->method('submit')\n            ->with(['name' => 'John'], false);\n\n        $this->handler->handleRequest($form, $request);\n    }\n\n    public function testMergesFilesWithPostData(): void\n    {\n        $form = $this->createFormMock('user');\n        $file = new UploadedFile(__FILE__, 'test.php', null, null, true);\n\n        $request = Request::create('/', 'POST', ['user' => ['name' => 'John']], [], ['user' => ['avatar' => $file]]);\n\n        $form\n            ->expects(self::once())\n            ->method('submit')\n            ->with(['name' => 'John', 'avatar' => $file], true);\n\n        $this->handler->handleRequest($form, $request);\n    }\n\n    public function testHandlesPostMaxSizeExceeded(): void\n    {\n        $serverParams = $this->createMock(ServerParams::class);\n        $serverParams\n            ->expects(self::once())\n            ->method('hasPostMaxSizeBeenExceeded')\n            ->willReturn(true);\n\n        $serverParams\n            ->expects(self::once())\n            ->method('getNormalizedIniPostMaxSize')\n            ->willReturn('8M');\n\n        $handler = new HttpFoundationRequestHandler($serverParams);\n\n        $config = $this->createMock(FormConfigInterface::class);\n        $config\n            ->expects(self::once())\n            ->method('getOption')\n            ->with('upload_max_size_message')\n            ->willReturn(fn (): string => 'Upload size exceeded');\n\n        $form = $this->createMock(FormInterface::class);\n        $form->method('getName')->willReturn('user');\n        $form->method('getConfig')->willReturn($config);\n\n        $form\n            ->expects(self::once())\n            ->method('submit')\n            ->with(null, false);\n\n        $form\n            ->expects(self::once())\n            ->method('addError')\n            ->with(self::callback(function ($error): bool {\n                return $error->getMessage() === 'Upload size exceeded';\n            }));\n\n        $request = Request::create('/', 'POST', ['user' => ['name' => 'John']]);\n\n        $handler->handleRequest($form, $request);\n    }\n\n    public function testIsFileUploadReturnsTrueForFileInstance(): void\n    {\n        $file = $this->createMock(File::class);\n\n        self::assertTrue($this->handler->isFileUpload($file));\n    }\n\n    public function testIsFileUploadReturnsFalseForNonFileInstance(): void\n    {\n        self::assertFalse($this->handler->isFileUpload('string'));\n        self::assertFalse($this->handler->isFileUpload(123));\n        self::assertFalse($this->handler->isFileUpload([]));\n        self::assertFalse($this->handler->isFileUpload(null));\n    }\n\n    public function testHandlesHeadRequest(): void\n    {\n        $form = $this->createFormMock('user');\n        $request = Request::create('/', 'HEAD', ['user' => ['name' => 'John']]);\n\n        $form\n            ->expects(self::once())\n            ->method('submit')\n            ->with(['name' => 'John'], true);\n\n        $this->handler->handleRequest($form, $request);\n    }\n\n    public function testHandlesTraceRequest(): void\n    {\n        $form = $this->createFormMock('user');\n        $request = Request::create('/', 'TRACE', ['user' => ['name' => 'John']]);\n\n        $form\n            ->expects(self::once())\n            ->method('submit')\n            ->with(['name' => 'John'], true);\n\n        $this->handler->handleRequest($form, $request);\n    }\n\n    /** @return FormInterface&MockObject */\n    private function createFormMock(string $name): FormInterface\n    {\n        $config = $this->createMock(FormConfigInterface::class);\n        $config->method('getCompound')->willReturn(true);\n\n        $form = $this->createMock(FormInterface::class);\n        $form->method('getName')->willReturn($name);\n        $form->method('getConfig')->willReturn($config);\n\n        return $form;\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Form/Registry/FormTypeRegistryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Form\\Registry;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Registry\\FormTypeRegistry;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Registry\\FormTypeRegistryInterface;\n\nfinal class FormTypeRegistryTest extends TestCase\n{\n    private FormTypeRegistry $registry;\n\n    protected function setUp(): void\n    {\n        $this->registry = new FormTypeRegistry();\n    }\n\n    public function testImplementsFormTypeRegistryInterface(): void\n    {\n        self::assertInstanceOf(FormTypeRegistryInterface::class, $this->registry);\n    }\n\n    public function testAddsFormType(): void\n    {\n        $this->registry->add('app.product', 'default', 'App\\Form\\ProductType');\n\n        self::assertTrue($this->registry->has('app.product', 'default'));\n    }\n\n    public function testGetReturnsFormTypeWhenExists(): void\n    {\n        $this->registry->add('app.product', 'default', 'App\\Form\\ProductType');\n\n        self::assertSame('App\\Form\\ProductType', $this->registry->get('app.product', 'default'));\n    }\n\n    public function testGetReturnsNullWhenFormTypeDoesNotExist(): void\n    {\n        self::assertNull($this->registry->get('app.product', 'default'));\n    }\n\n    public function testHasReturnsFalseWhenFormTypeDoesNotExist(): void\n    {\n        self::assertFalse($this->registry->has('app.product', 'default'));\n    }\n\n    public function testHasReturnsTrueWhenFormTypeExists(): void\n    {\n        $this->registry->add('app.product', 'default', 'App\\Form\\ProductType');\n\n        self::assertTrue($this->registry->has('app.product', 'default'));\n    }\n\n    public function testSupportsMultipleIdentifiers(): void\n    {\n        $this->registry->add('app.product', 'default', 'App\\Form\\ProductType');\n        $this->registry->add('app.category', 'default', 'App\\Form\\CategoryType');\n\n        self::assertSame('App\\Form\\ProductType', $this->registry->get('app.product', 'default'));\n        self::assertSame('App\\Form\\CategoryType', $this->registry->get('app.category', 'default'));\n    }\n\n    public function testSupportsMultipleTypeIdentifiersForSameIdentifier(): void\n    {\n        $this->registry->add('app.product', 'default', 'App\\Form\\ProductType');\n        $this->registry->add('app.product', 'admin', 'App\\Form\\AdminProductType');\n\n        self::assertSame('App\\Form\\ProductType', $this->registry->get('app.product', 'default'));\n        self::assertSame('App\\Form\\AdminProductType', $this->registry->get('app.product', 'admin'));\n    }\n\n    public function testOverwritesFormTypeWhenAddingWithSameIdentifiers(): void\n    {\n        $this->registry->add('app.product', 'default', 'App\\Form\\ProductType');\n        $this->registry->add('app.product', 'default', 'App\\Form\\NewProductType');\n\n        self::assertSame('App\\Form\\NewProductType', $this->registry->get('app.product', 'default'));\n    }\n\n    public function testHasReturnsFalseForDifferentTypeIdentifier(): void\n    {\n        $this->registry->add('app.product', 'default', 'App\\Form\\ProductType');\n\n        self::assertFalse($this->registry->has('app.product', 'admin'));\n    }\n\n    public function testGetReturnsNullForDifferentTypeIdentifier(): void\n    {\n        $this->registry->add('app.product', 'default', 'App\\Form\\ProductType');\n\n        self::assertNull($this->registry->get('app.product', 'admin'));\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Form/Type/AbstractResourceTypeTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Form\\Type;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\AbstractResourceType;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolver;\n\nfinal class AbstractResourceTypeTest extends TestCase\n{\n    public function testExtendsAbstractType(): void\n    {\n        $formType = $this->createFormType('App\\Entity\\Product');\n\n        self::assertInstanceOf(AbstractType::class, $formType);\n    }\n\n    public function testConstructorSetsDataClass(): void\n    {\n        $formType = $this->createFormType('App\\Entity\\Product');\n        $resolver = new OptionsResolver();\n\n        $formType->configureOptions($resolver);\n\n        $options = $resolver->resolve();\n\n        self::assertSame('App\\Entity\\Product', $options['data_class']);\n    }\n\n    public function testConstructorSetsValidationGroups(): void\n    {\n        $formType = $this->createFormType('App\\Entity\\Product', ['Default', 'product_create']);\n        $resolver = new OptionsResolver();\n\n        $formType->configureOptions($resolver);\n\n        $options = $resolver->resolve();\n\n        self::assertSame(['Default', 'product_create'], $options['validation_groups']);\n    }\n\n    public function testConfigureOptionsWithDefaultValidationGroups(): void\n    {\n        $formType = $this->createFormType('App\\Entity\\Product');\n        $resolver = new OptionsResolver();\n\n        $formType->configureOptions($resolver);\n\n        $options = $resolver->resolve();\n\n        self::assertArrayHasKey('validation_groups', $options);\n        self::assertSame([], $options['validation_groups']);\n    }\n\n    public function testConfigureOptionsCanBeOverridden(): void\n    {\n        $formType = $this->createFormType('App\\Entity\\Product', ['Default']);\n        $resolver = new OptionsResolver();\n\n        $formType->configureOptions($resolver);\n\n        $options = $resolver->resolve([\n            'data_class' => 'App\\Entity\\Category',\n            'validation_groups' => ['custom'],\n        ]);\n\n        self::assertSame('App\\Entity\\Category', $options['data_class']);\n        self::assertSame(['custom'], $options['validation_groups']);\n    }\n\n    public function testConfigureOptionsWithMultipleValidationGroups(): void\n    {\n        $formType = $this->createFormType(\n            'App\\Entity\\Product',\n            ['Default', 'product_create', 'strict_validation'],\n        );\n        $resolver = new OptionsResolver();\n\n        $formType->configureOptions($resolver);\n\n        $options = $resolver->resolve();\n\n        self::assertSame(['Default', 'product_create', 'strict_validation'], $options['validation_groups']);\n    }\n\n    public function testConfigureOptionsSetsDataClassAsDefault(): void\n    {\n        $formType = $this->createFormType('App\\Entity\\Order');\n        $resolver = new OptionsResolver();\n\n        $formType->configureOptions($resolver);\n\n        $options = $resolver->resolve();\n\n        self::assertArrayHasKey('data_class', $options);\n        self::assertSame('App\\Entity\\Order', $options['data_class']);\n    }\n\n    /**\n     * @param string[] $validationGroups\n     */\n    private function createFormType(string $dataClass, array $validationGroups = []): AbstractResourceType\n    {\n        return new class($dataClass, $validationGroups) extends AbstractResourceType {\n        };\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Form/Type/ArchivableTypeTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Form\\Type;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\ArchivableType;\nuse Sylius\\Resource\\Model\\ArchivableInterface;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\DateTimeType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Symfony\\Component\\Form\\FormEvent;\nuse Symfony\\Component\\Form\\FormInterface;\n\nfinal class ArchivableTypeTest extends TestCase\n{\n    private ArchivableType $formType;\n\n    protected function setUp(): void\n    {\n        $this->formType = new ArchivableType();\n    }\n\n    public function testExtendsAbstractType(): void\n    {\n        self::assertInstanceOf(AbstractType::class, $this->formType);\n    }\n\n    public function testGetBlockPrefix(): void\n    {\n        self::assertSame('sylius_archivable', $this->formType->getBlockPrefix());\n    }\n\n    public function testBuildFormAddsArchivedAtField(): void\n    {\n        $builder = $this->createMock(FormBuilderInterface::class);\n        $builder\n            ->expects(self::once())\n            ->method('add')\n            ->with('archivedAt', DateTimeType::class)\n            ->willReturn($builder);\n\n        $builder\n            ->method('addEventListener')\n            ->willReturn($builder);\n\n        $this->formType->buildForm($builder, []);\n    }\n\n    public function testBuildFormAddsSubmitEventListener(): void\n    {\n        $builder = $this->createMock(FormBuilderInterface::class);\n        $builder\n            ->method('add')\n            ->willReturn($builder);\n\n        $builder\n            ->expects(self::once())\n            ->method('addEventListener')\n            ->with(\n                self::identicalTo('form.submit'),\n                self::callback(fn ($callback): bool => is_callable($callback)),\n            )\n            ->willReturn($builder);\n\n        $this->formType->buildForm($builder, []);\n    }\n\n    public function testEventListenerSetsArchivedAtWhenNull(): void\n    {\n        $archivable = $this->createMock(ArchivableInterface::class);\n        $archivable\n            ->expects(self::once())\n            ->method('getArchivedAt')\n            ->willReturn(null);\n\n        $archivable\n            ->expects(self::once())\n            ->method('setArchivedAt')\n            ->with(self::isInstanceOf(\\DateTime::class));\n\n        $listener = $this->captureEventListener();\n        $event = $this->createFormEvent($archivable);\n\n        $listener($event);\n    }\n\n    public function testEventListenerKeepsArchivedAtWhenAlreadySet(): void\n    {\n        $existingDate = new \\DateTime('2024-01-15 10:00:00');\n\n        $archivable = $this->createMock(ArchivableInterface::class);\n        $archivable\n            ->expects(self::once())\n            ->method('getArchivedAt')\n            ->willReturn($existingDate);\n\n        $archivable\n            ->expects(self::once())\n            ->method('setArchivedAt')\n            ->with(null);\n\n        $listener = $this->captureEventListener();\n        $event = $this->createFormEvent($archivable);\n\n        $listener($event);\n    }\n\n    public function testEventListenerSetsDataOnEvent(): void\n    {\n        $archivable = $this->createMock(ArchivableInterface::class);\n        $archivable\n            ->method('getArchivedAt')\n            ->willReturn(null);\n\n        $listener = $this->captureEventListener();\n        $event = $this->createFormEvent($archivable);\n\n        $event\n            ->expects(self::once())\n            ->method('setData')\n            ->with($archivable);\n\n        $listener($event);\n    }\n\n    private function captureEventListener(): callable\n    {\n        $listener = null;\n\n        $builder = $this->createMock(FormBuilderInterface::class);\n        $builder\n            ->method('add')\n            ->willReturn($builder);\n\n        $builder\n            ->expects(self::once())\n            ->method('addEventListener')\n            ->willReturnCallback(function ($eventName, $callback) use (&$listener, $builder) {\n                $listener = $callback;\n\n                return $builder;\n            });\n\n        $this->formType->buildForm($builder, []);\n\n        return $listener;\n    }\n\n    /** @return FormEvent&MockObject */\n    private function createFormEvent(ArchivableInterface $archivable): FormEvent\n    {\n        $form = $this->createMock(FormInterface::class);\n\n        $event = $this->createMock(FormEvent::class);\n        $event\n            ->method('getData')\n            ->willReturn($archivable);\n        $event\n            ->method('getForm')\n            ->willReturn($form);\n\n        return $event;\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Form/Type/DefaultResourceTypeTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Form\\Type;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Builder\\DefaultFormBuilderInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\DefaultResourceType;\nuse Sylius\\Component\\Registry\\ServiceRegistryInterface;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Webmozart\\Assert\\InvalidArgumentException;\n\nfinal class DefaultResourceTypeTest extends TestCase\n{\n    /** @var RegistryInterface&MockObject */\n    private RegistryInterface $metadataRegistry;\n\n    /** @var ServiceRegistryInterface&MockObject */\n    private ServiceRegistryInterface $formBuilderRegistry;\n\n    private DefaultResourceType $formType;\n\n    protected function setUp(): void\n    {\n        $this->metadataRegistry = $this->createMock(RegistryInterface::class);\n        $this->formBuilderRegistry = $this->createMock(ServiceRegistryInterface::class);\n        $this->formType = new DefaultResourceType($this->metadataRegistry, $this->formBuilderRegistry);\n    }\n\n    public function testExtendsAbstractType(): void\n    {\n        self::assertInstanceOf(AbstractType::class, $this->formType);\n    }\n\n    public function testGetBlockPrefix(): void\n    {\n        self::assertSame('sylius_resource', $this->formType->getBlockPrefix());\n    }\n\n    public function testBuildFormGetsMetadataByClass(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $metadata\n            ->method('getDriver')\n            ->willReturn('doctrine/orm');\n\n        $this->metadataRegistry\n            ->expects(self::once())\n            ->method('getByClass')\n            ->with('App\\Entity\\Product')\n            ->willReturn($metadata);\n\n        $formBuilder = $this->createMock(DefaultFormBuilderInterface::class);\n        $this->formBuilderRegistry\n            ->method('get')\n            ->willReturn($formBuilder);\n\n        $builder = $this->createMock(FormBuilderInterface::class);\n\n        $this->formType->buildForm($builder, ['data_class' => 'App\\Entity\\Product']);\n    }\n\n    public function testBuildFormGetsFormBuilderByDriver(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $metadata\n            ->method('getDriver')\n            ->willReturn('doctrine/orm');\n\n        $this->metadataRegistry\n            ->method('getByClass')\n            ->willReturn($metadata);\n\n        $formBuilder = $this->createMock(DefaultFormBuilderInterface::class);\n        $this->formBuilderRegistry\n            ->expects(self::once())\n            ->method('get')\n            ->with('doctrine/orm')\n            ->willReturn($formBuilder);\n\n        $builder = $this->createMock(FormBuilderInterface::class);\n\n        $this->formType->buildForm($builder, ['data_class' => 'App\\Entity\\Product']);\n    }\n\n    public function testBuildFormCallsFormBuilderBuild(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $metadata\n            ->method('getDriver')\n            ->willReturn('doctrine/orm');\n\n        $this->metadataRegistry\n            ->method('getByClass')\n            ->willReturn($metadata);\n\n        $formBuilder = $this->createMock(DefaultFormBuilderInterface::class);\n        $builder = $this->createMock(FormBuilderInterface::class);\n        $options = ['data_class' => 'App\\Entity\\Product', 'foo' => 'bar'];\n\n        $formBuilder\n            ->expects(self::once())\n            ->method('build')\n            ->with($metadata, $builder, $options);\n\n        $this->formBuilderRegistry\n            ->method('get')\n            ->willReturn($formBuilder);\n\n        $this->formType->buildForm($builder, $options);\n    }\n\n    public function testBuildFormThrowsExceptionWhenNoDriver(): void\n    {\n        $metadata = $this->createMock(MetadataInterface::class);\n        $metadata\n            ->method('getDriver')\n            ->willReturn(false);\n        $metadata\n            ->method('getAlias')\n            ->willReturn('app.product');\n\n        $this->metadataRegistry\n            ->method('getByClass')\n            ->willReturn($metadata);\n\n        $builder = $this->createMock(FormBuilderInterface::class);\n\n        self::expectException(InvalidArgumentException::class);\n        self::expectExceptionMessage('Form \"Sylius\\Bundle\\ResourceBundle\\Form\\Type\\DefaultResourceType\" cannot be used with no driver configured on the resource \"app.product\". Please define a form.');\n\n        $this->formType->buildForm($builder, ['data_class' => 'App\\Entity\\Product']);\n    }\n\n    public function testBuildFormThrowsExceptionWhenDataClassIsNotString(): void\n    {\n        $builder = $this->createMock(FormBuilderInterface::class);\n\n        self::expectException(InvalidArgumentException::class);\n\n        $this->formType->buildForm($builder, ['data_class' => null]);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Form/Type/FixedCollectionTypeTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Form\\Type;\n\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\FixedCollectionType;\nuse Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType;\nuse Symfony\\Component\\Form\\Test\\TypeTestCase;\n\nfinal class FixedCollectionTypeTest extends TypeTestCase\n{\n    /**\n     * @test\n     */\n    public function it_builds_fixed_collection(): void\n    {\n        $form = $this->factory->create(FixedCollectionType::class, null, [\n            'entries' => ['first_name', 'last_name'],\n            'entry_type' => TextType::class,\n            'entry_name' => function (string $entry): string {\n                return strtoupper($entry);\n            },\n        ]);\n\n        $form->submit(['FIRST_NAME' => 'Elon', 'LAST_NAME' => 'Tusk']);\n\n        $this->assertEquals(['FIRST_NAME' => 'Elon', 'LAST_NAME' => 'Tusk'], $form->getData());\n    }\n\n    /**\n     * @test\n     */\n    public function it_builds_fixed_collection_using_callable_to_resolve_entry_type(): void\n    {\n        $form = $this->factory->create(FixedCollectionType::class, null, [\n            'entries' => ['first_name', 'last_name'],\n            'entry_type' => function (string $entry): string {\n                if (!in_array($entry, ['first_name', 'last_name'], true)) {\n                    throw new \\Exception();\n                }\n\n                return TextType::class;\n            },\n            'entry_name' => function (string $entry): string {\n                return strtoupper($entry);\n            },\n        ]);\n\n        $form->submit(['FIRST_NAME' => 'Elon', 'LAST_NAME' => 'Tusk']);\n\n        $this->assertEquals(['FIRST_NAME' => 'Elon', 'LAST_NAME' => 'Tusk'], $form->getData());\n    }\n\n    /**\n     * @test\n     */\n    public function it_builds_fixed_collection_using_array_to_resolve_entry_options(): void\n    {\n        $form = $this->factory->create(FixedCollectionType::class, null, [\n            'entries' => ['first_name', 'last_name'],\n            'entry_type' => TextType::class,\n            'entry_name' => function (string $entry): string {\n                return strtoupper($entry);\n            },\n            'entry_options' => [\n                'empty_data' => 'Tusk',\n            ],\n        ]);\n\n        $form->submit(['FIRST_NAME' => 'Elon']);\n\n        $this->assertEquals(['FIRST_NAME' => 'Elon', 'LAST_NAME' => 'Tusk'], $form->getData());\n    }\n\n    /**\n     * @test\n     */\n    public function it_builds_fixed_collection_using_callable_to_resolve_entry_options(): void\n    {\n        $form = $this->factory->create(FixedCollectionType::class, null, [\n            'entries' => ['first_name', 'last_name'],\n            'entry_type' => TextType::class,\n            'entry_name' => function (string $entry): string {\n                return strtoupper($entry);\n            },\n            'entry_options' => function (string $entry): array {\n                $defaults = [\n                    'first_name' => 'Elon',\n                    'last_name' => 'Tusk',\n                ];\n\n                return ['empty_data' => $defaults[$entry]];\n            },\n        ]);\n\n        $form->submit([]);\n\n        $this->assertEquals(['FIRST_NAME' => 'Elon', 'LAST_NAME' => 'Tusk'], $form->getData());\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Form/Type/ResourceAutocompleteChoiceTypeTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Form\\Type;\n\nuse Doctrine\\Common\\Collections\\ArrayCollection;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\ResourceAutocompleteChoiceType;\nuse Sylius\\Component\\Registry\\ServiceRegistryInterface;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\Form\\PreloadedExtension;\nuse Symfony\\Component\\Form\\Test\\TypeTestCase;\nuse Symfony\\Component\\OptionsResolver\\Exception\\InvalidOptionsException;\nuse Symfony\\Component\\OptionsResolver\\Exception\\MissingOptionsException;\n\nfinal class ResourceAutocompleteChoiceTypeTest extends TypeTestCase\n{\n    private ServiceRegistryInterface|MockObject $resourceRepositoryRegistry;\n\n    protected function setUp(): void\n    {\n        $this->resourceRepositoryRegistry = $this->createMock(ServiceRegistryInterface::class);\n\n        parent::setUp();\n    }\n\n    protected function getExtensions(): array\n    {\n        $resourceAutoCompleteType = new ResourceAutocompleteChoiceType($this->resourceRepositoryRegistry);\n\n        return [\n            new PreloadedExtension([$resourceAutoCompleteType], []),\n        ];\n    }\n\n    /**\n     * @test\n     */\n    public function it_returns_resource_from_its_code(): void\n    {\n        /** @var MockObject|RepositoryInterface $resourceRepository */\n        $resourceRepository = $this->createMock(RepositoryInterface::class);\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->resourceRepositoryRegistry->method('get')->with('sylius.resource')->willReturn($resourceRepository);\n        $resourceRepository->method('findOneBy')->with(['code' => 'mug'])->willReturn($resource);\n\n        $form = $this->factory->create(\n            ResourceAutocompleteChoiceType::class,\n            null,\n            ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 'code'],\n        );\n\n        $form->submit('mug');\n\n        $this->assertEquals($resource, $form->getData());\n    }\n\n    /**\n     * @test\n     */\n    public function it_returns_resource_from_its_id(): void\n    {\n        /** @var MockObject|RepositoryInterface $resourceRepository */\n        $resourceRepository = $this->createMock(RepositoryInterface::class);\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->resourceRepositoryRegistry->method('get')->with('sylius.resource')->willReturn($resourceRepository);\n        $resourceRepository->method('findOneBy')->with(['id' => '1'])->willReturn($resource);\n\n        $form = $this->factory->create(\n            ResourceAutocompleteChoiceType::class,\n            null,\n            ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 'id'],\n        );\n\n        $form->submit('1');\n\n        $this->assertEquals($resource, $form->getData());\n    }\n\n    /**\n     * @test\n     */\n    public function it_returns_different_resource_from_its_identifier(): void\n    {\n        /** @var MockObject|RepositoryInterface $resourceRepository */\n        $resourceRepository = $this->createMock(RepositoryInterface::class);\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->resourceRepositoryRegistry->method('get')->with('sylius.zone')->willReturn($resourceRepository);\n        $resourceRepository->method('findOneBy')->with(['code' => 'eu'])->willReturn($resource);\n\n        $form = $this->factory->create(\n            ResourceAutocompleteChoiceType::class,\n            null,\n            ['resource' => 'sylius.zone', 'choice_name' => 'name', 'choice_value' => 'code'],\n        );\n\n        $form->submit('eu');\n\n        $this->assertEquals($resource, $form->getData());\n    }\n\n    /**\n     * @test\n     */\n    public function it_has_identifier_as_view_value(): void\n    {\n        /** @var MockObject|RepositoryInterface $resourceRepository */\n        $resourceRepository = $this->createMock(RepositoryInterface::class);\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->resourceRepositoryRegistry->method('get')->with('sylius.zone')->willReturn($resourceRepository);\n        $resourceRepository->method('findOneBy')->with(['code' => 'eu'])->willReturn($resource);\n\n        $form = $this->factory->create(\n            ResourceAutocompleteChoiceType::class,\n            null,\n            ['resource' => 'sylius.zone', 'choice_name' => 'name', 'choice_value' => 'code'],\n        );\n\n        $form->submit('eu');\n\n        $this->assertEquals('eu', $form->getViewData());\n    }\n\n    /**\n     * @test\n     */\n    public function it_has_different_view_based_on_passed_configuration(): void\n    {\n        /** @var MockObject|RepositoryInterface $resourceRepository */\n        $resourceRepository = $this->createMock(RepositoryInterface::class);\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->resourceRepositoryRegistry->method('get')->with('sylius.zone')->willReturn($resourceRepository);\n        $resourceRepository->method('findOneBy')->with(['code' => 'eu'])->willReturn($resource);\n\n        $form = $this->factory->create(\n            ResourceAutocompleteChoiceType::class,\n            null,\n            ['resource' => 'sylius.zone', 'choice_name' => 'name', 'choice_value' => 'code'],\n        );\n\n        $formViewVars = $form->createView()->vars;\n\n        $this->assertSame('name', $formViewVars['choice_name']);\n        $this->assertSame('code', $formViewVars['choice_value']);\n        $this->assertFalse($formViewVars['multiple']);\n        $this->assertSame('', $formViewVars['placeholder']);\n    }\n\n    /**\n     * @test\n     */\n    public function it_returns_collection_of_resources_from_identifiers(): void\n    {\n        /** @var MockObject|RepositoryInterface $resourceRepository */\n        $resourceRepository = $this->createMock(RepositoryInterface::class);\n        $mug = $this->createMock(ResourceInterface::class);\n        $book = $this->createMock(ResourceInterface::class);\n        $sticker = $this->createMock(ResourceInterface::class);\n\n        $this->resourceRepositoryRegistry->method('get')->with('sylius.resource')->willReturn($resourceRepository);\n        $resourceRepository->method('findOneBy')->willReturnCallback(function (array $criteria) use ($mug, $book, $sticker) {\n            if ($criteria === ['code' => 'mug']) {\n                return $mug;\n            }\n            if ($criteria === ['code' => 'book']) {\n                return $book;\n            }\n            if ($criteria === ['code' => 'sticker']) {\n                return $sticker;\n            }\n\n            return null;\n        });\n\n        $form = $this->factory->create(\n            ResourceAutocompleteChoiceType::class,\n            new ArrayCollection(),\n            ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 'code', 'multiple' => true],\n        );\n\n        $form->submit('mug,book,sticker');\n\n        $this->assertEquals(\n            new ArrayCollection([$mug, $book, $sticker]),\n            $form->getData(),\n        );\n    }\n\n    /**\n     * @test\n     */\n    public function its_resource_option_should_be_string(): void\n    {\n        $this->expectException(InvalidOptionsException::class);\n\n        $this->factory->create(\n            ResourceAutocompleteChoiceType::class,\n            new ArrayCollection(),\n            ['resource' => 1, 'choice_name' => 'name', 'choice_value' => 'code', 'multiple' => true],\n        );\n    }\n\n    /**\n     * @test\n     */\n    public function its_choice_name_option_should_be_string(): void\n    {\n        $this->expectException(InvalidOptionsException::class);\n\n        $this->factory->create(\n            ResourceAutocompleteChoiceType::class,\n            new ArrayCollection(),\n            ['resource' => 1, 'choice_name' => 1, 'choice_value' => 'code', 'multiple' => true],\n        );\n    }\n\n    /**\n     * @test\n     */\n    public function its_choice_value_option_should_be_string(): void\n    {\n        $this->expectException(InvalidOptionsException::class);\n\n        $this->factory->create(\n            ResourceAutocompleteChoiceType::class,\n            new ArrayCollection(),\n            ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 1, 'multiple' => true],\n        );\n    }\n\n    /**\n     * @test\n     */\n    public function its_multiple_option_should_be_boolean(): void\n    {\n        $this->expectException(InvalidOptionsException::class);\n\n        $this->factory->create(\n            ResourceAutocompleteChoiceType::class,\n            new ArrayCollection(),\n            ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 'code', 'multiple' => 'yes'],\n        );\n    }\n\n    /**\n     * @test\n     */\n    public function its_placeholder_option_should_be_string(): void\n    {\n        $this->expectException(InvalidOptionsException::class);\n\n        $this->factory->create(\n            ResourceAutocompleteChoiceType::class,\n            new ArrayCollection(),\n            ['resource' => 'sylius.resource', 'choice_name' => 'name', 'choice_value' => 'code', 'placeholder' => 1],\n        );\n    }\n\n    /**\n     * @test\n     */\n    public function it_cannot_be_created_without_resource_option(): void\n    {\n        $this->expectException(MissingOptionsException::class);\n\n        $this->factory->create(\n            ResourceAutocompleteChoiceType::class,\n            new ArrayCollection(),\n            ['choice_name' => 'name', 'choice_value' => 'code'],\n        );\n    }\n\n    /**\n     * @test\n     */\n    public function it_cannot_be_created_without_choice_name_option(): void\n    {\n        $this->expectException(MissingOptionsException::class);\n\n        $this->factory->create(\n            ResourceAutocompleteChoiceType::class,\n            new ArrayCollection(),\n            ['resource' => 'sylius.resource', 'choice_value' => 'code'],\n        );\n    }\n\n    /**\n     * @test\n     */\n    public function it_cannot_be_created_without_choice_value_option(): void\n    {\n        $this->expectException(MissingOptionsException::class);\n\n        $this->factory->create(\n            ResourceAutocompleteChoiceType::class,\n            new ArrayCollection(),\n            ['resource' => 'sylius.resource', 'choice_name' => 'name'],\n        );\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Form/Type/ResourceToIdentifierTypeTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Form\\Type;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\DataTransformer\\ResourceToIdentifierTransformer;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\ResourceToIdentifierType;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Bridge\\Doctrine\\Form\\Type\\EntityType;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Symfony\\Component\\OptionsResolver\\Exception\\InvalidOptionsException;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolver;\n\nfinal class ResourceToIdentifierTypeTest extends TestCase\n{\n    /** @var RepositoryInterface<ResourceInterface>&MockObject */\n    private RepositoryInterface $repository;\n\n    /** @var MetadataInterface&MockObject */\n    private MetadataInterface $metadata;\n\n    private ResourceToIdentifierType $formType;\n\n    protected function setUp(): void\n    {\n        $this->repository = $this->createMock(RepositoryInterface::class);\n        $this->metadata = $this->createMock(MetadataInterface::class);\n        $this->formType = new ResourceToIdentifierType($this->repository, $this->metadata);\n    }\n\n    public function testExtendsAbstractType(): void\n    {\n        self::assertInstanceOf(AbstractType::class, $this->formType);\n    }\n\n    public function testGetParent(): void\n    {\n        self::assertSame(EntityType::class, $this->formType->getParent());\n    }\n\n    public function testGetBlockPrefix(): void\n    {\n        $this->metadata\n            ->expects(self::once())\n            ->method('getApplicationName')\n            ->willReturn('app');\n\n        $this->metadata\n            ->expects(self::once())\n            ->method('getName')\n            ->willReturn('product');\n\n        self::assertSame('app_product_to_identifier', $this->formType->getBlockPrefix());\n    }\n\n    public function testConfigureOptionsWithDefaults(): void\n    {\n        $resolver = new OptionsResolver();\n\n        $this->formType->configureOptions($resolver);\n\n        $options = $resolver->resolve();\n\n        self::assertArrayHasKey('identifier', $options);\n        self::assertSame('id', $options['identifier']);\n    }\n\n    public function testConfigureOptionsWithCustomIdentifier(): void\n    {\n        $resolver = new OptionsResolver();\n\n        $this->formType->configureOptions($resolver);\n\n        $options = $resolver->resolve(['identifier' => 'uuid']);\n\n        self::assertSame('uuid', $options['identifier']);\n    }\n\n    public function testConfigureOptionsThrowsExceptionForInvalidIdentifierType(): void\n    {\n        $resolver = new OptionsResolver();\n\n        $this->formType->configureOptions($resolver);\n\n        self::expectException(InvalidOptionsException::class);\n\n        $resolver->resolve(['identifier' => 123]);\n    }\n\n    public function testBuildFormAddsResourceToIdentifierTransformer(): void\n    {\n        $builder = $this->createMock(FormBuilderInterface::class);\n        $builder\n            ->expects(self::once())\n            ->method('addModelTransformer')\n            ->with(self::isInstanceOf(ResourceToIdentifierTransformer::class));\n\n        $this->formType->buildForm($builder, ['identifier' => 'id']);\n    }\n\n    public function testBuildFormAddsTransformerWithCustomIdentifier(): void\n    {\n        $builder = $this->createMock(FormBuilderInterface::class);\n        $builder\n            ->expects(self::once())\n            ->method('addModelTransformer')\n            ->with(self::callback(function (ResourceToIdentifierTransformer $transformer): bool {\n                return $transformer instanceof ResourceToIdentifierTransformer;\n            }));\n\n        $this->formType->buildForm($builder, ['identifier' => 'uuid']);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Form/Type/ResourceTranslationsTypeTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Form\\Type;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\FixedCollectionType;\nuse Sylius\\Bundle\\ResourceBundle\\Form\\Type\\ResourceTranslationsType;\nuse Sylius\\Resource\\Model\\TranslatableInterface;\nuse Sylius\\Resource\\Model\\TranslationInterface;\nuse Sylius\\Resource\\Translation\\Provider\\TranslationLocaleProviderInterface;\nuse Symfony\\Component\\Form\\AbstractType;\nuse Symfony\\Component\\Form\\FormBuilderInterface;\nuse Symfony\\Component\\Form\\FormEvent;\nuse Symfony\\Component\\Form\\FormInterface;\nuse Symfony\\Component\\OptionsResolver\\OptionsResolver;\n\nfinal class ResourceTranslationsTypeTest extends TestCase\n{\n    private const DEFAULT_LOCALES = ['en_US', 'pl_PL', 'de_DE'];\n\n    private const DEFAULT_LOCALE = 'en_US';\n\n    /** @var TranslationLocaleProviderInterface&MockObject */\n    private TranslationLocaleProviderInterface $localeProvider;\n\n    private ResourceTranslationsType $formType;\n\n    protected function setUp(): void\n    {\n        $this->localeProvider = $this->createLocaleProvider(self::DEFAULT_LOCALES, self::DEFAULT_LOCALE);\n        $this->formType = new ResourceTranslationsType($this->localeProvider);\n    }\n\n    public function testExtendsAbstractType(): void\n    {\n        self::assertInstanceOf(AbstractType::class, $this->formType);\n    }\n\n    public function testGetParent(): void\n    {\n        self::assertSame(FixedCollectionType::class, $this->formType->getParent());\n    }\n\n    public function testGetBlockPrefix(): void\n    {\n        self::assertSame('sylius_translations', $this->formType->getBlockPrefix());\n    }\n\n    public function testConfigureOptionsWithDefaults(): void\n    {\n        $options = $this->resolveOptions();\n\n        self::assertArrayHasKey('entries', $options);\n        self::assertArrayHasKey('entry_name', $options);\n        self::assertArrayHasKey('entry_options', $options);\n        self::assertSame(self::DEFAULT_LOCALES, $options['entries']);\n    }\n\n    public function testEntryNameCallableReturnsLocaleCode(): void\n    {\n        $options = $this->resolveOptions();\n        $entryName = $options['entry_name'];\n\n        self::assertIsCallable($entryName);\n        self::assertSame('en_US', $entryName('en_US'));\n        self::assertSame('pl_PL', $entryName('pl_PL'));\n    }\n\n    public function testEntryOptionsCallableReturnsRequiredTrueForDefaultLocale(): void\n    {\n        $options = $this->resolveOptions();\n        $entryOptions = $options['entry_options'];\n\n        self::assertIsCallable($entryOptions);\n\n        $defaultLocaleOptions = $entryOptions(self::DEFAULT_LOCALE);\n        self::assertArrayHasKey('required', $defaultLocaleOptions);\n        self::assertTrue($defaultLocaleOptions['required']);\n    }\n\n    public function testEntryOptionsCallableReturnsRequiredFalseForNonDefaultLocale(): void\n    {\n        $options = $this->resolveOptions();\n        $entryOptions = $options['entry_options'];\n\n        self::assertIsCallable($entryOptions);\n\n        $nonDefaultLocaleOptions = $entryOptions('pl_PL');\n        self::assertArrayHasKey('required', $nonDefaultLocaleOptions);\n        self::assertFalse($nonDefaultLocaleOptions['required']);\n    }\n\n    public function testBuildFormAddsSubmitEventListener(): void\n    {\n        $builder = $this->createMock(FormBuilderInterface::class);\n        $builder\n            ->expects(self::once())\n            ->method('addEventListener')\n            ->with(\n                self::identicalTo('form.submit'),\n                self::callback(fn ($callback): bool => is_callable($callback)),\n            );\n\n        $this->formType->buildForm($builder, []);\n    }\n\n    public function testUsesCustomLocalesFromProvider(): void\n    {\n        $customLocales = ['fr_FR', 'es_ES'];\n        $customDefault = 'fr_FR';\n        $formType = new ResourceTranslationsType($this->createLocaleProvider($customLocales, $customDefault));\n\n        $options = $this->resolveOptions($formType);\n        $entryOptions = $options['entry_options'];\n\n        self::assertSame($customLocales, $options['entries']);\n        self::assertIsCallable($entryOptions);\n\n        $defaultLocaleOptions = $entryOptions($customDefault);\n        self::assertTrue($defaultLocaleOptions['required']);\n\n        $nonDefaultLocaleOptions = $entryOptions('es_ES');\n        self::assertFalse($nonDefaultLocaleOptions['required']);\n    }\n\n    public function testEventListenerSetsLocaleAndTranslatableOnTranslations(): void\n    {\n        $translatable = $this->createMock(TranslatableInterface::class);\n\n        $translation1 = $this->createTranslationMock('en_US', $translatable);\n        $translation2 = $this->createTranslationMock('pl_PL', $translatable);\n\n        $translations = [\n            'en_US' => $translation1,\n            'pl_PL' => $translation2,\n        ];\n\n        $listener = $this->captureEventListener();\n        $event = $this->createFormEvent($translations, $translatable);\n\n        $listener($event);\n\n        self::assertSame($translations, $event->getData());\n    }\n\n    public function testEventListenerRemovesNullTranslations(): void\n    {\n        $translatable = $this->createMock(TranslatableInterface::class);\n        $translation = $this->createTranslationMock('en_US', $translatable);\n\n        $translations = [\n            'en_US' => $translation,\n            'pl_PL' => null,\n            'de_DE' => null,\n        ];\n\n        $listener = $this->captureEventListener();\n        $event = $this->createFormEvent($translations, $translatable);\n\n        $listener($event);\n\n        $result = $event->getData();\n        self::assertIsArray($result);\n        self::assertArrayHasKey('en_US', $result);\n        self::assertArrayNotHasKey('pl_PL', $result);\n        self::assertArrayNotHasKey('de_DE', $result);\n        self::assertCount(1, $result);\n    }\n\n    public function testEventListenerHandlesEmptyTranslations(): void\n    {\n        $translatable = $this->createMock(TranslatableInterface::class);\n\n        $listener = $this->captureEventListener();\n        $event = $this->createFormEvent([], $translatable);\n\n        $listener($event);\n\n        self::assertSame([], $event->getData());\n    }\n\n    public function testEventListenerHandlesAllNullTranslations(): void\n    {\n        $translatable = $this->createMock(TranslatableInterface::class);\n        $translations = [\n            'en_US' => null,\n            'pl_PL' => null,\n        ];\n\n        $listener = $this->captureEventListener();\n        $event = $this->createFormEvent($translations, $translatable);\n\n        $listener($event);\n\n        self::assertSame([], $event->getData());\n    }\n\n    /**\n     * @param string[] $locales\n     *\n     * @return TranslationLocaleProviderInterface&MockObject\n     */\n    private function createLocaleProvider(array $locales, string $defaultLocale): TranslationLocaleProviderInterface\n    {\n        $provider = $this->createMock(TranslationLocaleProviderInterface::class);\n        $provider->method('getDefinedLocalesCodes')->willReturn($locales);\n        $provider->method('getDefaultLocaleCode')->willReturn($defaultLocale);\n\n        return $provider;\n    }\n\n    /** @return array<string, mixed> */\n    private function resolveOptions(?ResourceTranslationsType $formType = null): array\n    {\n        $resolver = new OptionsResolver();\n        ($formType ?? $this->formType)->configureOptions($resolver);\n\n        return $resolver->resolve();\n    }\n\n    /** @return TranslationInterface&MockObject */\n    private function createTranslationMock(string $locale, TranslatableInterface $translatable): TranslationInterface\n    {\n        $translation = $this->createMock(TranslationInterface::class);\n        $translation->expects(self::once())->method('setLocale')->with($locale);\n        $translation->expects(self::once())->method('setTranslatable')->with($translatable);\n\n        return $translation;\n    }\n\n    private function captureEventListener(): callable\n    {\n        $listener = null;\n\n        $builder = $this->createMock(FormBuilderInterface::class);\n        $builder\n            ->expects(self::once())\n            ->method('addEventListener')\n            ->willReturnCallback(function ($eventName, $callback) use (&$listener, $builder) {\n                $listener = $callback;\n\n                return $builder;\n            });\n\n        $this->formType->buildForm($builder, []);\n\n        return $listener;\n    }\n\n    /**\n     * @param array<string, TranslationInterface|null> $translations\n     */\n    private function createFormEvent(array $translations, TranslatableInterface $translatable): FormEvent\n    {\n        $parentForm = $this->createMock(FormInterface::class);\n        $parentForm->method('getData')->willReturn($translatable);\n\n        $form = $this->createMock(FormInterface::class);\n        $form->method('getParent')->willReturn($parentForm);\n\n        /** @var array<string, TranslationInterface|null>|null $updatedData */\n        $updatedData = null;\n\n        $event = $this->createMock(FormEvent::class);\n        $event\n            ->method('getData')\n            ->willReturnCallback(function () use (&$updatedData, $translations) {\n                return null !== $updatedData ? $updatedData : $translations;\n            });\n        $event\n            ->method('getForm')\n            ->willReturn($form);\n        $event\n            ->expects(self::once())\n            ->method('setData')\n            ->willReturnCallback(function ($data) use (&$updatedData): void {\n                $updatedData = $data;\n            });\n\n        return $event;\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Grid/Controller/ResourcesResolverTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Grid\\Controller;\n\nuse Pagerfanta\\Pagerfanta;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourcesResolverInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\Controller\\ResourcesResolver;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridView;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridViewFactoryInterface;\nuse Sylius\\Component\\Grid\\Definition\\Grid;\nuse Sylius\\Component\\Grid\\Parameters;\nuse Sylius\\Component\\Grid\\Provider\\GridProviderInterface;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\HttpFoundation\\InputBag;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class ResourcesResolverTest extends TestCase\n{\n    private ResourcesResolverInterface&MockObject $decoratedResolver;\n\n    private GridProviderInterface&MockObject $gridProvider;\n\n    private ResourceGridViewFactoryInterface&MockObject $gridViewFactory;\n\n    private ResourcesResolver $resolver;\n\n    private RequestConfiguration&MockObject $requestConfiguration;\n\n    /** @var RepositoryInterface<ResourceInterface>&MockObject */\n    private RepositoryInterface $repository;\n\n    protected function setUp(): void\n    {\n        $this->decoratedResolver = $this->createMock(ResourcesResolverInterface::class);\n        $this->gridProvider = $this->createMock(GridProviderInterface::class);\n        $this->gridViewFactory = $this->createMock(ResourceGridViewFactoryInterface::class);\n        $this->resolver = new ResourcesResolver($this->decoratedResolver, $this->gridProvider, $this->gridViewFactory);\n        $this->requestConfiguration = $this->createMock(RequestConfiguration::class);\n        $this->repository = $this->createMock(RepositoryInterface::class);\n    }\n\n    public function testItImplementsResourcesResolverInterface(): void\n    {\n        $this->assertInstanceOf(ResourcesResolverInterface::class, $this->resolver);\n    }\n\n    public function testItUsesDecoratedResolverWhenNotUsingAGrid(): void\n    {\n        $resource = $this->createMock(ResourceInterface::class);\n\n        $this->requestConfiguration->expects($this->once())\n            ->method('hasGrid')\n            ->willReturn(false);\n\n        $this->decoratedResolver->expects($this->once())\n            ->method('getResources')\n            ->with($this->requestConfiguration, $this->repository)\n            ->willReturn([$resource]);\n\n        $result = $this->resolver->getResources($this->requestConfiguration, $this->repository);\n\n        $this->assertSame([$resource], $result);\n    }\n\n    public function testItReturnsGridViewForHtmlRequest(): void\n    {\n        $gridView = $this->createMock(ResourceGridView::class);\n\n        $this->configureGridRequest(true);\n        $this->configureGridViewCreation($gridView);\n\n        $result = $this->resolver->getResources($this->requestConfiguration, $this->repository);\n\n        $this->assertSame($gridView, $result);\n    }\n\n    public function testItReturnsGridDataForNonHtmlRequest(): void\n    {\n        $gridView = $this->createMock(ResourceGridView::class);\n        $paginator = $this->createMock(Pagerfanta::class);\n\n        $this->configureGridRequest(false);\n        $this->configureGridViewCreation($gridView);\n\n        $gridView->expects($this->once())\n            ->method('getData')\n            ->willReturn($paginator);\n\n        $result = $this->resolver->getResources($this->requestConfiguration, $this->repository);\n\n        $this->assertSame($paginator, $result);\n    }\n\n    private function configureGridRequest(bool $isHtmlRequest): void\n    {\n        $request = new Request();\n        $request->query = new InputBag(['foo' => 'bar']);\n\n        $this->requestConfiguration->expects($this->once())\n            ->method('hasGrid')\n            ->willReturn(true);\n\n        $this->requestConfiguration->expects($this->once())\n            ->method('getGrid')\n            ->willReturn('sylius_admin_tax_category');\n\n        $this->requestConfiguration->expects($this->once())\n            ->method('getMetadata')\n            ->willReturn($this->createMock(MetadataInterface::class));\n\n        $this->requestConfiguration->expects($this->once())\n            ->method('isHtmlRequest')\n            ->willReturn($isHtmlRequest);\n\n        $this->requestConfiguration->expects($this->once())\n            ->method('getRequest')\n            ->willReturn($request);\n    }\n\n    private function configureGridViewCreation(ResourceGridView $gridView): void\n    {\n        $gridDefinition = $this->createMock(Grid::class);\n\n        $this->gridProvider->expects($this->once())\n            ->method('get')\n            ->with('sylius_admin_tax_category')\n            ->willReturn($gridDefinition);\n\n        $this->gridViewFactory->expects($this->once())\n            ->method('create')\n            ->with(\n                $gridDefinition,\n                $this->isInstanceOf(Parameters::class),\n                $this->isInstanceOf(MetadataInterface::class),\n                $this->requestConfiguration,\n            )\n            ->willReturn($gridView);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Grid/Parser/OptionsParserTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Grid\\Parser;\n\nuse PHPUnit\\Framework\\Attributes\\DataProvider;\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\Parser\\OptionsParser;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\Parser\\OptionsParserInterface;\nuse Sylius\\Resource\\Model\\ResourceInterface;\nuse Symfony\\Component\\DependencyInjection\\ContainerInterface;\nuse Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\PropertyAccess\\PropertyAccessorInterface;\n\nfinal class OptionsParserTest extends TestCase\n{\n    /** @var ContainerInterface&MockObject */\n    private ContainerInterface $container;\n\n    /** @var ExpressionLanguage&MockObject */\n    private ExpressionLanguage $expression;\n\n    /** @var PropertyAccessorInterface&MockObject */\n    private PropertyAccessorInterface $propertyAccessor;\n\n    private OptionsParser $parser;\n\n    protected function setUp(): void\n    {\n        $this->container = $this->createMock(ContainerInterface::class);\n        $this->expression = $this->createMock(ExpressionLanguage::class);\n        $this->propertyAccessor = $this->createMock(PropertyAccessorInterface::class);\n        $this->parser = new OptionsParser($this->container, $this->expression, $this->propertyAccessor);\n    }\n\n    public function testItImplementsOptionsParserInterface(): void\n    {\n        $this->assertInstanceOf(OptionsParserInterface::class, $this->parser);\n    }\n\n    public function testItParsesOptionsWithRequestVariable(): void\n    {\n        $result = $this->parser->parseOptions(['id' => '$id'], new Request(attributes: ['id' => 7]));\n\n        $this->assertSame(['id' => 7], $result);\n    }\n\n    public function testItReturnsNonStringParametersWithoutParsing(): void\n    {\n        $data = [\n            'integer' => 10,\n            'float' => 19.99,\n            'true' => true,\n            'false' => false,\n            'null' => null,\n        ];\n\n        $result = $this->parser->parseOptions($data, new Request());\n\n        $this->assertSame($data, $result);\n    }\n\n    public function testItParsesOptionsWithMixedTypes(): void\n    {\n        $result = $this->parser->parseOptions([\n            'limit' => 25,\n            'enabled' => true,\n            'offset' => 0,\n            'price' => 99.99,\n            'optional' => null,\n            'status' => '$status',\n        ], new Request(query: ['status' => 'active']));\n\n        $this->assertSame([\n            'limit' => 25,\n            'enabled' => true,\n            'offset' => 0,\n            'price' => 99.99,\n            'optional' => null,\n            'status' => 'active',\n        ], $result);\n    }\n\n    public function testItParsesOptionsWithExpression(): void\n    {\n        $this->configureExpressionEvaluation('service(\"demo_service\")', 'demo_object');\n\n        $result = $this->parser->parseOptions(\n            [\n                'factory' => [\n                    'method' => 'createByParameter',\n                    'arguments' => [\n                        'expr:service(\"demo_service\")',\n                    ],\n                ],\n            ],\n            new Request(),\n        );\n\n        $this->assertSame(\n            [\n                'factory' => [\n                    'method' => 'createByParameter',\n                    'arguments' => [\n                        'demo_object',\n                    ],\n                ],\n            ],\n            $result,\n        );\n    }\n\n    public function testItParsesOptionsWithParameterFromResource(): void\n    {\n        $data = $this->createMock(ResourceInterface::class);\n\n        $this->propertyAccessor->expects($this->once())\n            ->method('getValue')\n            ->with($data, 'id')\n            ->willReturn(21);\n\n        $result = $this->parser->parseOptions(['id' => 'resource.id'], new Request(), $data);\n\n        $this->assertSame(['id' => 21], $result);\n    }\n\n    public function testItParsesOptionsWithArrayResourceAccess(): void\n    {\n        $data = $this->createMock(ResourceInterface::class);\n        $arrayData = [0 => $data, 'name' => 'An awesome name'];\n\n        $this->propertyAccessor->expects($this->exactly(2))\n            ->method('getValue')\n            ->willReturnCallback(fn ($subject, $path) => match ($path) {\n                'name' => 'An awesome name',\n                '[0].id' => 21,\n                default => null,\n            });\n\n        $result = $this->parser->parseOptions(['name' => 'resource.name'], new Request(), $arrayData);\n        $this->assertSame(['name' => 'An awesome name'], $result);\n\n        $result = $this->parser->parseOptions(['id' => 'resource[0].id'], new Request(), $arrayData);\n        $this->assertSame(['id' => 21], $result);\n    }\n\n    /**\n     * @param array<string, mixed>|null $requestVariables\n     * @param array<string, string> $options\n     * @param array<string, mixed> $expectedResult\n     */\n    #[DataProvider('expressionVariableTypesProvider')]\n    public function testItParsesExpressionWithVariableFromRequest(\n        ?array $requestVariables,\n        string $expectedExpression,\n        array $options,\n        array $expectedResult,\n    ): void {\n        $this->configureExpressionEvaluation($expectedExpression, reset($expectedResult));\n\n        $result = $this->parser->parseOptions($options, new Request(attributes: $requestVariables ?? []));\n\n        $this->assertSame($expectedResult, $result);\n    }\n\n    /**\n     * @return iterable<string, array{array<string, mixed>|null, string, array<string, string>, array<string, mixed>}>\n     */\n    public static function expressionVariableTypesProvider(): iterable\n    {\n        yield 'string variable' => [\n            ['customerId' => 'user123'],\n            'service(\"customer_repository\").find(\"user123\")',\n            ['customer' => 'expr:service(\"customer_repository\").find($customerId)'],\n            ['customer' => 'customer_object'],\n        ];\n\n        yield 'integer variable' => [\n            ['productId' => 42],\n            'service(\"product_repository\").find(42)',\n            ['product' => 'expr:service(\"product_repository\").find($productId)'],\n            ['product' => 'product_object'],\n        ];\n\n        yield 'null variable' => [\n            ['optionalParam' => null],\n            'service(\"some_service\").process()',\n            ['data' => 'expr:service(\"some_service\").process($optionalParam)'],\n            ['data' => 'result'],\n        ];\n\n        yield 'string with special characters' => [\n            ['searchTerm' => 'user\"test\\\\value'],\n            'service(\"search\").find(\"user\\\"test\\\\\\\\value\")',\n            ['results' => 'expr:service(\"search\").find($searchTerm)'],\n            ['results' => 'search_results'],\n        ];\n\n        yield 'multiple variables' => [\n            ['userId' => 10, 'limit' => 5],\n            'service(\"user_repository\").findLatest(10, 5)',\n            ['users' => 'expr:service(\"user_repository\").findLatest($userId, $limit)'],\n            ['users' => 'user_list'],\n        ];\n\n        yield 'boolean variable' => [\n            ['enabled' => true],\n            'service(\"filter\").apply(1)',\n            ['data' => 'expr:service(\"filter\").apply($enabled)'],\n            ['data' => 'filtered_results'],\n        ];\n    }\n\n    private function configureExpressionEvaluation(string $expression, mixed $result): void\n    {\n        $this->expression->expects($this->once())\n            ->method('evaluate')\n            ->with($expression, ['container' => $this->container])\n            ->willReturn($result);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Grid/Renderer/TwigBulkActionGridRendererTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Grid\\Renderer;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\Parser\\OptionsParserInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\Renderer\\TwigBulkActionGridRenderer;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridView;\nuse Sylius\\Component\\Grid\\Definition\\Action;\nuse Sylius\\Component\\Grid\\Renderer\\BulkActionGridRendererInterface;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Twig\\Environment;\n\nfinal class TwigBulkActionGridRendererTest extends TestCase\n{\n    /** @var Environment&MockObject */\n    private Environment $twig;\n\n    /** @var OptionsParserInterface&MockObject */\n    private OptionsParserInterface $optionsParser;\n\n    private TwigBulkActionGridRenderer $renderer;\n\n    protected function setUp(): void\n    {\n        $this->twig = $this->createMock(Environment::class);\n        $this->optionsParser = $this->createMock(OptionsParserInterface::class);\n        $this->renderer = new TwigBulkActionGridRenderer(\n            $this->twig,\n            $this->optionsParser,\n            ['delete' => '@SyliusGrid/BulkAction/_delete.html.twig'],\n        );\n    }\n\n    public function testItImplementsBulkActionGridRendererInterface(): void\n    {\n        $this->assertInstanceOf(BulkActionGridRendererInterface::class, $this->renderer);\n    }\n\n    public function testItUsesTwigToRenderTheBulkAction(): void\n    {\n        $request = $this->createMock(Request::class);\n        $requestConfiguration = $this->createConfiguredMock(RequestConfiguration::class, [\n            'getRequest' => $request,\n        ]);\n        $gridView = $this->createConfiguredMock(ResourceGridView::class, [\n            'getRequestConfiguration' => $requestConfiguration,\n        ]);\n        $bulkAction = $this->createBulkActionMock('delete', []);\n\n        $this->configureOptionsParser([], $request);\n        $this->configureTwigRenderer(\n            '@SyliusGrid/BulkAction/_delete.html.twig',\n            $gridView,\n            $bulkAction,\n            '<a href=\"#\">Delete</a>',\n        );\n\n        $result = $this->renderer->renderBulkAction($gridView, $bulkAction);\n\n        $this->assertSame('<a href=\"#\">Delete</a>', $result);\n    }\n\n    public function testItThrowsAnExceptionIfTemplateIsNotConfiguredForGivenBulkActionType(): void\n    {\n        $gridView = $this->createMock(ResourceGridView::class);\n        $bulkAction = $this->createBulkActionMock('foo');\n\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage('Missing template for bulk action type \"foo\".');\n\n        $this->renderer->renderBulkAction($gridView, $bulkAction);\n    }\n\n    /**\n     * @param array<string, mixed> $options\n     */\n    private function createBulkActionMock(string $type, array $options = []): Action&MockObject\n    {\n        return $this->createConfiguredMock(Action::class, [\n            'getType' => $type,\n            'getOptions' => $options,\n        ]);\n    }\n\n    /**\n     * @param array<string, mixed> $options\n     */\n    private function configureOptionsParser(array $options, Request $request): void\n    {\n        $this->optionsParser->expects($this->once())\n            ->method('parseOptions')\n            ->with($options, $request, null);\n    }\n\n    private function configureTwigRenderer(\n        string $template,\n        ResourceGridView $gridView,\n        Action $bulkAction,\n        string $renderedContent,\n    ): void {\n        $this->twig->expects($this->once())\n            ->method('render')\n            ->with($template, [\n                'grid' => $gridView,\n                'action' => $bulkAction,\n                'data' => null,\n                'options' => [],\n            ])\n            ->willReturn($renderedContent);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Grid/Renderer/TwigGridRendererTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Grid\\Renderer;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\Parser\\OptionsParserInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\Renderer\\TwigGridRenderer;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridView;\nuse Sylius\\Component\\Grid\\Definition\\Action;\nuse Sylius\\Component\\Grid\\Renderer\\GridRendererInterface;\nuse Sylius\\Component\\Grid\\View\\GridView;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Twig\\Environment;\n\nfinal class TwigGridRendererTest extends TestCase\n{\n    private const ACTION_TEMPLATES = [\n        'link' => '@SyliusGrid/Action/_link.html.twig',\n        'form' => '@SyliusGrid/Action/_form.html.twig',\n    ];\n\n    /** @var GridRendererInterface&MockObject */\n    private GridRendererInterface $gridRenderer;\n\n    /** @var Environment&MockObject */\n    private Environment $twig;\n\n    /** @var OptionsParserInterface&MockObject */\n    private OptionsParserInterface $optionsParser;\n\n    private TwigGridRenderer $renderer;\n\n    protected function setUp(): void\n    {\n        $this->gridRenderer = $this->createMock(GridRendererInterface::class);\n        $this->twig = $this->createMock(Environment::class);\n        $this->optionsParser = $this->createMock(OptionsParserInterface::class);\n        $this->renderer = new TwigGridRenderer(\n            $this->gridRenderer,\n            $this->twig,\n            $this->optionsParser,\n            self::ACTION_TEMPLATES,\n        );\n    }\n\n    public function testItImplementsGridRendererInterface(): void\n    {\n        $this->assertInstanceOf(GridRendererInterface::class, $this->renderer);\n    }\n\n    public function testItUsesTwigToRenderTheAction(): void\n    {\n        $request = $this->createMock(Request::class);\n        $requestConfiguration = $this->createConfiguredMock(RequestConfiguration::class, [\n            'getRequest' => $request,\n        ]);\n        $gridView = $this->createConfiguredMock(ResourceGridView::class, [\n            'getRequestConfiguration' => $requestConfiguration,\n        ]);\n        $action = $this->createActionMock('link', [], null);\n\n        $this->configureOptionsParser([], $request);\n        $this->configureTwigRenderer(\n            '@SyliusGrid/Action/_link.html.twig',\n            $gridView,\n            $action,\n            '<a href=\"#\">Action!</a>',\n        );\n\n        $result = $this->renderer->renderAction($gridView, $action);\n\n        $this->assertSame('<a href=\"#\">Action!</a>', $result);\n    }\n\n    public function testItThrowsAnExceptionIfTemplateIsNotConfiguredForGivenActionType(): void\n    {\n        $gridView = $this->createMock(ResourceGridView::class);\n        $action = $this->createActionMock('foo', [], null);\n\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage('Missing template for action type \"foo\".');\n\n        $this->renderer->renderAction($gridView, $action);\n    }\n\n    public function testItCallsTheInnerRendererWithANonResourceGridView(): void\n    {\n        $gridView = $this->createMock(GridView::class);\n        $action = $this->createMock(Action::class);\n\n        $this->configureInnerRenderer($gridView, $action, 'foo');\n\n        $result = $this->renderer->renderAction($gridView, $action);\n\n        $this->assertSame('foo', $result);\n    }\n\n    /**\n     * @param array<string, mixed> $options\n     */\n    private function createActionMock(string $type, array $options = [], ?string $template = null): Action&MockObject\n    {\n        return $this->createConfiguredMock(Action::class, [\n            'getType' => $type,\n            'getOptions' => $options,\n            'getTemplate' => $template,\n        ]);\n    }\n\n    /**\n     * @param array<string, mixed> $options\n     */\n    private function configureOptionsParser(array $options, Request $request): void\n    {\n        $this->optionsParser->expects($this->once())\n            ->method('parseOptions')\n            ->with($options, $request, null);\n    }\n\n    private function configureTwigRenderer(\n        string $template,\n        ResourceGridView $gridView,\n        Action $action,\n        string $renderedContent,\n    ): void {\n        $this->twig->expects($this->once())\n            ->method('render')\n            ->with($template, [\n                'grid' => $gridView,\n                'action' => $action,\n                'data' => null,\n                'options' => [],\n            ])\n            ->willReturn($renderedContent);\n    }\n\n    private function configureInnerRenderer(GridView $gridView, Action $action, string $result): void\n    {\n        $this->gridRenderer->expects($this->once())\n            ->method('renderAction')\n            ->with($gridView, $action, null)\n            ->willReturn($result);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Grid/View/LegacyGridViewFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Grid\\View;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Context\\Option\\RequestConfigurationOption;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\LegacyGridViewFactory;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridView;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridViewFactoryInterface;\nuse Sylius\\Component\\Grid\\Definition\\Grid;\nuse Sylius\\Component\\Grid\\Parameters;\nuse Sylius\\Component\\Grid\\View\\GridView;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\MetadataOption;\nuse Sylius\\Resource\\Grid\\View\\Factory\\GridViewFactoryInterface;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\n\nfinal class LegacyGridViewFactoryTest extends TestCase\n{\n    /** @var ResourceGridViewFactoryInterface&MockObject */\n    private ResourceGridViewFactoryInterface $resourceGridViewFactory;\n\n    /** @var GridViewFactoryInterface&MockObject */\n    private GridViewFactoryInterface $decorated;\n\n    private LegacyGridViewFactory $factory;\n\n    protected function setUp(): void\n    {\n        $this->resourceGridViewFactory = $this->createMock(ResourceGridViewFactoryInterface::class);\n        $this->decorated = $this->createMock(GridViewFactoryInterface::class);\n        $this->factory = new LegacyGridViewFactory($this->resourceGridViewFactory, $this->decorated);\n    }\n\n    public function testItCreatesALegacyResourceGridView(): void\n    {\n        $grid = $this->createMock(Grid::class);\n        $requestConfiguration = $this->createMock(RequestConfiguration::class);\n        $metadata = $this->createMock(MetadataInterface::class);\n        $resourceGridView = $this->createMock(ResourceGridView::class);\n        $parameters = new Parameters();\n\n        $context = $this->createContextWithRequestConfiguration($requestConfiguration, $metadata);\n\n        $this->configureResourceGridViewFactory($grid, $parameters, $metadata, $requestConfiguration, $resourceGridView);\n\n        $result = $this->factory->create($grid, $context, $parameters, []);\n\n        $this->assertSame($resourceGridView, $result);\n    }\n\n    public function testItCreatesAGridViewWhenContextHasNoRequestConfiguration(): void\n    {\n        $grid = $this->createMock(Grid::class);\n        $metadata = $this->createMock(MetadataInterface::class);\n        $gridView = $this->createMock(GridView::class);\n        $parameters = new Parameters();\n\n        $context = $this->createContextWithoutRequestConfiguration($metadata);\n\n        $this->configureDecoratedFactory($grid, $context, $parameters, $gridView);\n\n        $result = $this->factory->create($grid, $context, $parameters, []);\n\n        $this->assertSame($gridView, $result);\n    }\n\n    private function createContextWithRequestConfiguration(\n        RequestConfiguration $requestConfiguration,\n        MetadataInterface $metadata,\n    ): Context {\n        return new Context(\n            new RequestConfigurationOption($requestConfiguration),\n            new MetadataOption($metadata),\n        );\n    }\n\n    private function createContextWithoutRequestConfiguration(MetadataInterface $metadata): Context\n    {\n        return new Context(\n            new MetadataOption($metadata),\n        );\n    }\n\n    private function configureResourceGridViewFactory(\n        Grid $grid,\n        Parameters $parameters,\n        MetadataInterface $metadata,\n        RequestConfiguration $requestConfiguration,\n        ResourceGridView $resourceGridView,\n    ): void {\n        $this->resourceGridViewFactory->expects($this->once())\n            ->method('create')\n            ->with($grid, $parameters, $metadata, $requestConfiguration)\n            ->willReturn($resourceGridView);\n    }\n\n    private function configureDecoratedFactory(\n        Grid $grid,\n        Context $context,\n        Parameters $parameters,\n        GridView $gridView,\n    ): void {\n        $this->decorated->expects($this->once())\n            ->method('create')\n            ->with($grid, $context, $parameters, [])\n            ->willReturn($gridView);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Grid/View/ResourceGridViewFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Grid\\View;\n\nuse PHPUnit\\Framework\\MockObject\\MockObject;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ParametersParserInterface;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridView;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridViewFactory;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridViewFactoryInterface;\nuse Sylius\\Component\\Grid\\Data\\DataProviderInterface;\nuse Sylius\\Component\\Grid\\Definition\\Grid;\nuse Sylius\\Component\\Grid\\Parameters;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class ResourceGridViewFactoryTest extends TestCase\n{\n    private const DRIVER_CONFIG_BEFORE = [\n        'repository' => [\n            'method' => 'createByCustomerQueryBuilder',\n            'arguments' => ['$customerId'],\n        ],\n    ];\n\n    private const DRIVER_CONFIG_AFTER = [\n        'repository' => [\n            'method' => 'createByCustomerQueryBuilder',\n            'arguments' => [5],\n        ],\n    ];\n\n    private const GRID_DATA = ['foo', 'bar'];\n\n    /** @var DataProviderInterface&MockObject */\n    private DataProviderInterface $dataProvider;\n\n    /** @var ParametersParserInterface&MockObject */\n    private ParametersParserInterface $parametersParser;\n\n    private ResourceGridViewFactory $factory;\n\n    protected function setUp(): void\n    {\n        $this->dataProvider = $this->createMock(DataProviderInterface::class);\n        $this->parametersParser = $this->createMock(ParametersParserInterface::class);\n        $this->factory = new ResourceGridViewFactory($this->dataProvider, $this->parametersParser);\n    }\n\n    public function testItImplementsResourceGridViewFactoryInterface(): void\n    {\n        $this->assertInstanceOf(ResourceGridViewFactoryInterface::class, $this->factory);\n    }\n\n    public function testItUsesDataProviderToCreateAViewWithDataAndDefinition(): void\n    {\n        $parameters = new Parameters();\n        $resourceMetadata = $this->createMock(MetadataInterface::class);\n        $request = $this->createMock(Request::class);\n        $requestConfiguration = $this->createConfiguredMock(RequestConfiguration::class, [\n            'getRequest' => $request,\n        ]);\n        $grid = $this->createGridMock();\n\n        $this->configureParametersParser($request);\n        $this->configureDataProvider($grid, $parameters);\n\n        $result = $this->factory->create($grid, $parameters, $resourceMetadata, $requestConfiguration);\n\n        $this->assertResourceGridView($result, $grid, $parameters, $resourceMetadata, $requestConfiguration);\n    }\n\n    private function createGridMock(): Grid&MockObject\n    {\n        return $this->createConfiguredMock(Grid::class, [\n            'getDriverConfiguration' => self::DRIVER_CONFIG_BEFORE,\n        ]);\n    }\n\n    private function configureParametersParser(Request $request): void\n    {\n        $this->parametersParser->expects($this->once())\n            ->method('parseRequestValues')\n            ->with(self::DRIVER_CONFIG_BEFORE, $request)\n            ->willReturn(self::DRIVER_CONFIG_AFTER);\n    }\n\n    private function configureDataProvider(Grid&MockObject $grid, Parameters $parameters): void\n    {\n        /** @var MockObject $gridMock */\n        $gridMock = $grid;\n        $gridMock->expects($this->once())\n            ->method('setDriverConfiguration')\n            ->with(self::DRIVER_CONFIG_AFTER);\n\n        $this->dataProvider->expects($this->once())\n            ->method('getData')\n            ->with($grid, $parameters)\n            ->willReturn(self::GRID_DATA);\n    }\n\n    private function assertResourceGridView(\n        ResourceGridView $result,\n        Grid $grid,\n        Parameters $parameters,\n        MetadataInterface $resourceMetadata,\n        RequestConfiguration $requestConfiguration,\n    ): void {\n        $this->assertInstanceOf(ResourceGridView::class, $result);\n        $this->assertSame(self::GRID_DATA, $result->getData());\n        $this->assertSame($grid, $result->getDefinition());\n        $this->assertSame($parameters, $result->getParameters());\n        $this->assertSame($resourceMetadata, $result->getMetadata());\n        $this->assertSame($requestConfiguration, $result->getRequestConfiguration());\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Grid/View/ResourceGridViewTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Grid\\View;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Grid\\View\\ResourceGridView;\nuse Sylius\\Component\\Grid\\Definition\\Grid;\nuse Sylius\\Component\\Grid\\Parameters;\nuse Sylius\\Component\\Grid\\View\\GridView;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\n\nfinal class ResourceGridViewTest extends TestCase\n{\n    private const GRID_DATA = ['foo', 'bar'];\n\n    private ResourceGridView $gridView;\n\n    private MetadataInterface $resourceMetadata;\n\n    private RequestConfiguration $requestConfiguration;\n\n    protected function setUp(): void\n    {\n        $this->resourceMetadata = $this->createMock(MetadataInterface::class);\n        $this->requestConfiguration = $this->createMock(RequestConfiguration::class);\n        $this->gridView = $this->createResourceGridView();\n    }\n\n    public function testItExtendsDefaultGridView(): void\n    {\n        $this->assertInstanceOf(GridView::class, $this->gridView);\n    }\n\n    public function testItHasResourceMetadata(): void\n    {\n        $this->assertSame($this->resourceMetadata, $this->gridView->getMetadata());\n    }\n\n    public function testItHasRequestConfiguration(): void\n    {\n        $this->assertSame($this->requestConfiguration, $this->gridView->getRequestConfiguration());\n    }\n\n    private function createResourceGridView(): ResourceGridView\n    {\n        return new ResourceGridView(\n            self::GRID_DATA,\n            $this->createMock(Grid::class),\n            new Parameters(),\n            $this->resourceMetadata,\n            $this->requestConfiguration,\n        );\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Provider/RequestParameterProviderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Provider;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Provider\\RequestParameterProvider;\nuse Symfony\\Component\\HttpFoundation\\Request;\n\nfinal class RequestParameterProviderTest extends TestCase\n{\n    /** @test */\n    public function it_returns_request_attribute_parameter_value(): void\n    {\n        $request = new Request(['foo' => 'bar_query'], ['foo' => 'bar_request'], ['foo' => 'bar_attribute']);\n\n        $this->assertSame(RequestParameterProvider::provide($request, 'foo'), 'bar_attribute');\n    }\n\n    /** @test */\n    public function it_returns_request_query_parameter_value(): void\n    {\n        $request = new Request(['foo' => 'bar_query'], ['foo' => 'bar_request'], ['foo_attribute' => 'bar_attribute']);\n\n        $this->assertSame(RequestParameterProvider::provide($request, 'foo'), 'bar_query');\n    }\n\n    /** @test */\n    public function it_returns_request_request_parameter_value(): void\n    {\n        $request = new Request(['foo_query' => 'bar_query'], ['foo' => 'bar_request'], ['foo_attribute' => 'bar_attribute']);\n\n        $this->assertSame(RequestParameterProvider::provide($request, 'foo'), 'bar_request');\n    }\n\n    /** @test */\n    public function it_returns_null_or_default_value_if_parameter_is_not_set(): void\n    {\n        $request = new Request(['foo_query' => 'bar_query'], ['foo_request' => 'bar_request'], ['foo_attribute' => 'bar_attribute']);\n\n        $this->assertSame(RequestParameterProvider::provide($request, 'foo'), null);\n        $this->assertSame(RequestParameterProvider::provide($request, 'foo', 'default'), 'default');\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Resource/ResourceServicesTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Resource;\n\nuse App\\Entity\\Book;\nuse App\\Entity\\ComicBook;\nuse App\\Repository\\BookRepository;\nuse Doctrine\\Bundle\\DoctrineBundle\\Repository\\ServiceEntityRepository;\nuse Doctrine\\ORM\\EntityManager;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\ResourceController;\nuse Sylius\\Resource\\Doctrine\\Persistence\\RepositoryInterface;\nuse Sylius\\Resource\\Factory\\FactoryInterface;\nuse Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase;\n\nfinal class ResourceServicesTest extends WebTestCase\n{\n    /**\n     * @test\n     */\n    public function it_allows_to_access_resource_services_from_container(): void\n    {\n        $client = parent::createClient();\n\n        $repository = $client->getContainer()->get('app.repository.book');\n        $this->assertInstanceOf(RepositoryInterface::class, $repository);\n\n        $repository = $client->getContainer()->get('app.repository.comic_book');\n        $this->assertInstanceOf(ServiceEntityRepository::class, $repository);\n\n        $manager = $client->getContainer()->get('app.manager.book');\n        $this->assertInstanceOf(EntityManager::class, $manager);\n\n        $controller = $client->getContainer()->get('app.controller.book');\n        $this->assertInstanceOf(ResourceController::class, $controller);\n\n        $factory = $client->getContainer()->get('app.factory.book');\n        $this->assertInstanceOf(FactoryInterface::class, $factory);\n    }\n\n    /**\n     * @test\n     */\n    public function it_will_return_the_same_repository_instance()\n    {\n        $client = parent::createClient();\n        $repository = self::getContainer()->get(BookRepository::class);\n\n        $repositoryAlias = $client->getContainer()->get('app.repository.book');\n        $this->assertSame($repository, $repositoryAlias);\n\n        $em = $client->getContainer()->get('app.manager.book');\n        $repositoryAlias = $em->getRepository(Book::class);\n        $this->assertSame($repository, $repositoryAlias);\n\n        $em = $client->getContainer()->get('doctrine.orm.entity_manager');\n        $repositoryAlias = $em->getRepository(Book::class);\n        $this->assertSame($repository, $repositoryAlias);\n    }\n\n    /**\n     * @test\n     */\n    public function it_will_return_the_same_repository_instance_for_default_repositories()\n    {\n        $client = parent::createClient();\n        $em = $client->getContainer()->get('doctrine.orm.entity_manager');\n        $repository = $client->getContainer()->get('app.repository.comic_book');\n        $repositoryAlias = $em->getRepository(ComicBook::class);\n\n        $this->assertInstanceOf(RepositoryInterface::class, $repository);\n        $this->assertSame($repository, $repositoryAlias);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Routing/CrudRoutesAttributesLoaderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Routing;\n\nuse Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase;\n\nfinal class CrudRoutesAttributesLoaderTest extends KernelTestCase\n{\n    /**\n     * @test\n     */\n    public function it_generates_crud_routes_from_resource_alias(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.crud_routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        // Test index\n        $bookIndex = $routesCollection->get('app_book_index');\n        $this->assertNotNull($bookIndex);\n        $this->assertEquals($this->isRoutingPathBcLayerEnabled() ? '/books/' : '/books', $bookIndex->getPath());\n        $this->assertEquals(['GET'], $bookIndex->getMethods());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::indexAction',\n            '_sylius' => [\n                'permission' => false,\n            ],\n        ], $bookIndex->getDefaults());\n\n        // Test create\n        $bookCreate = $routesCollection->get('app_book_create');\n        $this->assertNotNull($bookCreate);\n        $this->assertEquals('/books/new', $bookCreate->getPath());\n        $this->assertEquals(['GET', 'POST'], $bookCreate->getMethods());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::createAction',\n            '_sylius' => [\n                'permission' => false,\n            ],\n        ], $bookCreate->getDefaults());\n\n        // Test show\n        $bookShow = $routesCollection->get('app_book_show');\n        $this->assertNotNull($bookShow);\n        $this->assertEquals('/books/{id}', $bookShow->getPath());\n        $this->assertEquals(['GET'], $bookShow->getMethods());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::showAction',\n            '_sylius' => [\n                'permission' => false,\n            ],\n        ], $bookShow->getDefaults());\n\n        // Test update\n        $bookUpdate = $routesCollection->get('app_book_update');\n        $this->assertNotNull($bookUpdate);\n        $this->assertEquals($this->isRoutingPathBcLayerEnabled() ? ['GET', 'PUT', 'PATCH'] : ['GET', 'PUT', 'PATCH', 'POST'], $bookUpdate->getMethods());\n        $this->assertEquals('/books/{id}/edit', $bookUpdate->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::updateAction',\n            '_sylius' => [\n                'permission' => false,\n            ],\n        ], $bookUpdate->getDefaults());\n\n        // Test delete\n        $bookDelete = $routesCollection->get('app_book_delete');\n        $this->assertNotNull($bookDelete);\n        $this->assertEquals($this->isRoutingPathBcLayerEnabled() ? '/books/{id}' : '/books/{id}/delete', $bookDelete->getPath());\n        $this->assertEquals($this->isRoutingPathBcLayerEnabled() ? ['DELETE'] : ['DELETE', 'POST'], $bookDelete->getMethods());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::deleteAction',\n            '_sylius' => [\n                'permission' => false,\n            ],\n        ], $bookDelete->getDefaults());\n    }\n\n    /**\n     * @test\n     */\n    public function it_generates_crud_routes_from_resource_with_section(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.crud_routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        // Test index\n        $bookIndex = $routesCollection->get('app_admin_book_index');\n        $this->assertNotNull($bookIndex);\n\n        // Test create\n        $bookCreate = $routesCollection->get('app_admin_book_create');\n        $this->assertNotNull($bookCreate);\n\n        // Test show\n        $bookShow = $routesCollection->get('app_admin_book_show');\n        $this->assertNotNull($bookShow);\n\n        // Test update\n        $bookUpdate = $routesCollection->get('app_admin_book_update');\n        $this->assertNotNull($bookUpdate);\n\n        // Test delete\n        $bookDelete = $routesCollection->get('app_admin_book_delete');\n        $this->assertNotNull($bookDelete);\n    }\n\n    /**\n     * @test\n     */\n    public function it_generates_crud_routes_from_resource_with_criteria(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.crud_routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $section = 'criteria';\n\n        // Test index\n        $bookIndex = $routesCollection->get(sprintf('app_%s_book_index', $section));\n        $this->assertNotNull($bookIndex);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'criteria' => [\n                'library' => '$libraryId',\n            ],\n        ], $bookIndex->getDefault('_sylius'));\n\n        // Test create\n        $bookCreate = $routesCollection->get(sprintf('app_%s_book_create', $section));\n        $this->assertNotNull($bookCreate);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'criteria' => [\n                'library' => '$libraryId',\n            ],\n        ], $bookCreate->getDefault('_sylius'));\n\n        // Test show\n        $bookShow = $routesCollection->get(sprintf('app_%s_book_show', $section));\n        $this->assertNotNull($bookShow);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'criteria' => [\n                'library' => '$libraryId',\n            ],\n        ], $bookShow->getDefault('_sylius'));\n\n        // Test update\n        $bookUpdate = $routesCollection->get(sprintf('app_%s_book_update', $section));\n        $this->assertNotNull($bookUpdate);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'criteria' => [\n                'library' => '$libraryId',\n            ],\n        ], $bookUpdate->getDefault('_sylius'));\n\n        // Test delete\n        $bookDelete = $routesCollection->get(sprintf('app_%s_book_delete', $section));\n        $this->assertNotNull($bookDelete);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'criteria' => [\n                'library' => '$libraryId',\n            ],\n        ], $bookDelete->getDefault('_sylius'));\n    }\n\n    /**\n     * @test\n     */\n    public function it_generates_crud_routes_from_resource_with_templates(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.crud_routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $section = 'template';\n\n        // Test index\n        $bookIndex = $routesCollection->get(sprintf('app_%s_book_index', $section));\n        $this->assertNotNull($bookIndex);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'template' => 'backend/crud/index.html.twig',\n        ], $bookIndex->getDefault('_sylius'));\n\n        // Test create\n        $bookCreate = $routesCollection->get(sprintf('app_%s_book_create', $section));\n        $this->assertNotNull($bookCreate);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'template' => 'backend/crud/create.html.twig',\n        ], $bookCreate->getDefault('_sylius'));\n\n        // Test show\n        $bookShow = $routesCollection->get(sprintf('app_%s_book_show', $section));\n        $this->assertNotNull($bookShow);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'template' => 'backend/crud/show.html.twig',\n        ], $bookShow->getDefault('_sylius'));\n\n        // Test update\n        $bookUpdate = $routesCollection->get(sprintf('app_%s_book_update', $section));\n        $this->assertNotNull($bookUpdate);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'template' => 'backend/crud/update.html.twig',\n        ], $bookUpdate->getDefault('_sylius'));\n\n        // Test delete\n        $bookDelete = $routesCollection->get(sprintf('app_%s_book_delete', $section));\n        $this->assertNotNull($bookDelete);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n        ], $bookDelete->getDefault('_sylius'));\n    }\n\n    /**\n     * @test\n     */\n    public function it_generates_crud_routes_from_resource_with_grids(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.crud_routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $section = 'grid';\n\n        // Test index\n        $bookIndex = $routesCollection->get(sprintf('app_%s_book_index', $section));\n        $this->assertNotNull($bookIndex);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'grid' => 'app_book',\n        ], $bookIndex->getDefault('_sylius'));\n\n        // Test create\n        $bookCreate = $routesCollection->get(sprintf('app_%s_book_create', $section));\n        $this->assertNotNull($bookCreate);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n        ], $bookCreate->getDefault('_sylius'));\n\n        // Test show\n        $bookShow = $routesCollection->get(sprintf('app_%s_book_show', $section));\n        $this->assertNotNull($bookShow);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n        ], $bookShow->getDefault('_sylius'));\n\n        // Test update\n        $bookUpdate = $routesCollection->get(sprintf('app_%s_book_update', $section));\n        $this->assertNotNull($bookUpdate);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n        ], $bookUpdate->getDefault('_sylius'));\n\n        // Test delete\n        $bookDelete = $routesCollection->get(sprintf('app_%s_book_delete', $section));\n        $this->assertNotNull($bookDelete);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n        ], $bookDelete->getDefault('_sylius'));\n    }\n\n    /**\n     * @test\n     */\n    public function it_generates_crud_routes_from_resource_with_vars(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.crud_routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $section = 'vars';\n\n        // Test index\n        $bookIndex = $routesCollection->get(sprintf('app_%s_book_index', $section));\n        $this->assertNotNull($bookIndex);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'vars' => [\n                'subheader' => 'app.ui.manage_your_books',\n                'icon' => 'book',\n            ],\n        ], $bookIndex->getDefault('_sylius'));\n\n        // Test create\n        $bookCreate = $routesCollection->get(sprintf('app_%s_book_create', $section));\n        $this->assertNotNull($bookCreate);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'vars' => [\n                'subheader' => 'app.ui.manage_your_books',\n            ],\n        ], $bookCreate->getDefault('_sylius'));\n\n        // Test show\n        $bookShow = $routesCollection->get(sprintf('app_%s_book_show', $section));\n        $this->assertNotNull($bookShow);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'vars' => [\n                'subheader' => 'app.ui.manage_your_books',\n            ],\n        ], $bookShow->getDefault('_sylius'));\n\n        // Test update\n        $bookUpdate = $routesCollection->get(sprintf('app_%s_book_update', $section));\n        $this->assertNotNull($bookUpdate);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'vars' => [\n                'subheader' => 'app.ui.manage_your_books',\n            ],\n        ], $bookUpdate->getDefault('_sylius'));\n\n        // Test delete\n        $bookDelete = $routesCollection->get(sprintf('app_%s_book_delete', $section));\n        $this->assertNotNull($bookDelete);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'vars' => [\n                'subheader' => 'app.ui.manage_your_books',\n            ],\n        ], $bookDelete->getDefault('_sylius'));\n    }\n\n    /**\n     * @test\n     */\n    public function it_generates_crud_routes_from_resource_with_redirect(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.crud_routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $section = 'redirect';\n\n        // Test index\n        $bookIndex = $routesCollection->get(sprintf('app_%s_book_index', $section));\n        $this->assertNotNull($bookIndex);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n        ], $bookIndex->getDefault('_sylius'));\n\n        // Test create\n        $bookCreate = $routesCollection->get(sprintf('app_%s_book_create', $section));\n        $this->assertNotNull($bookCreate);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'redirect' => 'app_redirect_book_update',\n        ], $bookCreate->getDefault('_sylius'));\n\n        // Test show\n        $bookShow = $routesCollection->get(sprintf('app_%s_book_show', $section));\n        $this->assertNotNull($bookShow);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n        ], $bookShow->getDefault('_sylius'));\n\n        // Test update\n        $bookUpdate = $routesCollection->get(sprintf('app_%s_book_update', $section));\n        $this->assertNotNull($bookUpdate);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n            'redirect' => 'app_redirect_book_update',\n        ], $bookUpdate->getDefault('_sylius'));\n\n        // Test delete\n        $bookDelete = $routesCollection->get(sprintf('app_%s_book_delete', $section));\n        $this->assertNotNull($bookDelete);\n        $this->assertEquals([\n            'permission' => false,\n            'section' => $section,\n        ], $bookDelete->getDefault('_sylius'));\n    }\n\n    /**\n     * @test\n     */\n    public function it_generates_crud_routes_from_resource_with_permission(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.crud_routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $section = 'permission';\n\n        // Test index\n        $bookIndex = $routesCollection->get(sprintf('app_%s_book_index', $section));\n        $this->assertNotNull($bookIndex);\n        $this->assertEquals([\n            'permission' => true,\n            'section' => $section,\n        ], $bookIndex->getDefault('_sylius'));\n\n        // Test create\n        $bookCreate = $routesCollection->get(sprintf('app_%s_book_create', $section));\n        $this->assertNotNull($bookCreate);\n        $this->assertEquals([\n            'permission' => true,\n            'section' => $section,\n        ], $bookCreate->getDefault('_sylius'));\n\n        // Test show\n        $bookShow = $routesCollection->get(sprintf('app_%s_book_show', $section));\n        $this->assertNotNull($bookShow);\n        $this->assertEquals([\n            'permission' => true,\n            'section' => $section,\n        ], $bookShow->getDefault('_sylius'));\n\n        // Test update\n        $bookUpdate = $routesCollection->get(sprintf('app_%s_book_update', $section));\n        $this->assertNotNull($bookUpdate);\n        $this->assertEquals([\n            'permission' => true,\n            'section' => $section,\n        ], $bookUpdate->getDefault('_sylius'));\n\n        // Test delete\n        $bookDelete = $routesCollection->get('app_permission_book_delete');\n        $this->assertNotNull($bookDelete);\n        $this->assertEquals([\n            'permission' => true,\n            'section' => $section,\n        ], $bookDelete->getDefault('_sylius'));\n    }\n\n    /**\n     * @test\n     */\n    public function it_generates_crud_routes_from_resource_with_except(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.crud_routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $section = 'except';\n\n        // Test create\n        $bookCreate = $routesCollection->get(sprintf('app_%s_book_create', $section));\n        $this->assertNull($bookCreate);\n\n        // Test show\n        $bookShow = $routesCollection->get(sprintf('app_%s_book_show', $section));\n        $this->assertNull($bookShow);\n\n        // Test index\n        $bookIndex = $routesCollection->get(sprintf('app_%s_book_index', $section));\n        $this->assertNotNull($bookIndex);\n\n        // Test update\n        $bookUpdate = $routesCollection->get(sprintf('app_%s_book_update', $section));\n        $this->assertNotNull($bookUpdate);\n\n        // Test delete\n        $bookDelete = $routesCollection->get(sprintf('app_%s_book_delete', $section));\n        $this->assertNotNull($bookDelete);\n    }\n\n    /**\n     * @test\n     */\n    public function it_generates_crud_routes_from_resource_with_only(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.crud_routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $section = 'only';\n\n        // Test index\n        $bookIndex = $routesCollection->get(sprintf('app_%s_book_index', $section));\n        $this->assertNotNull($bookIndex);\n\n        // Test update\n        $bookUpdate = $routesCollection->get(sprintf('app_%s_book_update', $section));\n        $this->assertNotNull($bookUpdate);\n\n        // Test show\n        $bookShow = $routesCollection->get(sprintf('app_%s_book_show', $section));\n        $this->assertNull($bookShow);\n\n        // Test delete\n        $bookDelete = $routesCollection->get(sprintf('app_%s_book_delete', $section));\n        $this->assertNull($bookDelete);\n\n        // Test create\n        $bookCreate = $routesCollection->get(sprintf('app_%s_book_create', $section));\n        $this->assertNull($bookCreate);\n    }\n\n    /**\n     * @test\n     */\n    public function it_generates_crud_routes_from_resource_with_legacy_attribute(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.crud_routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $section = 'legacy_attribute';\n\n        // Test index\n        $bookIndex = $routesCollection->get(sprintf('app_%s_book_index', $section));\n        $this->assertNotNull($bookIndex);\n\n        // Test update\n        $bookUpdate = $routesCollection->get(sprintf('app_%s_book_update', $section));\n        $this->assertNotNull($bookUpdate);\n\n        // Test show\n        $bookShow = $routesCollection->get(sprintf('app_%s_book_show', $section));\n        $this->assertNotNull($bookShow);\n\n        // Test delete\n        $bookDelete = $routesCollection->get(sprintf('app_%s_book_delete', $section));\n        $this->assertNotNull($bookDelete);\n\n        // Test create\n        $bookCreate = $routesCollection->get(sprintf('app_%s_book_create', $section));\n        $this->assertNotNull($bookCreate);\n    }\n\n    private function isRoutingPathBcLayerEnabled(): bool\n    {\n        return (bool) $this->getContainer()->getParameter('sylius.routing_path_bc_layer');\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Routing/ResourceLoaderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Routing;\n\nuse Behat\\Transliterator\\Transliterator;\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Routing\\ResourceLoader;\nuse Sylius\\Bundle\\ResourceBundle\\Routing\\RouteFactoryInterface;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\RegistryInterface;\nuse Symfony\\Component\\Config\\Loader\\LoaderInterface;\nuse Symfony\\Component\\Routing\\Route;\nuse Symfony\\Component\\Routing\\RouteCollection;\n\nfinal class ResourceLoaderTest extends TestCase\n{\n    public function testItIsASymfonyRoutingLoader(): void\n    {\n        $loader = $this->createLoader();\n\n        $this->assertInstanceOf(LoaderInterface::class, $loader);\n    }\n\n    public function testItThrowsExceptionWhenBothOnlyAndExceptOptionsAreConfigured(): void\n    {\n        $loader = $this->createLoader();\n\n        $resource = <<<YAML\nalias: sylius.product\nexcept: ['show', 'delete']\nonly: ['create']\nYAML;\n\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage('You can configure only one of \"except\" & \"only\" options.');\n\n        $loader->load($resource, 'sylius.resource');\n    }\n\n    public function testItSupportsSyliusResourceType(): void\n    {\n        $loader = $this->createLoader();\n\n        $this->assertTrue($loader->supports('resource', 'sylius.resource'));\n    }\n\n    public function testItSupportsSyliusResourceApiType(): void\n    {\n        $loader = $this->createLoader();\n\n        $this->assertTrue($loader->supports('resource', 'sylius.resource_api'));\n    }\n\n    public function testItDoesNotSupportOtherTypes(): void\n    {\n        $loader = $this->createLoader();\n\n        $this->assertFalse($loader->supports('resource', 'other_type'));\n    }\n\n    public function testItGeneratesRoutingBasedOnResourceConfiguration(): void\n    {\n        $loader = $this->createLoaderWithMockedDependencies();\n\n        $resource = <<<YAML\nalias: sylius.product\nYAML;\n\n        $result = $loader->load($resource, 'sylius.resource');\n\n        $this->assertInstanceOf(RouteCollection::class, $result);\n        $this->assertNotNull($result->get('sylius_product_index'));\n        $this->assertNotNull($result->get('sylius_product_show'));\n        $this->assertNotNull($result->get('sylius_product_create'));\n        $this->assertNotNull($result->get('sylius_product_update'));\n        $this->assertNotNull($result->get('sylius_product_delete'));\n        $this->assertNotNull($result->get('sylius_product_bulk_delete'));\n    }\n\n    public function testItIncludesOnlySpecificRoutesIfConfigured(): void\n    {\n        $loader = $this->createLoaderWithMockedDependencies();\n\n        $resource = <<<YAML\nalias: sylius.product\nonly: ['create', 'index']\nYAML;\n\n        $result = $loader->load($resource, 'sylius.resource');\n\n        $this->assertNotNull($result->get('sylius_product_index'));\n        $this->assertNotNull($result->get('sylius_product_create'));\n        $this->assertNull($result->get('sylius_product_show'));\n        $this->assertNull($result->get('sylius_product_update'));\n        $this->assertNull($result->get('sylius_product_delete'));\n        $this->assertNull($result->get('sylius_product_bulk_delete'));\n    }\n\n    public function testItExcludesSpecificRoutesIfConfigured(): void\n    {\n        $loader = $this->createLoaderWithMockedDependencies();\n\n        $resource = <<<YAML\nalias: sylius.product\nexcept: ['show', 'delete', 'bulkDelete']\nYAML;\n\n        $result = $loader->load($resource, 'sylius.resource');\n\n        $this->assertNotNull($result->get('sylius_product_index'));\n        $this->assertNotNull($result->get('sylius_product_create'));\n        $this->assertNotNull($result->get('sylius_product_update'));\n        $this->assertNull($result->get('sylius_product_show'));\n        $this->assertNull($result->get('sylius_product_delete'));\n        $this->assertNull($result->get('sylius_product_bulk_delete'));\n    }\n\n    public function testItGeneratesApiRoutingWithoutBulkDelete(): void\n    {\n        $loader = $this->createLoaderWithMockedDependencies();\n\n        $resource = <<<YAML\nalias: sylius.product\nYAML;\n\n        $result = $loader->load($resource, 'sylius.resource_api');\n\n        $this->assertNotNull($result->get('sylius_product_index'));\n        $this->assertNotNull($result->get('sylius_product_show'));\n        $this->assertNotNull($result->get('sylius_product_create'));\n        $this->assertNotNull($result->get('sylius_product_update'));\n        $this->assertNotNull($result->get('sylius_product_delete'));\n        $this->assertNull($result->get('sylius_product_bulk_delete'));\n    }\n\n    public function testItGeneratesRoutingWithCustomFormConfiguration(): void\n    {\n        $loader = $this->createLoaderWithMockedDependencies();\n\n        $resource = <<<YAML\nalias: sylius.product\nform: sylius_product_custom\nonly: ['create', 'update']\nYAML;\n\n        $result = $loader->load($resource, 'sylius.resource');\n\n        $this->assertRouteHasSyliusOption($result->get('sylius_product_create'), 'form', 'sylius_product_custom');\n        $this->assertRouteHasSyliusOption($result->get('sylius_product_update'), 'form', 'sylius_product_custom');\n    }\n\n    public function testItGeneratesRoutingWithSerializationVersion(): void\n    {\n        $loader = $this->createLoaderWithMockedDependencies();\n\n        $resource = <<<YAML\nalias: sylius.product\nserialization_version: 1.0\nonly: ['index', 'show']\nYAML;\n\n        $result = $loader->load($resource, 'sylius.resource');\n\n        $this->assertRouteHasSyliusOption($result->get('sylius_product_index'), 'serialization_version', '1.0');\n        $this->assertRouteHasSyliusOption($result->get('sylius_product_show'), 'serialization_version', '1.0');\n    }\n\n    public function testItGeneratesRoutingWithFilterableOption(): void\n    {\n        $loader = $this->createLoaderWithMockedDependencies();\n\n        $resource = <<<YAML\nalias: sylius.product\nfilterable: true\nonly: ['index']\nYAML;\n\n        $result = $loader->load($resource, 'sylius.resource');\n\n        $this->assertRouteHasSyliusOption($result->get('sylius_product_index'), 'filterable', true);\n    }\n\n    public function testItGeneratesRoutingWithFilterableFalse(): void\n    {\n        $loader = $this->createLoaderWithMockedDependencies();\n\n        $resource = <<<YAML\nalias: sylius.product\nfilterable: false\nonly: ['index']\nYAML;\n\n        $result = $loader->load($resource, 'sylius.resource');\n\n        $this->assertRouteHasSyliusOption($result->get('sylius_product_index'), 'filterable', false);\n    }\n\n    public function testItGeneratesRoutingWithBcLayerDisabled(): void\n    {\n        $loader = $this->createLoaderWithMockedDependencies(false);\n\n        $resource = <<<YAML\nalias: sylius.product\nonly: ['delete']\nYAML;\n\n        $result = $loader->load($resource, 'sylius.resource');\n\n        $deleteRoute = $result->get('sylius_product_delete');\n        $this->assertNotNull($deleteRoute);\n        $this->assertContains('DELETE', $deleteRoute->getMethods());\n        $this->assertContains('POST', $deleteRoute->getMethods());\n        $this->assertEquals('/products/{id}/delete', $deleteRoute->getPath());\n    }\n\n    public function testItGeneratesRoutingWithBcLayerEnabled(): void\n    {\n        $this->markAsSkippedIfBcLayerCannotBeEnabled();\n\n        $loader = $this->createLoaderWithMockedDependencies(true);\n\n        $resource = <<<YAML\nalias: sylius.product\nonly: ['delete']\nYAML;\n\n        $result = $loader->load($resource, 'sylius.resource');\n\n        $deleteRoute = $result->get('sylius_product_delete');\n        $this->assertNotNull($deleteRoute);\n        $this->assertEquals(['DELETE'], $deleteRoute->getMethods());\n        $this->assertNotContains('POST', $deleteRoute->getMethods());\n        $this->assertEquals('/products/{id}', $deleteRoute->getPath());\n    }\n\n    public function testItGeneratesBulkDeleteRoutingWithBcLayerDisabled(): void\n    {\n        $loader = $this->createLoaderWithMockedDependencies(false);\n\n        $resource = <<<YAML\nalias: sylius.product\nonly: ['bulkDelete']\nYAML;\n\n        $result = $loader->load($resource, 'sylius.resource');\n\n        $bulkDeleteRoute = $result->get('sylius_product_bulk_delete');\n        $this->assertNotNull($bulkDeleteRoute);\n        $this->assertContains('DELETE', $bulkDeleteRoute->getMethods());\n        $this->assertContains('POST', $bulkDeleteRoute->getMethods());\n        $this->assertEquals('/products/bulk-delete', $bulkDeleteRoute->getPath());\n    }\n\n    public function testItGeneratesBulkDeleteRoutingWithBcLayerEnabled(): void\n    {\n        $this->markAsSkippedIfBcLayerCannotBeEnabled();\n\n        $loader = $this->createLoaderWithMockedDependencies(true);\n\n        $resource = <<<YAML\nalias: sylius.product\nonly: ['bulkDelete']\nYAML;\n\n        $result = $loader->load($resource, 'sylius.resource');\n\n        $bulkDeleteRoute = $result->get('sylius_product_bulk_delete');\n        $this->assertNotNull($bulkDeleteRoute);\n        $this->assertEquals(['DELETE'], $bulkDeleteRoute->getMethods());\n        $this->assertNotContains('POST', $bulkDeleteRoute->getMethods());\n        $this->assertEquals('/products/bulk-delete', $bulkDeleteRoute->getPath());\n    }\n\n    public function testItGeneratesUpdateRoutingWithBcLayerDisabled(): void\n    {\n        $loader = $this->createLoaderWithMockedDependencies(false);\n\n        $resource = <<<YAML\nalias: sylius.product\nonly: ['update']\nYAML;\n\n        $result = $loader->load($resource, 'sylius.resource');\n\n        $updateRoute = $result->get('sylius_product_update');\n        $this->assertNotNull($updateRoute);\n        $this->assertContains('GET', $updateRoute->getMethods());\n        $this->assertContains('PUT', $updateRoute->getMethods());\n        $this->assertContains('PATCH', $updateRoute->getMethods());\n        $this->assertContains('POST', $updateRoute->getMethods());\n    }\n\n    private function createLoader(?bool $bcLayerEnabled = null): ResourceLoader\n    {\n        $registry = $this->createMock(RegistryInterface::class);\n        $routeFactory = $this->createMock(RouteFactoryInterface::class);\n\n        return new ResourceLoader($registry, $routeFactory, null, $bcLayerEnabled);\n    }\n\n    private function createLoaderWithMockedDependencies(?bool $bcLayerEnabled = null): ResourceLoader\n    {\n        $registry = $this->createMock(RegistryInterface::class);\n        $metadata = $this->createMock(MetadataInterface::class);\n        $routeFactory = $this->createMock(RouteFactoryInterface::class);\n        $routeCollection = new RouteCollection();\n\n        $metadata->method('getApplicationName')->willReturn('sylius');\n        $metadata->method('getName')->willReturn('product');\n        $metadata->method('getPluralName')->willReturn('products');\n        $metadata->method('getServiceId')->willReturn('sylius.controller.product');\n\n        $registry->method('get')->with('sylius.product')->willReturn($metadata);\n        $routeFactory->method('createRouteCollection')->willReturn($routeCollection);\n        $routeFactory->method('createRoute')->willReturnCallback(\n            fn (string $path, array $defaults, array $requirements = [], array $options = [], string $host = '', array $schemes = [], array $methods = []) => new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods),\n        );\n\n        return new ResourceLoader($registry, $routeFactory, null, $bcLayerEnabled);\n    }\n\n    private function assertRouteHasSyliusOption(?Route $route, string $key, mixed $expectedValue): void\n    {\n        $this->assertNotNull($route);\n        $this->assertArrayHasKey('_sylius', $route->getDefaults());\n        $this->assertArrayHasKey($key, $route->getDefaults()['_sylius']);\n        $this->assertEquals($expectedValue, $route->getDefaults()['_sylius'][$key]);\n    }\n\n    private function markAsSkippedIfBcLayerCannotBeEnabled(): void\n    {\n        if (!class_exists(Transliterator::class)) {\n            $this->markTestSkipped('This test requires The Behat Transliterator.');\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Routing/RoutesAttributesLoaderTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Routing;\n\nuse Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase;\nuse Symfony\\Component\\HttpKernel\\Kernel;\nuse Symfony\\Component\\Routing\\RouteCompiler;\nuse winzou\\Bundle\\StateMachineBundle\\winzouStateMachineBundle;\n\nfinal class RoutesAttributesLoaderTest extends KernelTestCase\n{\n    /** @test */\n    public function it_generates_routes_from_resource(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book');\n        $this->assertNotNull($route);\n        $this->assertEquals('/book/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::showAction',\n            '_sylius' => [],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_methods(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_methods');\n        $this->assertNotNull($route);\n        $this->assertEquals('/book/{id}', $route->getPath());\n        $this->assertEquals(['GET'], $route->getMethods());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::showAction',\n            '_sylius' => [],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_criteria(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_criteria');\n        $this->assertNotNull($route);\n        $this->assertEquals('/library/{libraryId}/book/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::showAction',\n            '_sylius' => [\n                'criteria' => [\n                    'library' => '$libraryId',\n                ],\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_template(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_template');\n        $this->assertNotNull($route);\n        $this->assertEquals('/book/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::showAction',\n            '_sylius' => [\n                'template' => 'book/show.html.twig',\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_repository(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_repository');\n        $this->assertNotNull($route);\n        $this->assertEquals('/book/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::showAction',\n            '_sylius' => [\n                'repository' => [\n                    'method' => 'findOneNewestByAuthor',\n                    'arguments' => '[$author]',\n                ],\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_serialization_groups(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_serialization_groups');\n        $this->assertNotNull($route);\n        $this->assertEquals('/book/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::showAction',\n            '_sylius' => [\n                'serialization_groups' => ['sylius'],\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_serialization_version(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_serialization_version');\n        $this->assertNotNull($route);\n        $this->assertEquals('/book/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::showAction',\n            '_sylius' => [\n                'serialization_version' => '1.0',\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_vars(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_vars');\n        $this->assertNotNull($route);\n        $this->assertEquals('/book/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::showAction',\n            '_sylius' => [\n                'vars' => [\n                    'foo' => 'bar',\n                ],\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_requirements(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_requirements');\n        $this->assertNotNull($route);\n        $this->assertEquals('/book/{id}', $route->getPath());\n        $this->assertEquals([\n            'id' => '\\d+',\n        ], $route->getRequirements());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_priority(): void\n    {\n        if (Kernel::MAJOR_VERSION < 5) {\n            $this->markTestSkipped();\n        }\n\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_priority');\n        $this->assertNotNull($route);\n        $this->assertSame($route, array_values($routesCollection->all())[0]);\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_options(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_options');\n        $this->assertNotNull($route);\n        $this->assertEquals('/book/{id}', $route->getPath());\n        $this->assertEquals([\n            'compiler_class' => RouteCompiler::class,\n            'utf8' => true,\n        ], $route->getOptions());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_host(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_host');\n        $this->assertNotNull($route);\n        $this->assertEquals('/book/{id}', $route->getPath());\n        $this->assertEquals('m.example.com', $route->getHost());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_schemes(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_schemes');\n        $this->assertNotNull($route);\n        $this->assertEquals('/book/{id}', $route->getPath());\n        $this->assertEquals(['https'], $route->getSchemes());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_form(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('register_user_with_form');\n        $this->assertNotNull($route);\n        $this->assertEquals('/users/register', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.user:createAction',\n            '_sylius' => [\n                'form' => 'App\\Form\\Type\\RegisterType',\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_form_options(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('register_user_with_form_options');\n        $this->assertNotNull($route);\n        $this->assertEquals('/users/register', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.user:createAction',\n            '_sylius' => [\n                'form' => [\n                    'type' => 'App\\Form\\Type\\RegisterType',\n                    'options' => [\n                        'validation_groups' => ['sylius', 'my_custom_group'],\n                    ],\n                ],\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_section(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_section');\n        $this->assertNotNull($route);\n        $this->assertEquals('/books/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::showAction',\n            '_sylius' => [\n                'section' => 'admin',\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_permission(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_permission');\n        $this->assertNotNull($route);\n        $this->assertEquals('/books/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::showAction',\n            '_sylius' => [\n                'permission' => true,\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_grid(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_grid');\n        $this->assertNotNull($route);\n        $this->assertEquals('/books/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::showAction',\n            '_sylius' => [\n                'grid' => 'book',\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_csrf_protection(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_csrf_protection');\n        $this->assertNotNull($route);\n        $this->assertEquals('/books/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::showAction',\n            '_sylius' => [\n                'csrf_protection' => false,\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_redirect(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('update_book_with_redirect');\n        $this->assertNotNull($route);\n        $this->assertEquals('/books/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::showAction',\n            '_sylius' => [\n                'redirect' => 'referer',\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_redirect_options(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('update_book_with_redirect_options');\n        $this->assertNotNull($route);\n        $this->assertEquals('/genre/{genreId}/books/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::updateAction',\n            '_sylius' => [\n                'redirect' => [\n                    'route' => 'app_genre_show',\n                    'parameters' => ['id' => '$genreId'],\n                ],\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_state_machine(): void\n    {\n        $this->markAsSkippedIfWinzouStateMachineIsNotAvailable();\n\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('publish_book');\n        $this->assertNotNull($route);\n        $this->assertEquals('/books/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::applyStateMachineTransitionAction',\n            '_sylius' => [\n                'state_machine' => [\n                    'graph' => 'app_book',\n                    'transition' => 'publish',\n                ],\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_custom_event_name(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('update_book_with_custom_event_name');\n        $this->assertNotNull($route);\n        $this->assertEquals('/books/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::updateAction',\n            '_sylius' => [\n                'event' => 'customer_update',\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_return_content(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('update_book_with_return_content');\n        $this->assertNotNull($route);\n        $this->assertEquals('/books/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::updateAction',\n            '_sylius' => [\n                'return_content' => true,\n            ],\n        ], $route->getDefaults());\n    }\n\n    /** @test */\n    public function it_generates_routes_from_resource_with_legacy_attribute(): void\n    {\n        self::bootKernel(['environment' => 'test_with_attributes']);\n\n        $container = self::getContainer();\n\n        $attributesLoader = $container->get('sylius.routing.loader.routes_attributes');\n\n        $routesCollection = $attributesLoader->__invoke();\n\n        $route = $routesCollection->get('show_book_with_legacy_attribute');\n        $this->assertNotNull($route);\n        $this->assertEquals('/book/{id}', $route->getPath());\n        $this->assertEquals([\n            '_controller' => 'app.controller.book::showAction',\n            '_sylius' => [],\n        ], $route->getDefaults());\n    }\n\n    private function markAsSkippedIfWinzouStateMachineIsNotAvailable(): void\n    {\n        if (!class_exists(winzouStateMachineBundle::class)) {\n            $this->markTestSkipped('Winzou State machine is not available.');\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Storage/CookieStorageTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Bundle\\Storage;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Storage\\CookieStorage;\nuse Sylius\\Resource\\Storage\\StorageInterface;\n\nfinal class CookieStorageTest extends TestCase\n{\n    private CookieStorage $storage;\n\n    protected function setUp(): void\n    {\n        $this->storage = new CookieStorage();\n    }\n\n    public function testItImplementsStorageInterface(): void\n    {\n        $this->assertInstanceOf(StorageInterface::class, $this->storage);\n    }\n\n    public function testItDoesNotHaveValueWhenNotSetPreviously(): void\n    {\n        $this->assertFalse($this->storage->has('name'));\n        $this->assertNull($this->storage->get('name'));\n    }\n\n    public function testItCanSetAndGetValue(): void\n    {\n        $this->storage->set('name', 'value');\n\n        $this->assertTrue($this->storage->has('name'));\n        $this->assertSame('value', $this->storage->get('name'));\n    }\n\n    public function testItCanRemoveValue(): void\n    {\n        $this->storage->set('name', 'value');\n\n        $this->storage->remove('name');\n\n        $this->assertFalse($this->storage->has('name'));\n        $this->assertNull($this->storage->get('name'));\n    }\n\n    public function testItReturnsDefaultValueWhenKeyNotFound(): void\n    {\n        $this->assertSame('default', $this->storage->get('name', 'default'));\n    }\n\n    public function testItReturnsAllStoredValues(): void\n    {\n        $this->storage->set('foo', 'bar');\n        $this->storage->set('buzz', 'lightyear');\n\n        $this->assertSame([\n            'foo' => 'bar',\n            'buzz' => 'lightyear',\n        ], $this->storage->all());\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Storage/SessionStorageTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Bundle\\Storage;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Storage\\SessionStorage;\nuse Sylius\\Resource\\Exception\\StorageUnavailableException;\nuse Sylius\\Resource\\Storage\\StorageInterface;\nuse Symfony\\Component\\HttpFoundation\\Exception\\SessionNotFoundException;\nuse Symfony\\Component\\HttpFoundation\\RequestStack;\nuse Symfony\\Component\\HttpFoundation\\Session\\Session;\nuse Symfony\\Component\\HttpFoundation\\Session\\Storage\\MockArraySessionStorage;\n\nfinal class SessionStorageTest extends TestCase\n{\n    private SessionStorage $storage;\n\n    protected function setUp(): void\n    {\n        if (method_exists(RequestStack::class, 'getSession')) {\n            $requestStack = $this->createMock(RequestStack::class);\n            $requestStack\n                ->method('getSession')\n                ->willReturn(new Session(new MockArraySessionStorage()));\n\n            $this->storage = new SessionStorage($requestStack);\n\n            return;\n        }\n\n        $this->storage = new SessionStorage(new Session(new MockArraySessionStorage()));\n    }\n\n    public function testItImplementsStorageInterface(): void\n    {\n        $this->assertInstanceOf(StorageInterface::class, $this->storage);\n    }\n\n    /**\n     * @dataProvider storageMethodsDataProvider\n     */\n    public function testItThrowsStorageUnavailableExceptionWhenSessionNotAvailable(callable $method): void\n    {\n        if (!method_exists(RequestStack::class, 'getSession')) {\n            $this->markTestSkipped('RequestStack::getSession() method does not exist in this Symfony version.');\n        }\n\n        $requestStack = $this->createMock(RequestStack::class);\n        $requestStack\n            ->method('getSession')\n            ->willThrowException(new SessionNotFoundException());\n\n        $storage = new SessionStorage($requestStack);\n\n        $this->expectException(StorageUnavailableException::class);\n        $method($storage);\n    }\n\n    /**\n     * @return iterable<string, array{callable(SessionStorage): mixed}>\n     */\n    public static function storageMethodsDataProvider(): iterable\n    {\n        yield 'has' => [fn (SessionStorage $storage) => $storage->has('name')];\n        yield 'get' => [fn (SessionStorage $storage) => $storage->get('name')];\n        yield 'set' => [fn (SessionStorage $storage) => $storage->set('name', 'value')];\n        yield 'remove' => [fn (SessionStorage $storage) => $storage->remove('name')];\n        yield 'all' => [fn (SessionStorage $storage) => $storage->all()];\n    }\n\n    public function testItDoesNotHaveValueWhenNotSetPreviously(): void\n    {\n        $this->assertFalse($this->storage->has('name'));\n        $this->assertNull($this->storage->get('name'));\n    }\n\n    public function testItCanSetAndGetValue(): void\n    {\n        $this->storage->set('name', 'value');\n\n        $this->assertTrue($this->storage->has('name'));\n        $this->assertSame('value', $this->storage->get('name'));\n    }\n\n    public function testItCanRemoveValue(): void\n    {\n        $this->storage->set('name', 'value');\n\n        $this->storage->remove('name');\n\n        $this->assertFalse($this->storage->has('name'));\n        $this->assertNull($this->storage->get('name'));\n    }\n\n    public function testItReturnsDefaultValueWhenKeyNotFound(): void\n    {\n        $this->assertSame('default', $this->storage->get('name', 'default'));\n    }\n\n    public function testItReturnsAllStoredValues(): void\n    {\n        $this->storage->set('foo', 'bar');\n        $this->storage->set('buzz', 'lightyear');\n\n        $this->assertSame([\n            'foo' => 'bar',\n            'buzz' => 'lightyear',\n        ], $this->storage->all());\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/SyliusResourceBundleTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests;\n\nuse PHPUnit\\Framework\\Assert;\nuse Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase;\nuse Symfony\\Component\\DependencyInjection\\ContainerBuilder;\nuse Symfony\\Component\\DependencyInjection\\ContainerInterface;\n\nfinal class SyliusResourceBundleTest extends WebTestCase\n{\n    /**\n     * @test\n     */\n    public function its_services_are_initializable(): void\n    {\n        /** @var ContainerBuilder $container */\n        $container = self::createClient()->getContainer();\n\n        $services = $container->getServiceIds();\n\n        $services = array_filter($services, function (string $serviceId): bool {\n            return str_starts_with($serviceId, 'sylius.');\n        });\n\n        foreach ($services as $id) {\n            Assert::assertNotNull($container->get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE));\n        }\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Twig/Context/LegacyContextFactoryTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Bundle\\Twig\\Context;\n\nuse PHPUnit\\Framework\\TestCase;\nuse Sylius\\Bundle\\ResourceBundle\\Context\\Option\\RequestConfigurationOption;\nuse Sylius\\Bundle\\ResourceBundle\\Controller\\RequestConfiguration;\nuse Sylius\\Bundle\\ResourceBundle\\Twig\\Context\\LegacyContextFactory;\nuse Sylius\\Resource\\Context\\Context;\nuse Sylius\\Resource\\Context\\Option\\MetadataOption;\nuse Sylius\\Resource\\Metadata\\MetadataInterface;\nuse Sylius\\Resource\\Metadata\\Operation;\nuse Sylius\\Resource\\Twig\\Context\\Factory\\ContextFactoryInterface;\n\nfinal class LegacyContextFactoryTest extends TestCase\n{\n    /** @var ContextFactoryInterface&\\PHPUnit\\Framework\\MockObject\\MockObject */\n    private ContextFactoryInterface $decorated;\n\n    private LegacyContextFactory $factory;\n\n    protected function setUp(): void\n    {\n        $this->decorated = $this->createMock(ContextFactoryInterface::class);\n        $this->factory = new LegacyContextFactory($this->decorated);\n    }\n\n    public function testItImplementsContextFactoryInterface(): void\n    {\n        $this->assertInstanceOf(ContextFactoryInterface::class, $this->factory);\n    }\n\n    public function testItAddsLegacyTwigVariablesWhenContextContainsOptions(): void\n    {\n        $data = new \\stdClass();\n        $operation = $this->createMock(Operation::class);\n        $requestConfiguration = $this->createMock(RequestConfiguration::class);\n        $metadata = $this->createMock(MetadataInterface::class);\n\n        $context = new Context(\n            new RequestConfigurationOption($requestConfiguration),\n            new MetadataOption($metadata),\n        );\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('create')\n            ->with($data, $operation, $context)\n            ->willReturn(['resource' => $data]);\n\n        $result = $this->factory->create($data, $operation, $context);\n\n        $this->assertSame([\n            'resource' => $data,\n            'configuration' => $requestConfiguration,\n            'metadata' => $metadata,\n        ], $result);\n    }\n\n    public function testItDoesNotAddLegacyTwigVariablesWhenContextIsEmpty(): void\n    {\n        $data = new \\stdClass();\n        $operation = $this->createMock(Operation::class);\n        $context = new Context();\n\n        $this->decorated\n            ->expects($this->once())\n            ->method('create')\n            ->with($data, $operation, $context)\n            ->willReturn(['resource' => $data]);\n\n        $result = $this->factory->create($data, $operation, $context);\n\n        $this->assertSame(['resource' => $data], $result);\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Validator/DisabledValidatorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Validator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Validator\\Constraints\\Disabled;\nuse Sylius\\Bundle\\ResourceBundle\\Validator\\DisabledValidator;\nuse Sylius\\Resource\\Model\\ToggleableInterface;\nuse Symfony\\Component\\Validator\\Test\\ConstraintValidatorTestCase;\n\n/**\n * @extends ConstraintValidatorTestCase<DisabledValidator>\n */\nfinal class DisabledValidatorTest extends ConstraintValidatorTestCase\n{\n    protected function createValidator(): DisabledValidator\n    {\n        return new DisabledValidator();\n    }\n\n    public function testDoesNotApplyToNullValues(): void\n    {\n        $constraint = new Disabled();\n\n        $this->validator->validate(null, $constraint);\n\n        $this->assertNoViolation();\n    }\n\n    public function testThrowsExceptionIfSubjectDoesNotImplementToggleableInterface(): void\n    {\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage(sprintf(\n            '\"%s\" validates \"%s\" instances only',\n            DisabledValidator::class,\n            ToggleableInterface::class,\n        ));\n\n        $constraint = new Disabled();\n\n        $this->validator->validate(new \\stdClass(), $constraint);\n    }\n\n    public function testAddsViolationWhenResourceIsEnabled(): void\n    {\n        $subject = $this->createMock(ToggleableInterface::class);\n        $subject\n            ->method('isEnabled')\n            ->willReturn(true);\n\n        $constraint = new Disabled();\n\n        $this->validator->validate($subject, $constraint);\n\n        $this->buildViolation($constraint->message)\n            ->assertRaised();\n    }\n\n    public function testDoesNotAddViolationWhenResourceIsDisabled(): void\n    {\n        $subject = $this->createMock(ToggleableInterface::class);\n        $subject\n            ->method('isEnabled')\n            ->willReturn(false);\n\n        $constraint = new Disabled();\n\n        $this->validator->validate($subject, $constraint);\n\n        $this->assertNoViolation();\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Validator/EnabledValidatorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Validator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Validator\\Constraints\\Enabled;\nuse Sylius\\Bundle\\ResourceBundle\\Validator\\EnabledValidator;\nuse Sylius\\Resource\\Model\\ToggleableInterface;\nuse Symfony\\Component\\Validator\\Test\\ConstraintValidatorTestCase;\n\n/**\n * @extends ConstraintValidatorTestCase<EnabledValidator>\n */\nfinal class EnabledValidatorTest extends ConstraintValidatorTestCase\n{\n    protected function createValidator(): EnabledValidator\n    {\n        return new EnabledValidator();\n    }\n\n    public function testDoesNotApplyToNullValues(): void\n    {\n        $constraint = new Enabled();\n\n        $this->validator->validate(null, $constraint);\n\n        $this->assertNoViolation();\n    }\n\n    public function testThrowsExceptionIfSubjectDoesNotImplementToggleableInterface(): void\n    {\n        $this->expectException(\\InvalidArgumentException::class);\n        $this->expectExceptionMessage(sprintf(\n            '\"%s\" validates \"%s\" instances only',\n            EnabledValidator::class,\n            ToggleableInterface::class,\n        ));\n\n        $constraint = new Enabled();\n\n        $this->validator->validate(new \\stdClass(), $constraint);\n    }\n\n    public function testAddsViolationWhenResourceIsDisabled(): void\n    {\n        $subject = $this->createMock(ToggleableInterface::class);\n        $subject\n            ->method('isEnabled')\n            ->willReturn(false);\n\n        $constraint = new Enabled();\n\n        $this->validator->validate($subject, $constraint);\n\n        $this->buildViolation($constraint->message)\n            ->assertRaised();\n    }\n\n    public function testDoesNotAddViolationWhenResourceIsEnabled(): void\n    {\n        $subject = $this->createMock(ToggleableInterface::class);\n        $subject\n            ->method('isEnabled')\n            ->willReturn(true);\n\n        $constraint = new Enabled();\n\n        $this->validator->validate($subject, $constraint);\n\n        $this->assertNoViolation();\n    }\n}\n"
  },
  {
    "path": "tests/Bundle/Validator/UniqueWithinCollectionConstraintValidatorTest.php",
    "content": "<?php\n\n/*\n * This file is part of the Sylius package.\n *\n * (c) Sylius Sp. z o.o.\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\ndeclare(strict_types=1);\n\nnamespace Sylius\\Bundle\\ResourceBundle\\Tests\\Validator;\n\nuse Sylius\\Bundle\\ResourceBundle\\Validator\\Constraints\\UniqueWithinCollectionConstraint;\nuse Sylius\\Bundle\\ResourceBundle\\Validator\\UniqueWithinCollectionConstraintValidator;\nuse Symfony\\Component\\Validator\\Test\\ConstraintValidatorTestCase;\n\n/**\n * @extends ConstraintValidatorTestCase<UniqueWithinCollectionConstraintValidator>\n */\nfinal class UniqueWithinCollectionConstraintValidatorTest extends ConstraintValidatorTestCase\n{\n    protected function createValidator(): UniqueWithinCollectionConstraintValidator\n    {\n        return new UniqueWithinCollectionConstraintValidator();\n    }\n\n    public function testDoesNotAddViolationWhenCollectionIsEmpty(): void\n    {\n        $constraint = new UniqueWithinCollectionConstraint();\n\n        $this->validator->validate([], $constraint);\n\n        $this->assertNoViolation();\n    }\n\n    public function testDoesNotAddViolationWhenAllAttributesAreUnique(): void\n    {\n        $collection = [\n            $this->createEntityWithCode('CODE_1'),\n            $this->createEntityWithCode('CODE_2'),\n            $this->createEntityWithCode('CODE_3'),\n        ];\n\n        $constraint = new UniqueWithinCollectionConstraint();\n\n        $this->validator->validate($collection, $constraint);\n\n        $this->assertNoViolation();\n    }\n\n    public function testDoesNotAddViolationWhenAttributeIsNull(): void\n    {\n        $collection = [\n            $this->createEntityWithCode(null),\n            $this->createEntityWithCode(null),\n            $this->createEntityWithCode('CODE_1'),\n        ];\n\n        $constraint = new UniqueWithinCollectionConstraint();\n\n        $this->validator->validate($collection, $constraint);\n\n        $this->assertNoViolation();\n    }\n\n    public function testAddsViolationWhenTwoAttributesAreDuplicated(): void\n    {\n        $collection = [\n            $this->createEntityWithCode('CODE_1'),\n            $this->createEntityWithCode('DUPLICATE'),\n            $this->createEntityWithCode('DUPLICATE'),\n        ];\n\n        $constraint = new UniqueWithinCollectionConstraint();\n\n        $this->setPropertyPath('');\n        $this->validator->validate($collection, $constraint);\n\n        $this->buildViolation($constraint->message)\n            ->atPath('[2].code')\n            ->buildNextViolation($constraint->message)\n            ->atPath('[1].code')\n            ->assertRaised();\n    }\n\n    public function testAddsViolationForFirstAndSecondOccurrenceOfDuplicate(): void\n    {\n        $collection = [\n            $this->createEntityWithCode('DUPLICATE'),\n            $this->createEntityWithCode('DUPLICATE'),\n        ];\n\n        $constraint = new UniqueWithinCollectionConstraint();\n\n        $this->setPropertyPath('');\n        $this->validator->validate($collection, $constraint);\n\n        $this->buildViolation($constraint->message)\n            ->atPath('[1].code')\n            ->buildNextViolation($constraint->message)\n            ->atPath('[0].code')\n            ->assertRaised();\n    }\n\n    public function testAddsViolationOnlyOnceForFirstOccurrenceWhenThreeOrMoreDuplicates(): void\n    {\n        $collection = [\n            $this->createEntityWithCode('DUPLICATE'),\n            $this->createEntityWithCode('DUPLICATE'),\n            $this->createEntityWithCode('DUPLICATE'),\n        ];\n\n        $constraint = new UniqueWithinCollectionConstraint();\n\n        $this->setPropertyPath('');\n        $this->validator->validate($collection, $constraint);\n\n        $this->buildViolation($constraint->message)\n            ->atPath('[1].code')\n            ->buildNextViolation($constraint->message)\n            ->atPath('[0].code')\n            ->buildNextViolation($constraint->message)\n            ->atPath('[2].code')\n            ->assertRaised();\n    }\n\n    public function testHandlesMultipleDifferentDuplicates(): void\n    {\n        $collection = [\n            $this->createEntityWithCode('DUP_1'),\n            $this->createEntityWithCode('DUP_1'),\n            $this->createEntityWithCode('UNIQUE'),\n            $this->createEntityWithCode('DUP_2'),\n            $this->createEntityWithCode('DUP_2'),\n        ];\n\n        $constraint = new UniqueWithinCollectionConstraint();\n\n        $this->setPropertyPath('');\n        $this->validator->validate($collection, $constraint);\n\n        $this->buildViolation($constraint->message)\n            ->atPath('[1].code')\n            ->buildNextViolation($constraint->message)\n            ->atPath('[0].code')\n            ->buildNextViolation($constraint->message)\n            ->atPath('[4].code')\n            ->buildNextViolation($constraint->message)\n            ->atPath('[3].code')\n            ->assertRaised();\n    }\n\n    public function testUsesCustomAttributePath(): void\n    {\n        $collection = [\n            $this->createEntityWithCustomAttribute('name', 'John'),\n            $this->createEntityWithCustomAttribute('name', 'John'),\n        ];\n\n        $constraint = new UniqueWithinCollectionConstraint();\n        $constraint->attributePath = 'name';\n\n        $this->setPropertyPath('');\n        $this->validator->validate($collection, $constraint);\n\n        $this->buildViolation($constraint->message)\n            ->atPath('[1].name')\n            ->buildNextViolation($constraint->message)\n            ->atPath('[0].name')\n            ->assertRaised();\n    }\n\n    public function testUsesCustomMessage(): void\n    {\n        $collection = [\n            $this->createEntityWithCode('DUPLICATE'),\n            $this->createEntityWithCode('DUPLICATE'),\n        ];\n\n        $constraint = new UniqueWithinCollectionConstraint();\n        $constraint->message = 'Custom error message';\n\n        $this->setPropertyPath('');\n        $this->validator->validate($collection, $constraint);\n\n        $this->buildViolation('Custom error message')\n            ->atPath('[1].code')\n            ->buildNextViolation('Custom error message')\n            ->atPath('[0].code')\n            ->assertRaised();\n    }\n\n    private function createEntityWithCode(?string $code): object\n    {\n        return new class($code) {\n            public function __construct(\n                private readonly ?string $code,\n            ) {\n            }\n\n            public function getCode(): ?string\n            {\n                return $this->code;\n            }\n        };\n    }\n\n    private function createEntityWithCustomAttribute(string $attributeName, mixed $value): object\n    {\n        return new class($attributeName, $value) {\n            public function __construct(\n                private readonly string $attributeName,\n                private readonly mixed $value,\n            ) {\n            }\n\n            public function __get(string $name): mixed\n            {\n                if ($name === $this->attributeName) {\n                    return $this->value;\n                }\n\n                throw new \\Exception(\"Property {$name} does not exist\");\n            }\n\n            public function __isset(string $name): bool\n            {\n                return $name === $this->attributeName;\n            }\n        };\n    }\n}\n"
  }
]