Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.editorconfig export-ignore
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
Expand Down
15 changes: 0 additions & 15 deletions .github/actions/ci-env/action.yml

This file was deleted.

84 changes: 15 additions & 69 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,18 @@
name: CI
on: [push]
jobs:
phpcs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: bin/ci/phpcs

phpstan:
runs-on: ubuntu-latest
strategy:
matrix:
php: [--php=8.1, --php=8.2, --php=8.3]
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/ci-env
- run: bin/ci/phpstan ${{ matrix.php }}

phpdd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/ci-env
- run: bin/ci/phpdd

composer-require-checker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/ci-env
- run: bin/ci/composer-require-checker

composer-validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: bin/ci/composer-validate

shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: bin/ci/shellcheck

unused-scanner:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: bin/ci/unused-scanner

phpunit-symfony-6:
runs-on: ubuntu-latest
strategy:
matrix:
php: [--php=8.1, --php=8.2, --php=8.3]
symfony: [--symfony=6.1, --symfony=6.2, --symfony=6.3, --symfony=6.4]
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/ci-env
- run: bin/ci/phpunit ${{ matrix.php }} ${{ matrix.symfony }}

phpunit-symfony-7:
runs-on: ubuntu-latest
strategy:
matrix:
php: [--php=8.2, --php=8.3]
symfony: [--symfony=7.0, --symfony=7.1]
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/ci-env
- run: bin/ci/phpunit ${{ matrix.php }} ${{ matrix.symfony }}
validate:
runs-on: ubuntu-latest
steps:
-
name: Checkout repository
uses: actions/checkout@v4
-
name: Composer cache
uses: actions/cache@v3
with:
path: vendor
key: composer-${{ hashFiles('composer.json') }}
restore-keys: composer-${{ hashFiles('composer.json') }}
- run: bin/ci/env
- run: bin/ci/validate --theme=summary
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
-
name: Checkout repository
uses: actions/checkout@v4
-
name: Composer cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: vendor
key: composer-${{ hashFiles('composer.json') }}
Expand Down
2 changes: 1 addition & 1 deletion bin/ci/docker
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ readonly ROOT_PATH="$(realpath "$(dirname "$(realpath "$0")")/../..")"
source "${ROOT_PATH}"/bin/common.inc.sh

DOCKER_IMAGE_NAME="${CI_DOCKER_IMAGE_NAME}" \
DOCKER_FILE_PATH="${ROOT_PATH}"/docker/ci/Dockerfile \
DOCKERFILE_PATH="${ROOT_PATH}"/docker/ci \
source "${ROOT_PATH}"/bin/docker-build.inc.bash
2 changes: 1 addition & 1 deletion bin/ci/env
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ readonly ROOT_PATH="$(realpath "$(dirname "$(realpath "$0")")/../..")"
. "${ROOT_PATH}"/bin/common.inc.sh
. "${ROOT_PATH}"/bin/dockerise.inc.bash

"${ROOT_PATH}"/bin/composer install
"${ROOT_PATH}"/bin/composer install --ansi
11 changes: 1 addition & 10 deletions bin/ci/phpcs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,4 @@ if [ ! -d "${ROOT_PATH}"/var/ci/phpcs ]; then
mkdir -p "${ROOT_PATH}"/var/ci/phpcs
fi

phpcs \
-p \
--warning-severity=0 \
--ignore=/vendor/,/var/,*Enum.php \
--bootstrap=config/ci/phpcs.php \
--standard="${COMPOSER_HOME}"/vendor/steevanb/php-code-sniffs/src/Steevanb/ruleset.xml \
--report=steevanb\\PhpCodeSniffs\\Reports\\Steevanb \
--cache="${ROOT_PATH}"/var/ci/phpcs/cache \
. \
"${@}"
phpcs --standard="${ROOT_PATH}"/config/ci/phpcs.xml "${@}"
2 changes: 1 addition & 1 deletion bin/ci/phpstan.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

function createPhpstanProcesses(): ProcessInterfaceCollection
{
$phpVersions = new StringCollection(['8.1', '8.2', '8.3']);
$phpVersions = new StringCollection(['8.1', '8.2', '8.3', '8.4']);

$return = new ProcessInterfaceCollection();
foreach ($phpVersions->toArray() as $loopPhpVersion) {
Expand Down
8 changes: 4 additions & 4 deletions bin/ci/phpunit.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

function createPhpunitProcesses(string $phpVersion = null, string $symfonyVersion = null): ProcessInterfaceCollection
{
$phpVersions = new StringCollection(is_string($phpVersion) ? [$phpVersion] : ['8.1', '8.2', '8.3']);
$phpVersions = new StringCollection(is_string($phpVersion) ? [$phpVersion] : ['8.1', '8.2', '8.3', '8.4']);
$symfonyVersions = new StringCollection(
is_string($symfonyVersion) ? [$symfonyVersion] : ['6.1', '6.2', '6.3', '6.4', '7.0', '7.1']
is_string($symfonyVersion) ? [$symfonyVersion] : ['6.1', '6.2', '6.3', '6.4', '7.0', '7.1', '7.2']
);

$return = new ProcessInterfaceCollection();
foreach ($phpVersions->toArray() as $loopPhpVersion) {
foreach ($symfonyVersions->toArray() as $loopSymfonyVersion) {
if (
in_array($loopSymfonyVersion, ['7.0', '7.1'])
&& in_array($loopPhpVersion, ['8.2', '8.3'], true) === false
in_array($loopSymfonyVersion, ['7.0', '7.1', '7.2'])
&& in_array($loopPhpVersion, ['8.2', '8.3', '8.4'], true) === false
) {
continue;
}
Expand Down
1 change: 1 addition & 0 deletions bin/ci/validate.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
->addProcess(new Process([__DIR__ . '/phpunit']))
->addProcess(new Process([__DIR__ . '/shellcheck']))
->addProcess(new Process([__DIR__ . '/unused-scanner']))
->setRefreshInterval(100000)
->run(new ArgvInput($argv));
4 changes: 2 additions & 2 deletions bin/common.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

set -eu

readonly CI_DOCKER_IMAGE_NAME="steevanb/php-collection:ci"
readonly RELEASE_DOCKER_IMAGE_NAME="steevanb/php-collection:release"
readonly CI_DOCKER_IMAGE_NAME=ghcr.io/steevanb/php-collection:ci
readonly RELEASE_DOCKER_IMAGE_NAME=ghcr.io/steevanb/php-collection:release
2 changes: 1 addition & 1 deletion bin/dev/generate-php-collections
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ readonly ROOT_PATH="$(realpath "$(dirname "$(realpath "$0")")/../..")"
source "${ROOT_PATH}"/bin/common.inc.sh
BIN_DIR=bin/dev COMPOSER_HOME=/app/var/composer source "${ROOT_PATH}"/bin/dockerise.inc.bash

php /app/bin/dev/generate-php-collections.php
php8.4 /app/bin/dev/generate-php-collections.php
9 changes: 3 additions & 6 deletions bin/docker-build.inc.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@ function buildDockerImage() {
DOCKER_BUILDKIT=1 \
docker \
build \
--file "${dockerFilePath}" \
--tag="${dockerImageName}" \
--build-arg DOCKER_UID="$(id -u)" \
--build-arg DOCKER_GID="$(id -g)" \
--tag "${dockerImageName}" \
${refreshArguments} \
"${ROOT_PATH}"
"${dockerFilePath}"
}

function pushDockerImage() {
Expand All @@ -40,7 +37,7 @@ for param in "${@}"; do
fi
done

buildDockerImage "${DOCKER_IMAGE_NAME}" "${DOCKER_FILE_PATH}"
buildDockerImage "${DOCKER_IMAGE_NAME}" "${DOCKERFILE_PATH}"

if [ "${push}" == true ]; then
pushDockerImage "${DOCKER_IMAGE_NAME}"
Expand Down
2 changes: 1 addition & 1 deletion bin/release/docker
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ readonly ROOT_PATH="$(realpath "$(dirname "$(realpath "$0")")/../..")"
source "${ROOT_PATH}"/bin/common.inc.sh

DOCKER_IMAGE_NAME="${RELEASE_DOCKER_IMAGE_NAME}" \
DOCKER_FILE_PATH="${ROOT_PATH}"/docker/release/Dockerfile \
DOCKERFILE_PATH="${ROOT_PATH}"/docker/release \
source "${ROOT_PATH}"/bin/docker-build.inc.bash
10 changes: 7 additions & 3 deletions bridge/Symfony/Normalizer/ObjectCollectionDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ class ObjectCollectionDenormalizer implements DenormalizerInterface, Denormalize
use DenormalizerAwareTrait;

/** @param array<mixed> $context */
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
{
public function supportsDenormalization(
mixed $data,
string $type,
?string $format = null,
array $context = []
): bool {
return
is_subclass_of($type, AbstractObjectCollection::class)
|| is_subclass_of($type, AbstractObjectNullableCollection::class);
Expand All @@ -43,7 +47,7 @@ public function getSupportedTypes(?string $format): array
public function denormalize(
mixed $data,
string $type,
string $format = null,
?string $format = null,
array $context = []
): AbstractObjectCollection|AbstractObjectNullableCollection {
/** @var class-string<AbstractObjectCollection<object>|AbstractObjectNullableCollection<object|null>> $type */
Expand Down
10 changes: 7 additions & 3 deletions bridge/Symfony/Normalizer/ScalarCollectionDenormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
class ScalarCollectionDenormalizer implements DenormalizerInterface
{
/** @param array<mixed> $context */
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
{
public function supportsDenormalization(
mixed $data,
string $type,
?string $format = null,
array $context = []
): bool {
return in_array(
$type,
[
Expand Down Expand Up @@ -54,7 +58,7 @@ public function getSupportedTypes(?string $format): array
public function denormalize(
mixed $data,
string $type,
string $format = null,
?string $format = null,
array $context = []
): CollectionInterface {
/**
Expand Down
7 changes: 0 additions & 7 deletions config/ci/phpcs.php

This file was deleted.

19 changes: 19 additions & 0 deletions config/ci/phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<ruleset name="phpcs">
<rule ref="/composer/common/vendor/steevanb/php-code-sniffs/src/Steevanb/ruleset.xml"/>
<arg name="warning-severity" value="0"/>
<exclude-pattern>/var</exclude-pattern>
<exclude-pattern>/vendor</exclude-pattern>
<arg name="report" value="steevanb\PhpCodeSniffs\Reports\Steevanb"/>
<arg name="cache" value="../../var/ci/phpcs/cache"/>
<arg name="report" value="full"/>
<file>../../</file>
<exclude-pattern>**/*Enum.php</exclude-pattern>
<rule ref="Steevanb.Uses.GroupUses">
<properties>
<property name="thirdLevelPrefixes" type="array">
<element value="Symfony\Component\"/>
</property>
</properties>
</rule>
</ruleset>
3 changes: 3 additions & 0 deletions config/ci/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ parameters:
- ../../tests
excludePaths:
- ../../tests/Unit/ArrayTest.php
ignoreErrors:
# str_replace() accepts string|int|null
- "#Parameter \\#2 \\$replace of function str_replace expects array<string>\\|string, array<string, int\\|string\\|null> given#"
includes:
- /composer/common/vendor/phpstan/phpstan-deprecation-rules/rules.neon
- /composer/common/vendor/phpstan/phpstan-phpunit/extension.neon
Expand Down
4 changes: 4 additions & 0 deletions config/ci/phpstan.php-8.4.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
includes:
- phpstan.neon
parameters:
tmpDir: ../../var/ci/phpstan/php-8-4
10 changes: 10 additions & 0 deletions config/ci/phpunit.php-8.4.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<phpunit
cacheResultFile="../../var/ci/phpunit/php-8.4/.phpunit.result.cache"
colors="true"
>
<testsuites>
<testsuite name="default">
<directory>../../tests</directory>
</testsuite>
</testsuites>
</phpunit>
Loading