Skip to content
Open
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
25 changes: 7 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: Analyze
runs-on: ubuntu-latest
container:
image: php:8.3-alpine
image: php:8.5-alpine
options: >-
--tmpfs /tmp:exec
--tmpfs /var/tmp:exec
Expand All @@ -27,13 +27,13 @@ jobs:
- uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-8.3-highest-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-8.5-highest-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-8.3-highest
${{ runner.os }}-composer-8.5-highest
- name: Validate Composer
run: composer validate
- name: Install highest dependencies with Composer
run: composer update --no-progress --no-suggest --ansi
run: composer update --no-progress --ansi
- name: Disable PHP memory limit
run: echo 'memory_limit=-1' >> /usr/local/etc/php/php.ini
- name: Run CS-Fixer
Expand All @@ -50,19 +50,10 @@ jobs:
strategy:
matrix:
php:
- '8.1'
- '8.2'
- '8.3'
- '8.5'
dependencies:
- 'lowest'
- 'highest'
include:
- php: '8.1'
phpunit-version: 10
- php: '8.2'
phpunit-version: 10
- php: '8.3'
phpunit-version: 10
fail-fast: false
steps:
- name: Checkout
Expand All @@ -81,13 +72,11 @@ jobs:
${{ runner.os }}-composer-${{ matrix.php }}-${{ matrix.dependencies }}
- name: Install lowest dependencies with Composer
if: matrix.dependencies == 'lowest'
run: composer update --no-progress --no-suggest --prefer-stable --prefer-lowest --ansi
run: composer update --no-progress --prefer-stable --prefer-lowest --ansi
- name: Install highest dependencies with Composer
if: matrix.dependencies == 'highest'
run: composer update --no-progress --no-suggest --ansi
run: composer update --no-progress --ansi
- name: Run tests with PHPUnit
env:
SYMFONY_MAX_PHPUNIT_VERSION: ${{ matrix.phpunit-version }}
run: vendor/bin/simple-phpunit --colors=always

# coverage:
Expand Down
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
->setRiskyAllowed(true)
->registerCustomFixers(new PhpCsFixerCustomFixers\Fixers())
->setRules([
'@PHP82Migration' => true,
'@PHP85Migration' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,

Expand Down
30 changes: 15 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@
}
],
"require": {
"php": "^8.1",
"doctrine/persistence": "^2.0|^3.0|^4.0",
"symfony/config": "^5.4.30|^6.3|^7.0",
"symfony/dependency-injection": "^5.4.30|^6.3|^7.0",
"symfony/doctrine-bridge": "^5.4.30|^6.3|^7.0",
"symfony/form": "^5.4.30|^6.3|^7.0",
"symfony/http-kernel": "^5.4.30|^6.3|^7.0"
"php": "^8.5",
"doctrine/persistence": "^3.0|^4.0",
"symfony/config": "^8.0",
"symfony/dependency-injection": "^8.0",
"symfony/doctrine-bridge": "^8.0",
"symfony/form": "^8.0",
"symfony/http-kernel": "^8.0"
},
"require-dev": {
"doctrine/orm": "^2.15|^3.0",
"friendsofphp/php-cs-fixer": "^3.45",
"doctrine/orm": "^3.0",
"friendsofphp/php-cs-fixer": "^3.66",
"kubawerlos/php-cs-fixer-custom-fixers": "^3.18",
"phpstan/phpstan": "^1.10",
"rector/rector": "^0.18",
"symfony/cache": "^5.4.30|^6.3|^7.0",
"symfony/phpunit-bridge": "^5.4.30|^6.3|^7.0",
"symfony/validator": "^5.4.30|^6.3|^7.0",
"vimeo/psalm": "^5.18"
"phpstan/phpstan": "^2.1",
"rector/rector": "^2.0",
"symfony/cache": "^8.0",
"symfony/phpunit-bridge": "^8.0",
"symfony/validator": "^8.0",
"vimeo/psalm": "^6.0"
},
"suggest": {
"a2lix/translation-form-bundle": "For translation form"
Expand Down
16 changes: 8 additions & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<!-- https://docs.phpunit.de/en/11.5/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.3/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
>
<coverage>
<source>
<include>
<directory>src/</directory>
</include>
<exclude>
<directory>src/Resources</directory>
</exclude>
</coverage>
</source>

<php>
<ini name="error_reporting" value="-1"/>
<server name="SYMFONY_MAX_PHPUNIT_VERSION" value="9.6" />
<server name="SYMFONY_PHPUNIT_VERSION" value="11.5"/>
</php>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
<extensions>
<bootstrap class="Symfony\Bridge\PhpUnit\SymfonyExtension"/>
</extensions>

<testsuites>
<testsuite name="Bundle Test Suite">
Expand Down
39 changes: 10 additions & 29 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,16 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\PHPUnit\Set\PHPUnitLevelSetList;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Symfony\Set\SymfonyLevelSetList;
use Rector\Symfony\Set\SymfonySetList;
use Rector\Symfony\Set\TwigSetList;

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

$rectorConfig->phpVersion(PhpVersion::PHP_82);
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_82,

DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES,
// DoctrineSetList::DOCTRINE_CODE_QUALITY,
DoctrineSetList::DOCTRINE_ORM_214,
DoctrineSetList::DOCTRINE_DBAL_30,

PHPUnitLevelSetList::UP_TO_PHPUNIT_91,
// PHPUnitSetList::PHPUNIT_CODE_QUALITY,
// PHPUnitSetList::PHPUNIT_YIELD_DATA_PROVIDER,
]);
};
])
->withImportNames(importShortClasses: false)
->withPhpSets()
->withComposerBased(
symfony: true,
doctrine: true,
phpunit: true,
);
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('a2lix_auto_form');
$rootNode = method_exists(TreeBuilder::class, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('a2lix_auto_form');
$rootNode = $treeBuilder->getRootNode();

$rootNode
->children()
Expand Down
2 changes: 1 addition & 1 deletion src/Form/Manipulator/DoctrineORMManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@ private function checkFieldIsValid($formFieldName, $formFieldConfig, $validObjec
return;
}

throw new \RuntimeException(sprintf("Field '%s' doesn't exist in %s", $formFieldName, $class));
throw new \RuntimeException(\sprintf("Field '%s' doesn't exist in %s", $formFieldName, $class));
}
}
2 changes: 1 addition & 1 deletion src/ObjectInfo/DoctrineORMInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function getAssociationTargetClass(string $class, string $fieldName): str
$metadata = $this->classMetadataFactory->getMetadataFor($class);

if (!$metadata->hasAssociation($fieldName)) {
throw new \RuntimeException(sprintf('Unable to find the association target class of "%s" in %s.', $fieldName, $class));
throw new \RuntimeException(\sprintf('Unable to find the association target class of "%s" in %s.', $fieldName, $class));
}

return $metadata->getAssociationTargetClass($fieldName);
Expand Down
1 change: 1 addition & 0 deletions tests/Form/Type/AutoFormTypeAdvancedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public function testCreationFormWithOverriddenFieldsMappedFalse(): Product
return $product;
}

#[\Override]
protected function getExtensions(): array
{
$autoFormType = $this->getConfiguredAutoFormType();
Expand Down
6 changes: 3 additions & 3 deletions tests/Form/Type/AutoFormTypeSimpleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use A2lix\AutoFormBundle\Tests\Fixtures\Entity\Media;
use A2lix\AutoFormBundle\Tests\Fixtures\Entity\Product;
use A2lix\AutoFormBundle\Tests\Form\TypeTestCase;
use PHPUnit\Framework\Attributes\Depends;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\PreloadedExtension;

Expand Down Expand Up @@ -82,9 +83,7 @@ public function testCreationForm(): Product
return $product;
}

/**
* @depends testCreationForm
*/
#[Depends('testCreationForm')]
public function testEditionForm(Product $product): void
{
$product->getMedias()[0]->setUrl('http://example.org/media1-edit');
Expand Down Expand Up @@ -121,6 +120,7 @@ public function testEditionForm(Product $product): void
}
}

#[\Override]
protected function getExtensions(): array
{
$autoFormType = $this->getConfiguredAutoFormType();
Expand Down
3 changes: 2 additions & 1 deletion tests/Form/TypeTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ protected function getDoctrineORMManipulator(): DoctrineORMManipulator
return $this->doctrineORMManipulator;
}

$config = ORMSetup::createAttributeMetadataConfiguration([__DIR__.'/../Fixtures/Entity'], true);
$config = ORMSetup::createAttributeMetadataConfig([__DIR__.'/../Fixtures/Entity'], true);
$config->enableNativeLazyObjects(true);
$connection = DriverManager::getConnection(['driver' => 'pdo_sqlite', 'memory' => true], $config);
$entityManager = new EntityManager($connection, $config);
$doctrineORMInfo = new DoctrineORMInfo($entityManager->getMetadataFactory());
Expand Down
Loading