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
1 change: 0 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
'phpdoc_var_without_name' => true,
'phpdoc_to_comment' => false,
'single_line_throw' => true,
'string_implicit_backslashes' => false, // Temporary?
'statement_indentation' => true,
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['arrays', 'parameters']],
'use_arrow_functions' => true,
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"symfony/http-kernel": "^7.4|^8.0",
"symfony/property-info": "^7.4|^8.0",
"symfony/type-info": "^7.4|^8.0",
"phpdocumentor/reflection-docblock": "^5.6"
"phpdocumentor/reflection-docblock": "^5.6|^6.0"
},
"require-dev": {
"doctrine/orm": "^3.5.8",
Expand All @@ -34,12 +34,12 @@
"phpstan/phpstan-phpunit": "^2.0.10",
"phpstan/phpstan-strict-rules": "^2.0.7",
"phpstan/phpstan-symfony": "^2.0.9",
"phpunit/phpunit": "^12.5.2",
"phpunit/phpunit": "^13.0.5",
"rector/rector": "^2.2.14",
"symfony/cache": "^7.4.1",
"symfony/doctrine-bridge": "^7.4.1",
"symfony/validator": "^7.4.2",
"symfony/var-dumper": "^7.4"
"symfony/cache": "^7.4|^8.0",
"symfony/doctrine-bridge": "^7.4|^8.0",
"symfony/validator": "^7.4|^8.0",
"symfony/var-dumper": "^7.4|^8.0"
},
"suggest": {
"a2lix/translation-form-bundle": "For translation form"
Expand Down
6 changes: 3 additions & 3 deletions src/Form/Attribute/AutoTypeCustom.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
final readonly class AutoTypeCustom
{
/**
* @param array<string, mixed> $options
* @param class-string|null $type
* @param list<string>|null $groups
* @param array<string, mixed> $options
* @param class-string<\Symfony\Component\Form\FormTypeInterface<mixed>>|null $type
* @param list<string>|null $groups
*/
public function __construct(
private array $options = [],
Expand Down
4 changes: 2 additions & 2 deletions src/Form/Builder/AutoTypeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

/**
* @phpstan-type ChildOptions array{
* child_type?: class-string,
* child_type?: class-string<\Symfony\Component\Form\FormTypeInterface<mixed>>,
* child_name?: string,
* child_excluded?: bool,
* child_embedded?: bool,
Expand Down Expand Up @@ -287,7 +287,7 @@ private function updateEmbeddedChildOptions(
$innerType = $propTypeInfo instanceof TypeInfo\NullableType ? $propTypeInfo->getWrappedType() : $propTypeInfo;

if (Collection::class === $innerType->getClassName()) {
throw new \RuntimeException(\sprintf('Unprecise PhpDoc Collection detected for "%s:%s". Fix it. For example: "@param Collection<int, Obj> $%s"', $refProperty->class, $refProperty->name, $refProperty->name));
throw new \RuntimeException(\sprintf('Unprecise PhpDoc Collection detected for "%s:%s". Fix it. For example: "@var Collection<array-key, Obj>"', $refProperty->class, $refProperty->name));
}

return [
Expand Down
8 changes: 3 additions & 5 deletions tests/Fixtures/Dto/Product1.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,20 @@

class Product1
{
/**
* @param list<string> $tags
* @param Collection<int, Media1> $mediaColl
* @param list<ProductStatus> $statusList
*/
public function __construct(
#[AutoTypeCustom(excluded: true)]
public readonly ?string $id = null,
public readonly ?string $title = null,
#[AutoTypeCustom(type: CoreType\TextareaType::class, name: 'desc', options: ['attr' => ['rows' => 2]])]
private ?string $description = null,
public readonly ?int $code = null,
/** @var list<string> */
public readonly array $tags = [],
public readonly ?Media1 $mediaMain = null,
/** @var Collection<array-key, Media1> */
public ?Collection $mediaColl = null,
public readonly ?ProductStatus $status = null,
/** @var list<ProductStatus> */
public readonly ?array $statusList = null,
#[AutoTypeCustom(groups: ['Default', 'validity'])]
public readonly ?\DateTimeImmutable $validityStartAt = null,
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/Entity/Product1.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Product1
#[ORM\ManyToOne(targetEntity: Media1::class)]
public ?Media1 $mediaMain = null;

/** @var Collection<int, Media1> */
/** @var Collection<array-key, Media1> */
#[ORM\OneToMany(targetEntity: Media1::class, mappedBy: 'product', cascade: ['all'], orphanRemoval: true)]
public Collection $mediaColl;

Expand Down
2 changes: 1 addition & 1 deletion tests/Form/TestScenario.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

/**
* @phpstan-type ExpectedChildren = array<string, array{
* expected_type?: class-string,
* expected_type?: class-string<\Symfony\Component\Form\FormTypeInterface<mixed>>,
* expected_children?: mixed,
* ...
* }>
Expand Down
5 changes: 2 additions & 3 deletions tests/Form/Type/AutoTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProviderExternal;
use Symfony\Component\Form\FormInterface;

/**
* @internal
Expand All @@ -49,8 +48,8 @@ public function testScenario(TestScenario $testScenario): void
}

/**
* @param ExpectedChildren $expectedForm
* @param array<array-key, FormInterface<mixed>> $formChildren
* @param ExpectedChildren $expectedForm
* @param array<array-key, \Symfony\Component\Form\FormInterface<mixed>> $formChildren
*/
private static function assertFormChildren(array $expectedForm, array $formChildren, string $parentPath = ''): void
{
Expand Down