-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle assert for php8 Union and Intersection
- Loading branch information
Cristoforo Cervino
committed
Aug 28, 2023
1 parent
6e544a8
commit 8455670
Showing
10 changed files
with
195 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
tests/Form/DumbObjectIntersectionTypeHint1PageFilterType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Andante\PageFilterFormBundle\Tests\Form; | ||
|
||
use Andante\PageFilterFormBundle\Form\PageFilterType; | ||
use Andante\PageFilterFormBundle\Tests\Model\Test1Interface; | ||
use Andante\PageFilterFormBundle\Tests\Model\Test2Interface; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
|
||
class DumbObjectIntersectionTypeHint1PageFilterType extends AbstractType | ||
{ | ||
public function buildForm(FormBuilderInterface $builder, array $options): void | ||
{ | ||
if (\version_compare(PHP_VERSION, '8.1.0') >= 0) { | ||
$builder->add('child1', TextType::class, [ | ||
'target_callback' => function (Test1Interface&Test2Interface $obj, ?int $a): void { | ||
}, | ||
]); | ||
} | ||
} | ||
|
||
public function getParent() | ||
{ | ||
return PageFilterType::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Andante\PageFilterFormBundle\Tests\Form; | ||
|
||
use Andante\PageFilterFormBundle\Form\PageFilterType; | ||
use Andante\PageFilterFormBundle\Tests\Model\Test1Interface; | ||
use Andante\PageFilterFormBundle\Tests\Model\Test2Interface; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
|
||
class DumbObjectUnionTypeHint1PageFilterType extends AbstractType | ||
{ | ||
public function buildForm(FormBuilderInterface $builder, array $options): void | ||
{ | ||
if (\version_compare(PHP_VERSION, '8.0.0') >= 0) { | ||
$builder->add('child1', TextType::class, [ | ||
'target_callback' => function (Test1Interface|Test2Interface $obj, ?int $a): void { | ||
}, | ||
]); | ||
} | ||
} | ||
|
||
public function getParent() | ||
{ | ||
return PageFilterType::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Andante\PageFilterFormBundle\Tests\Model; | ||
|
||
class ExampleModel extends \stdClass implements Test1Interface, Test2Interface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Andante\PageFilterFormBundle\Tests\Model; | ||
|
||
interface Test1Interface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Andante\PageFilterFormBundle\Tests\Model; | ||
|
||
interface Test2Interface | ||
{ | ||
} |