Skip to content

Commit

Permalink
Fix psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent4vx committed Jan 18, 2021
1 parent 9d1dc29 commit 9fdbab4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
vendor/
.idea/
composer.lock
infection.log
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -15,7 +15,7 @@ jobs:
- composer global require infection/infection
script:
- composer psalm
- ~/.config/composer/vendor/bin/infection --min-msi=90
- ~/.config/composer/vendor/bin/infection -s --min-msi=90

install:
- travis_retry composer install
Expand Down
10 changes: 10 additions & 0 deletions src/FilterChildBuilder.php
Expand Up @@ -119,6 +119,16 @@ public function depends(string ...$inputNames)
return $this;
}

/**
* {@inheritdoc}
*/
public function childFactory($factory)
{
$this->builder->childFactory($factory);

return $this;
}

/**
* {@inheritdoc}
*/
Expand Down
6 changes: 3 additions & 3 deletions src/FilterFormBuilder.php
Expand Up @@ -99,7 +99,7 @@ public function add(string $name, string $element): ChildBuilderInterface
* @return FilterChildBuilder|StringElementBuilder
* @psalm-return FilterChildBuilder<StringElementBuilder>
*/
public function string(string $name, $default = null): ChildBuilderInterface
public function string(string $name, ?string $default = null): ChildBuilderInterface
{
return new FilterChildBuilder($this->inner->string($name, $default));
}
Expand All @@ -110,7 +110,7 @@ public function string(string $name, $default = null): ChildBuilderInterface
* @return FilterChildBuilder|IntegerElementBuilder
* @psalm-return FilterChildBuilder<IntegerElementBuilder>
*/
public function integer(string $name, $default = null): ChildBuilderInterface
public function integer(string $name, ?int $default = null): ChildBuilderInterface
{
return new FilterChildBuilder($this->inner->integer($name, $default));
}
Expand All @@ -121,7 +121,7 @@ public function integer(string $name, $default = null): ChildBuilderInterface
* @return FilterChildBuilder|FloatElementBuilder
* @psalm-return FilterChildBuilder<FloatElementBuilder>
*/
public function float(string $name, $default = null): ChildBuilderInterface
public function float(string $name, ?float $default = null): ChildBuilderInterface
{
return new FilterChildBuilder($this->inner->float($name, $default));
}
Expand Down
3 changes: 3 additions & 0 deletions tests/FilterChildBuilderTest.php
Expand Up @@ -49,6 +49,9 @@ public function test_delegated_methods()
$inner->expects($this->once())->method('depends')->with('foo', 'bar');
$this->assertSame($builder, $builder->depends('foo', 'bar'));

$inner->expects($this->once())->method('childFactory')->with(function() {});
$this->assertSame($builder, $builder->childFactory(function() {}));

$child = $this->builder->length(['min' => 3])->buildChild()->setParent(new Form(new ChildrenCollection()));
$this->assertFalse($child->element()->submit('a')->valid());
$this->assertTrue($child->element()->submit('aaa')->valid());
Expand Down

0 comments on commit 9fdbab4

Please sign in to comment.