Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/3.4.x' into 3.4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Hofinger committed Sep 2, 2024
2 parents d55b6bc + 5988484 commit f701e99
Show file tree
Hide file tree
Showing 31 changed files with 403 additions and 259 deletions.
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/Tests export-ignore
/phpcs.xml.dist export-ignore
/phpunit.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpstan-baseline.neon export-ignore
/psalm.xml export-ignore
/psalm-baseline.xml export-ignore
32 changes: 1 addition & 31 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,4 @@ on:
jobs:
coding-standards:
name: "Coding Standards"
runs-on: "ubuntu-20.04"

strategy:
matrix:
php-version:
- "7.4"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: "cs2pr"

- name: "Cache dependencies installed with Composer"
uses: "actions/cache@v2"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"

- name: "Install dependencies with Composer"
run: "composer install --no-interaction --no-progress --no-suggest"

# https://github.com/doctrine/.github/issues/3
- name: "Run PHP_CodeSniffer"
run: "vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr"
uses: "doctrine/.github/.github/workflows/[email protected]"
82 changes: 42 additions & 40 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:
jobs:
phpunit:
name: "PHPUnit"
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"

strategy:
matrix:
Expand All @@ -28,19 +28,31 @@ jobs:
- "7.3"
- "7.4"
- "8.0"
deps:
- "normal"
- "8.1"
- "8.2"
- "8.3"
dependencies:
- "highest"
stability:
- "stable"
extra_constraint:
- ""
include:
- deps: "low"
- dependencies: "lowest"
php-version: "7.1"
- deps: "symfony/lts:v3"
- dependencies: "highest"
extra_constraint: "symfony/lts:v3"
php-version: "7.3"
- deps: "dev"
- dependencies: "highest"
stability: "dev"
php-version: "7.3"
- dependencies: "highest"
stability: "dev"
php-version: "8.3"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
with:
fetch-depth: 2

Expand All @@ -60,69 +72,59 @@ jobs:
coverage: "xdebug"
ini-values: "zend.assertions=1"

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v2"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"

# to be removed when doctrine/orm adds support for PHP 8
- name: "Pretend this is PHP 7.4"
run: "composer config platform.php 7.4.99"
if: "${{ matrix.php-version == '8.0' }}"
- name: "Use dev stability"
run: "composer config minimum-stability dev"
if: "${{ matrix.stability == 'dev' }}"

- name: "Install dependencies with composer"
run: "composer update --no-interaction --prefer-dist"
if: "${{ matrix.deps == 'normal' }}"
- name: "Add extra constraint"
run: "composer require --no-update ${{matrix.extra_constraint}}"
if: "${{ contains(matrix.extra_constraint, '/') }}"

- name: "Install lowest possible dependencies with composer"
run: "composer update --no-interaction --prefer-dist --prefer-lowest"
if: "${{ matrix.deps == 'low' }}"

- name: "Install dependencies at dev stability with composer"
run: "composer config minimum-stability dev; composer update --no-interaction --prefer-dist --prefer-lowest"
if: "${{ matrix.deps == 'dev' }}"
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "${{ matrix.dependencies }}"
composer-options: "--prefer-dist"

- name: "Install dependencies with composer with extra constraint"
run: "composer require --no-update ${{matrix.deps}};composer update --no-interaction --prefer-dist"
if: "${{ contains(matrix.deps, '/') }}"
- name: "Configure deprecations helper"
run: "echo SYMFONY_DEPRECATIONS_HELPER=weak >> $GITHUB_ENV"
if: "${{ matrix.dependencies == 'lowest' }}"

- name: "Run PHPUnit"
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"

- name: "Upload coverage file"
uses: "actions/upload-artifact@v2"
if: "${{ ! contains(matrix.deps, '/') }}"
uses: "actions/upload-artifact@v3"
if: "${{ ! contains(matrix.extra_constraint, '/') }}"
with:
name: "phpunit-${{ matrix.deps }}-${{ matrix.php-version }}.coverage"
name: "phpunit-${{ matrix.dependencies }}-${{ matrix.stability }}-${{ matrix.php-version }}.coverage"
path: "coverage.xml"

- name: "Upload coverage file, sanitize the name"
uses: "actions/upload-artifact@v2"
if: "${{ contains(matrix.deps, '/') }}"
uses: "actions/upload-artifact@v3"
if: "${{ contains(matrix.extra_constraint, '/') }}"
with:
name: "phpunit-symfony-lts-${{ matrix.php-version }}.coverage"
path: "coverage.xml"

upload_coverage:
name: "Upload coverage to Codecov"
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-22.04"
needs:
- "phpunit"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
uses: "actions/checkout@v4"
with:
fetch-depth: 2

- name: "Download coverage files"
uses: "actions/download-artifact@v2"
uses: "actions/download-artifact@v3"
with:
path: "reports"

- name: "Upload to Codecov"
uses: "codecov/codecov-action@v1"
uses: "codecov/codecov-action@v3"
with:
directory: reports
41 changes: 6 additions & 35 deletions .github/workflows/release-on-milestone-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,9 @@ on:
jobs:
release:
name: "Git tag, release & create merge-up PR"
runs-on: "ubuntu-20.04"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Release"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:release"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}

- name: "Create Merge-Up Pull Request"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:create-merge-up-pull-request"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}

- name: "Create new milestones"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:create-milestones"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
uses: "doctrine/.github/.github/workflows/[email protected]"
secrets:
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
ORGANIZATION_ADMIN_TOKEN: ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
SIGNING_SECRET_KEY: ${{ secrets.SIGNING_SECRET_KEY }}
14 changes: 14 additions & 0 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

name: "Static Analysis"

on:
pull_request:
branches:
- "*.x"
push:
branches:
- "*.x"

jobs:
static-analysis:
uses: "doctrine/.github/.github/workflows/[email protected]"
4 changes: 4 additions & 0 deletions .symfony.bundle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
branches: ["3.3.x", "3.4.x", "3.5.x"]
maintained_branches: ["3.4.x", "3.5.x"]
doc_dir: "Resources/doc/"
dev_branch: "3.5.x"
18 changes: 9 additions & 9 deletions Command/LoadDataFixturesDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,21 @@
use Doctrine\Bundle\FixturesBundle\Purger\PurgerFactory;
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
use Doctrine\DBAL\Sharding\PoolingShardConnection;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
use LogicException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use const E_USER_DEPRECATED;

use function assert;
use function implode;
use function sprintf;
use function trigger_error;

use const E_USER_DEPRECATED;

/**
* Load data fixtures from bundles.
*/
Expand All @@ -33,9 +37,7 @@ class LoadDataFixturesDoctrineCommand extends DoctrineCommand
/** @var PurgerFactory[] */
private $purgerFactories;

/**
* @param PurgerFactory[] $purgerFactories
*/
/** @param PurgerFactory[] $purgerFactories */
public function __construct(SymfonyFixturesLoader $fixturesLoader, ?ManagerRegistry $doctrine = null, array $purgerFactories = [])
{
if ($doctrine === null) {
Expand All @@ -52,7 +54,7 @@ public function __construct(SymfonyFixturesLoader $fixturesLoader, ?ManagerRegis
$this->purgerFactories = $purgerFactories;
}

// phpcs:ignore SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint
/** @return void */
protected function configure()
{
$this
Expand Down Expand Up @@ -81,15 +83,13 @@ protected function configure()
EOT);
}

/**
* @return int
*/
// phpcs:ignore SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint
/** @return int */
protected function execute(InputInterface $input, OutputInterface $output)
{
$ui = new SymfonyStyle($input, $output);

$em = $this->getDoctrine()->getManager($input->getOption('em'));
assert($em instanceof EntityManagerInterface);

if (!$input->getOption('append')) {

Check failure on line 94 in Command/LoadDataFixturesDoctrineCommand.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.2)

Expected 1 space after NOT operator; 0 found
$ui->text('This version will always append and never purge');
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/CompilerPass/FixturesCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class FixturesCompilerPass implements CompilerPassInterface
{
public const FIXTURE_TAG = 'doctrine.fixture.orm';

public function process(ContainerBuilder $container) : void
public function process(ContainerBuilder $container): void
{
$definition = $container->getDefinition('doctrine.fixtures.loader');
$taggedServices = $container->findTaggedServiceIds(self::FIXTURE_TAG);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

use function sprintf;

final class PurgerFactoryCompilerPass implements CompilerPassInterface
{
public const PURGER_FACTORY_TAG = 'doctrine.fixtures.purger_factory';

public function process(ContainerBuilder $container) : void
public function process(ContainerBuilder $container): void
{
$definition = $container->getDefinition('doctrine.fixtures_load_command');
$taggedServices = $container->findTaggedServiceIds(self::PURGER_FACTORY_TAG);
Expand Down
5 changes: 4 additions & 1 deletion DependencyInjection/DoctrineFixturesExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

use function dirname;

class DoctrineFixturesExtension extends Extension
{
/**
* {@inheritdoc}
* {@inheritDoc}
*
* @return void
*/
public function load(array $configs, ContainerBuilder $container)
{
Expand Down
5 changes: 1 addition & 4 deletions DoctrineFixturesBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

/**
* Bundle.
*/
class DoctrineFixturesBundle extends Bundle
{
// phpcs:ignore SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint
/** @return void */
public function build(ContainerBuilder $container)
{
$container->addCompilerPass(new FixturesCompilerPass());
Expand Down
2 changes: 1 addition & 1 deletion FixtureGroupInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ interface FixtureGroupInterface
*
* @return string[]
*/
public static function getGroups() : array;
public static function getGroups(): array;
}
Loading

0 comments on commit f701e99

Please sign in to comment.