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
49 changes: 43 additions & 6 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
php-versions: ['8.4', '8.5']
name: PHP ${{ matrix.php-versions }}

steps:
Expand Down Expand Up @@ -43,6 +43,43 @@ jobs:
- name: Run test suite
run: composer run-script tests

sf-compatibility:
runs-on: ubuntu-latest
strategy:
matrix:
sf-versions: ['6.4', '7.4', '8.0']
name: Symfony ${{ matrix.sf-versions }}

steps:
- uses: actions/checkout@v2

- name: Set Timezone
uses: szenius/set-timezone@v1.0
with:
timezoneLinux: "Europe/Paris"

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
extensions: json, intl
ini-values: date.timezone=Europe/Paris
- name: Check PHP Version
run: php -v

- name: Install dependencies
run: composer install --prefer-dist --no-progress

# psalm 6 is not compatible with Symfony 6.4, so remove it
- name: Remove psalm
run: composer remove --dev vimeo/psalm

- name: Set Symfony version
run: composer require --dev "symfony/symfony:~${{ matrix.sf-versions }}.0"

- name: Run test suite
run: composer run-script tests

analysis:
name: Analysis
runs-on: ubuntu-latest
Expand All @@ -58,14 +95,14 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.4
extensions: json
ini-values: date.timezone=Europe/Paris

- name: Install Infection
run: |
wget https://github.com/infection/infection/releases/download/0.21.5/infection.phar
wget https://github.com/infection/infection/releases/download/0.21.5/infection.phar.asc
wget https://github.com/infection/infection/releases/download/0.32.6/infection.phar
wget https://github.com/infection/infection/releases/download/0.32.6/infection.phar.asc
chmod +x infection.phar
gpg --recv-keys C6D76C329EBADE2FB9C458CFC5095986493B4AA0
gpg --with-fingerprint --verify infection.phar.asc infection.phar
Expand All @@ -83,7 +120,7 @@ jobs:
- name: Run Infection
run: |
git fetch --depth=1 origin $GITHUB_BASE_REF
./infection.phar --logger-github --git-diff-filter=AM --min-msi=80
./infection.phar --logger-github --git-diff-base=origin/$GITHUB_BASE_REF --git-diff-filter=AM --min-msi=80

coverage:
name: Test coverage
Expand All @@ -100,7 +137,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.4
extensions: json
ini-values: date.timezone=Europe/Paris

Expand Down
20 changes: 9 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,25 @@
"autoload": {
"psr-4": {
"Bdf\\Form\\": "src"
},
"classmap": ["polyfill/WeakReference.php"]
}
},
"autoload-dev": {
"psr-4": {
"Bdf\\Form\\": "tests"
}
},
"require": {
"php": ">=7.4",
"symfony/property-access": "~4.3|~5.0|~6.0|~7.0",
"symfony/validator": "~4.3|~5.0|~6.0|~7.0",
"symfony/polyfill-php80": "~1.22"
"php": "~8.4",
"symfony/property-access": "~6.4|~7.0|~8.0",
"symfony/validator": "~6.4|~7.0|~8.0"
},
"require-dev": {
"symfony/security-csrf": "~4.3|~5.0|~6.0|~7.0",
"symfony/security-csrf": "~6.4|~7.0|~8.0",
"giggsey/libphonenumber-for-php": "~8.0|~9.0",
"phpunit/phpunit": "~7.0|~8.0|~9.0",
"vimeo/psalm": "~4.30|~5.22",
"symfony/http-foundation": "~4.3|~5.0|~6.0|~7.0",
"symfony/form": "~4.3|~5.0|~6.0|~7.0"
"phpunit/phpunit": "~13.0",
"vimeo/psalm": "~6.15.1",
"symfony/http-foundation": "~6.4|~7.0|~8.0",
"symfony/form": "~6.4|~7.0|~8.0"
},
"suggest": {
"symfony/security-csrf": "For enable CSRF element",
Expand Down
54 changes: 27 additions & 27 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" ?>
<phpunit bootstrap="tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
stderr="true"
<?xml version="1.0" encoding="utf-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/bootstrap.php"
colors="true"
processIsolation="false"
stopOnFailure="false"
stderr="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.5/phpunit.xsd"
cacheDirectory=".phpunit.cache"
>
<php>
<!-- php -r 'echo -1 & ~E_USER_DEPRECATED;' -->
<!--<ini name="error_reporting" value="-16385"/>-->
<ini name="error_reporting" value="-1" />
<ini name="zend.enable_gc" value="0" />
<ini name="memory_limit" value="2G" />
</php>

<testsuites>
<testsuite name="All Test Suite">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="false">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<php>
<!-- php -r 'echo -1 & ~E_USER_DEPRECATED;' -->
<!--<ini name="error_reporting" value="-16385"/>-->
<ini name="error_reporting" value="-1"/>
<ini name="zend.enable_gc" value="0"/>
<ini name="memory_limit" value="2G"/>
</php>
<testsuites>
<testsuite name="All Test Suite">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
50 changes: 0 additions & 50 deletions polyfill/WeakReference.php

This file was deleted.

9 changes: 8 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<psalm
errorLevel="3"
errorLevel="2"
resolveFromConfigFile="true"
findUnusedBaselineEntry="false"
findUnusedCode="false"
Expand All @@ -15,4 +15,11 @@
<directory name="vendor" />
</ignoreFiles>
</projectFiles>

<issueHandlers>
<ClassMustBeFinal errorLevel="suppress" />
<DocblockTypeContradiction errorLevel="suppress" />
<RedundantConditionGivenDocblockType errorLevel="suppress" />
<RedundantCastGivenDocblockType errorLevel="suppress" />
</issueHandlers>
</psalm>
26 changes: 7 additions & 19 deletions src/AbstractElementBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Bdf\Form\Util\TransformerBuilderTrait;
use Bdf\Form\Util\ValidatorBuilderTrait;
use Bdf\Form\Validator\ValueValidatorInterface;
use Override;

/**
* Base builder for elements
Expand All @@ -20,15 +21,8 @@ abstract class AbstractElementBuilder implements ElementBuilderInterface
use TransformerBuilderTrait;
use ValidatorBuilderTrait;

/**
* @var RegistryInterface
*/
private $registry;

/**
* @var mixed
*/
private $value;
private readonly RegistryInterface $registry;
private mixed $value = null;


/**
Expand All @@ -41,19 +35,15 @@ public function __construct(?RegistryInterface $registry = null)
$this->registry = $registry ?: new Registry();
}

/**
* {@inheritdoc}
*/
final public function value($value)
#[Override]
final public function value(mixed $value): static
{
$this->value = $value;

return $this;
}

/**
* {@inheritdoc}
*/
#[Override]
final public function buildElement(): ElementInterface
{
$element = $this->createElement($this->buildValidator(), $this->buildTransformer());
Expand All @@ -75,9 +65,7 @@ final public function buildElement(): ElementInterface
*/
abstract protected function createElement(ValueValidatorInterface $validator, TransformerInterface $transformer): ElementInterface;

/**
* {@inheritdoc}
*/
#[Override]
final protected function registry(): RegistryInterface
{
return $this->registry;
Expand Down
7 changes: 2 additions & 5 deletions src/Aggregate/ArrayChildBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
*/
class ArrayChildBuilder extends ChildBuilder
{
/**
* @var bool
*/
private $filterEmptyValues = true;
private bool $filterEmptyValues = true;

/**
* ArrayChildBuilder constructor.
Expand All @@ -30,7 +27,7 @@ public function __construct(string $name, ElementBuilderInterface $elementBuilde
{
parent::__construct($name, $elementBuilder, $registry);

$this->addFilterProvider([$this, 'provideEmptyValueFilter']);
$this->addFilterProvider($this->provideEmptyValueFilter(...));
}

/**
Expand Down
Loading
Loading