Skip to content

Commit

Permalink
Merge 3.x into 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI committed Jun 26, 2022
2 parents ee4543c + 56aed5b commit 8abcdbd
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ docs export-ignore
Makefile export-ignore
phpunit.xml.dist export-ignore
bin/console export-ignore
rector.php export-ignore
phpstan.neon.dist export-ignore
phpstan-baseline.neon export-ignore
phpstan-console-application.php export-ignore
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
php-version: '8.1'
coverage: none
tools: composer:v2
extensions: pdo_sqlite

- name: Install Composer dependencies (highest)
uses: ramsey/composer-install@v2
Expand Down
27 changes: 25 additions & 2 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
php-version: '8.1'
coverage: none
tools: composer:v2
extensions: pdo_sqlite

- name: Install Composer dependencies (highest)
uses: ramsey/composer-install@v2
Expand All @@ -58,7 +57,6 @@ jobs:
php-version: '8.1'
coverage: none
tools: composer:v2
extensions: pdo_sqlite

- name: Install Composer dependencies (highest)
uses: ramsey/composer-install@v2
Expand All @@ -68,3 +66,28 @@ jobs:

- name: Psalm
run: vendor/bin/psalm --no-progress --show-info=false --stats --output-format=github --threads=$(nproc) --shepherd --php-version=8.1

rector:
name: Rector

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: none
tools: composer:v2

- name: Install Composer dependencies (highest)
uses: ramsey/composer-install@v2
with:
dependency-versions: highest
composer-options: --prefer-dist --prefer-stable

- name: Rector
run: vendor/bin/rector --no-progress-bar --dry-run
1 change: 0 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ jobs:
php-version: ${{ matrix.php-version }}
coverage: pcov
tools: composer:v2
extensions: pdo_sqlite

- name: Add PHPUnit matcher
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,7 @@ phpstan:
psalm:
vendor/bin/psalm --php-version=8.1
.PHONY: psalm

rector:
vendor/bin/rector
.PHONY: rector
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@
"phpstan/phpstan-strict-rules": "^1.0",
"phpstan/phpstan-symfony": "^1.0",
"phpunit/phpunit": "^9.5",
"psalm/plugin-phpunit": "^0.16",
"psalm/plugin-phpunit": "^0.17",
"psalm/plugin-symfony": "^3.0",
"rector/rector": "^0.13",
"sonata-project/doctrine-orm-admin-bundle": "^4.0",
"symfony/browser-kit": "^4.4 || ^5.4 || ^6.0",
"symfony/css-selector": "^4.4 || ^5.4 || ^6.0",
Expand Down
41 changes: 41 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

/*
* DO NOT EDIT THIS FILE!
*
* It's auto-generated by sonata-project/dev-kit package.
*/

use Rector\Config\RectorConfig;
use Rector\Php70\Rector\FunctionLike\ExceptionHandlerTypehintRector;
use Rector\Php71\Rector\FuncCall\CountOnNullRector;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__.'/src',
__DIR__.'/tests',
]);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_74,
]);

$rectorConfig->importNames();
$rectorConfig->disableImportShortClasses();
$rectorConfig->skip([
CountOnNullRector::class,
ExceptionHandlerTypehintRector::class,
]);
};
4 changes: 2 additions & 2 deletions src/DependencyInjection/SonataTranslationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ private function configureChecker(ContainerBuilder $container, array $translatio
$supportedInterfaces = [];
$supportedModels = [];
foreach ($translationTargets as $targets) {
$supportedInterfaces = array_merge($supportedInterfaces, $targets['implements']);
$supportedModels = array_merge($supportedModels, $targets['instanceof']);
$supportedInterfaces = [...$supportedInterfaces, ...$targets['implements']];
$supportedModels = [...$supportedModels, ...$targets['instanceof']];
}

$translatableCheckerDefinition->addMethodCall('setSupportedInterfaces', [$supportedInterfaces]);
Expand Down
3 changes: 2 additions & 1 deletion tests/App/Admin/GedmoCategoryAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\TranslationBundle\Tests\App\Entity\GedmoCategory;
use Symfony\Component\Form\Extension\Core\Type\TextType;

/**
* @phpstan-extends AbstractAdmin<\Sonata\TranslationBundle\Tests\App\Entity\GedmoCategory>
* @phpstan-extends AbstractAdmin<GedmoCategory>
*/
final class GedmoCategoryAdmin extends AbstractAdmin
{
Expand Down
3 changes: 2 additions & 1 deletion tests/App/Admin/KnpCategoryAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\TranslationBundle\Tests\App\Entity\KnpCategory;
use Symfony\Component\Form\Extension\Core\Type\TextType;

/**
* @phpstan-extends AbstractAdmin<\Sonata\TranslationBundle\Tests\App\Entity\KnpCategory>
* @phpstan-extends AbstractAdmin<KnpCategory>
*/
final class KnpCategoryAdmin extends AbstractAdmin
{
Expand Down
7 changes: 4 additions & 3 deletions tests/Traits/DoctrineOrmTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ final protected function getMockSqliteEntityManager(?EventManager $evm = null, ?

$em = EntityManager::create($conn, $config ?? $this->getMockAnnotatedConfig(), $evm ?? new EventManager());

$schema = array_map(static function (string $class) use ($em): ClassMetadata {
return $em->getClassMetadata($class);
}, $this->getUsedEntityFixtures());
$schema = array_map(
static fn (string $class): ClassMetadata => $em->getClassMetadata($class),
$this->getUsedEntityFixtures()
);

$schemaTool = new SchemaTool($em);
$schemaTool->dropSchema([]);
Expand Down

0 comments on commit 8abcdbd

Please sign in to comment.