-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also removes compatibility to diverging property paths defined in the form, we only support direct properties which are mapped 1:1 in the form. This seems easiest and anything else would just lead to a headache, although maybe there is a better option sometime in the future or when we go PHP 8 only. The PHP 8 support is preliminary, as it was not tested yet.
- Loading branch information
Showing
9 changed files
with
375 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<files psalm-version="3.11.2@d470903722cfcbc1cd04744c5491d3e6d13ec3d9"> | ||
<files psalm-version="3.18.2@19aa905f7c3c7350569999a93c40ae91ae4e1626"> | ||
<file src="src/Annotation/StringFilterExtension.php"> | ||
<PossiblyInvalidArgument occurrences="1"> | ||
<code>$model</code> | ||
</PossiblyInvalidArgument> | ||
<TypeDoesNotContainType occurrences="2"/> | ||
<UndefinedClass occurrences="4"> | ||
<code>$reflectionPropertyType</code> | ||
<code>$reflectionPropertyType</code> | ||
<code>\ReflectionUnionType</code> | ||
<code>\ReflectionUnionType</code> | ||
</UndefinedClass> | ||
</file> | ||
</files> |
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,40 @@ | ||
<?php | ||
|
||
namespace Squirrel\Strings\Tests\TestClasses; | ||
|
||
use Squirrel\Strings\Annotation\StringFilter; | ||
|
||
class ClassWithPrivateTypedProperties | ||
{ | ||
/** | ||
* @StringFilter({"Lowercase","Trim"}) | ||
*/ | ||
private string $title = ''; | ||
|
||
/** | ||
* @StringFilter("Trim") | ||
*/ | ||
private string $text = ''; | ||
|
||
private $noAnnotation; | ||
|
||
public function getTitle(): string | ||
{ | ||
return $this->title; | ||
} | ||
|
||
public function getText(): string | ||
{ | ||
return $this->text; | ||
} | ||
|
||
public function setTitle(string $title) | ||
{ | ||
$this->title = $title; | ||
} | ||
|
||
public function setText(string $text) | ||
{ | ||
$this->text = $text; | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
namespace Squirrel\Strings\Tests\TestClasses; | ||
|
||
use Squirrel\Strings\Annotation\StringFilter; | ||
|
||
class ClassWithPublicTypedProperties | ||
{ | ||
/** | ||
* @StringFilter({"Lowercase","Trim"}) | ||
*/ | ||
public string $title = ''; | ||
|
||
/** | ||
* @StringFilter("Trim") | ||
*/ | ||
public array $texts = [ | ||
'', | ||
'', | ||
]; | ||
|
||
public $noAnnotation; | ||
} |
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,36 @@ | ||
<?php | ||
|
||
namespace Squirrel\Strings\Tests\TestForms; | ||
|
||
use Squirrel\Strings\Tests\TestClasses\ClassWithPrivateTypedProperties; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
|
||
class PrivateTypedPropertiesForm extends AbstractType | ||
{ | ||
public function buildForm(FormBuilderInterface $builder, array $options) | ||
{ | ||
$builder | ||
->add('title', TextType::class, [ | ||
'label' => false, | ||
]) | ||
->add('text', TextType::class, [ | ||
'label' => false, | ||
]) | ||
; | ||
} | ||
|
||
/** | ||
* Set class where our form data comes from | ||
* | ||
* @param OptionsResolver $resolver | ||
*/ | ||
public function configureOptions(OptionsResolver $resolver) | ||
{ | ||
$resolver->setDefaults(array( | ||
'data_class' => ClassWithPrivateTypedProperties::class, | ||
)); | ||
} | ||
} |
Oops, something went wrong.