diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 331731d..0000000 --- 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 0000000..f72faf2 --- /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 0000000..ed8872c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,21 @@ +{ + "name": "contentful-core.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 0000000..a63ef26 --- /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' + +[![CI](https://github.com/contentful/contentful-core.php/actions/workflows/ci.yml/badge.svg)](https://github.com/contentful/contentful-core.php/actions/workflows/ci.yml) ## What is Contentful? @@ -17,6 +17,27 @@ This package requires PHP 8.0 or above. This package provides foundation components for both [Delivery SDK](https://github.com/contentful/contentful.php) and [Management SDK](https://github.com/contentful/contentful-management.php), and it is not meant for being used from third party packages. +## Development with Dev Containers + +For a reproducible local setup, this repository includes a `.devcontainer` configuration and GitHub Actions uses the same setup for CI. + +In Visual Studio Code, open the repository and run `Dev Containers: Reopen in Container`. + +Without Visual Studio Code, install Docker and the Dev Container CLI (`npm install -g @devcontainers/cli`), then run: + +```bash +devcontainer up --workspace-folder . +devcontainer exec --workspace-folder . bash +``` + +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/src/Api/DateTimeImmutable.php b/src/Api/DateTimeImmutable.php index add8609..b068811 100644 --- a/src/Api/DateTimeImmutable.php +++ b/src/Api/DateTimeImmutable.php @@ -28,7 +28,7 @@ public function formatForJson(): string $milliseconds = floor($date->format('u') / 1000); if ($milliseconds > 0) { - $result .= '.'.mb_str_pad((string) $milliseconds, 3, '0', \STR_PAD_LEFT); + $result .= '.'.str_pad((string) $milliseconds, 3, '0', \STR_PAD_LEFT); } return $result.'Z'; diff --git a/src/File/UrlOptionsInterface.php b/src/File/UrlOptionsInterface.php index d2ea167..11d2e47 100644 --- a/src/File/UrlOptionsInterface.php +++ b/src/File/UrlOptionsInterface.php @@ -3,7 +3,7 @@ /** * This file is part of the contentful/contentful-core package. * - * @copyright 2015-2025 Contentful GmbH + * @copyright 2015-2026 Contentful GmbH * @license MIT */