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
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"require": {
"php": ">=8.2",
"ext-fileinfo": "*",
"ipl/stdlib": ">=0.12.0",
"ipl/validator": ">=0.5.0",
"ipl/stdlib": ">=0.15.0",
"ipl/validator": ">=1.0.0",
"psr/http-message": "^1.1",
"guzzlehttp/psr7": "^2.8"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Contract/FormElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function getMessages();
*
* @return $this
*/
public function addMessage($message);
public function addMessage(string $message): static;

/**
* Get the name of the element
Expand Down
2 changes: 1 addition & 1 deletion src/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public function handleRequest(ServerRequestInterface $request)
$this->onSuccess();
$this->emitOnce(Contract\Form::ON_SUBMIT, [$this]);
} catch (Throwable $e) {
$this->addMessage($e);
$this->addMessage($e->getMessage());
$this->onError();
$this->emit(Contract\Form::ON_ERROR, [$e, $this]);
}
Expand Down
8 changes: 4 additions & 4 deletions src/FormElement/FormElements.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,12 @@ public function addElementsFrom($form)
* Add a decorator loader
*
* @param string $namespace Namespace of the decorators
* @param string $postfix Decorator name postfix, if any
* @param ?string $postfix Decorator name postfix, if any
*
* @return $this
* @deprecated Use {@see addElementDecoratorLoaderPaths()} instead
*/
public function addDecoratorLoader($namespace, $postfix = null)
public function addDecoratorLoader(string $namespace, ?string $postfix = null): static
{
$this->addPluginLoader('decorator', $namespace, $postfix);

Expand All @@ -449,11 +449,11 @@ public function addDecoratorLoader($namespace, $postfix = null)
* Add an element loader
*
* @param string $namespace Namespace of the elements
* @param string $postfix Element name postfix, if any
* @param ?string $postfix Element name postfix, if any
*
* @return $this
*/
public function addElementLoader($namespace, $postfix = null)
public function addElementLoader(string $namespace, ?string $postfix = null): static
{
$this->addPluginLoader('element', $namespace, $postfix);

Expand Down
8 changes: 4 additions & 4 deletions tests/FormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ protected function assemble()

$form->handleRequest($request);

$request2 = $this->createMock(ServerRequestInterface::class);
$request2->expects($this->any())->method('getMethod')->willReturn('POST');
$request2->expects($this->once())->method('getParsedBody')->willReturn([]);
$request2->expects($this->once())->method('getUploadedFiles')->willReturn([]);
$request2 = $this->createStub(ServerRequestInterface::class);
$request2->method('getMethod')->willReturn('POST');
$request2->method('getParsedBody')->willReturn([]);
$request2->method('getUploadedFiles')->willReturn([]);

$form->handleRequest($request2);
}
Expand Down
Loading