diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 331731d4..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,98 +0,0 @@ -version: 2.1 - -workflows: - version: 2 - - main: - jobs: - - lintSyntax - - lintStaticAnalysis - - checkBcBreaks - - test80 - - test81 - - test82 - - test83 - - test84 - -jobs: - lintStaticAnalysis: - docker: - - image: cimg/php:8.1 - steps: - - checkout - - run: - name: "Install dependencies" - command: sudo composer self-update && composer install -n --prefer-dist - - run: - name: Static analysis - command: composer run lint-static-analysis - - lintSyntax: - docker: - - image: cimg/php:8.1 - steps: - - checkout - - run: - name: "Install dependencies" - command: sudo composer self-update && composer install -n --prefer-dist - - run: - name: Install php-cs-fixer - command: mkdir -p tools/php-cs-fixer && composer require --working-dir=tools/php-cs-fixer friendsofphp/php-cs-fixer - - run: - name: Run syntax test - command: tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation -v - - checkBcBreaks: - docker: - - image: cimg/php:8.1 - steps: - - checkout - - run: - name: "Install dependencies" - command: sudo composer self-update && composer install -n --prefer-dist - - run: - name: Check for backwards-compatibility breaks - command: composer run test-for-bc-breaks || true - - - test80: - docker: - - image: cimg/php:8.0 - steps: - - checkout - - run: { name: "Install dependencies", command: "sudo composer self-update && composer install -n --prefer-dist" } - - run: { name: "Test suite", command: "composer test-quick-fail" } - - test81: - docker: - - image: cimg/php:8.1 - steps: - - checkout - - run: { name: "Install dependencies", command: "sudo composer self-update && composer install -n --prefer-dist" } - - run: { name: "Test suite", command: "composer test-quick-fail" } - - test82: - docker: - - image: cimg/php:8.2 - steps: - - checkout - - run: { name: "Install dependencies", command: "sudo composer self-update && composer install -n --prefer-dist" } - # This test is knee-kapped for now, since a PHP bug causes the tests to segfault. See v7.0.0 changelog. - - run: { name: "Test suite", command: "composer test-quick-fail" } - - test83: - docker: - - image: cimg/php:8.3 - steps: - - checkout - - run: { name: "Install dependencies", command: "sudo composer self-update && composer install -n --prefer-dist" } - - run: { name: "Test suite", command: "composer test-quick-fail" } - - test84: - docker: - - image: cimg/php:8.4 - steps: - - checkout - - run: { name: "Install dependencies", command: "sudo composer self-update && composer install -n --prefer-dist" } - - run: { name: "Test suite", command: "composer test-quick-fail" } - diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..f72faf28 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,20 @@ +ARG PHP_VERSION=8.1 +FROM php:${PHP_VERSION}-cli + +RUN groupadd --gid 1000 vscode \ + && useradd --uid 1000 --gid 1000 --create-home --shell /bin/bash vscode \ + && apt-get update \ + && export DEBIAN_FRONTEND=noninteractive \ + && apt-get install -y --no-install-recommends \ + curl \ + git \ + libicu-dev \ + libonig-dev \ + libxml2-dev \ + libzip-dev \ + unzip \ + zip \ + && docker-php-ext-install -j"$(nproc)" bcmath dom intl mbstring soap xml zip \ + && curl -fsSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ + && git config --system --add safe.directory '*' \ + && rm -rf /var/lib/apt/lists/* diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..35f002cb --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,21 @@ +{ + "name": "contentful.php", + "build": { + "dockerfile": "Dockerfile", + "context": "..", + "args": { + "PHP_VERSION": "${localEnv:PHP_VERSION:8.1}" + } + }, + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + "remoteUser": "vscode", + "postCreateCommand": ".devcontainer/post-create.sh", + "customizations": { + "vscode": { + "extensions": [ + "bmewburn.vscode-intelephense-client", + "xdebug.php-debug" + ] + } + } +} diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100755 index 00000000..a63ef263 --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -euo pipefail + +temp_composer="composer.devcontainer.json" +temp_lock="composer.devcontainer.lock" + +cleanup() { + rm -f "$temp_composer" "$temp_lock" +} + +trap cleanup EXIT + +# Install a devcontainer-only dependency set without the BC checker. This repo +# does not commit a lockfile, and roave/backward-compatibility-check can force +# incompatible resolutions during post-create; the dedicated BC CI job still +# exercises that tooling separately. +php <<'PHP' + PHP library for the Contentful [Content Delivery API](https://www.contentful.com/developers/docs/references/content-delivery-api/) and [Content Preview API](https://www.contentful.com/developers/docs/references/content-preview-api/). It helps you to easily access your Content stored in Contentful with your PHP applications. @@ -200,7 +200,15 @@ For details about how to upgrade from version 2.x to version 3, please check the [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?maxAge=31557600)](http://makeapullrequest.com) -**Important**: Right now, the API has `php-vcr` as a development dependency, which does not officially support PHP8 yet. If you want to develop on PHP8, you will need to install the dependencies with `composer install --ignore-platform-reqs` to overwrite this requirement. +For a reproducible local setup, open this repository in its included dev container. The container installs the project dependencies automatically when it is created. + +After the container is ready, run: + +```bash +composer test-quick-fail +``` + +See [CONTRIBUTING.md](CONTRIBUTING.md) for the full contributor workflow. ## License diff --git a/composer.json b/composer.json index 3c1457ea..618441ae 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "test": "vendor/bin/phpunit", "test-quick-fail": "php vendor/bin/phpunit --stop-on-error --stop-on-failure -v", "test-for-bc-breaks": "php -d memory_limit=-1 vendor/bin/roave-backward-compatibility-check", - "lint-static-analysis": "php vendor/bin/phpstan analyse src --level=5", + "lint-static-analysis": "php -d memory_limit=-1 vendor/bin/phpstan analyse src --level=5", "release": "php vendor/contentful/core/scripts/release.php" }, "config": { diff --git a/src/Resource/DeletedAsset.php b/src/Resource/DeletedAsset.php index cb153d58..13ee6e3c 100644 --- a/src/Resource/DeletedAsset.php +++ b/src/Resource/DeletedAsset.php @@ -3,7 +3,7 @@ /** * This file is part of the contentful/contentful package. * - * @copyright 2015-2025 Contentful GmbH + * @copyright 2015-2026 Contentful GmbH * @license MIT */