Skip to content

Commit

Permalink
Strict hidden input value type handling
Browse files Browse the repository at this point in the history
  • Loading branch information
xificurk committed Feb 9, 2024
1 parent 677099e commit 005c5f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/FileUploadControl/FileUploadControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,9 @@ protected function getThumbnailProvider(): ThumbnailProvider

protected function getUploadNamespace(): UploadNamespace
{
$nameSpaceValue = (string) $this->getNamespaceControl()->getValue();
if (UploadNamespace::isValid($nameSpaceValue)) {
/** @var string|null $nameSpaceValue */
$nameSpaceValue = $this->getNamespaceControl()->getValue();
if ($nameSpaceValue !== null && UploadNamespace::isValid($nameSpaceValue)) {
return UploadNamespace::fromString($nameSpaceValue);
}

Expand Down
5 changes: 0 additions & 5 deletions tests/PHPStan/conditional.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@
}

if (InstalledVersions::satisfies(new VersionParser(), 'nette/forms', '<3.2')) {
$config['parameters']['ignoreErrors'][] = [
'message' => '#^Cannot cast mixed to string\\.$#',
'path' => '../../src/FileUploadControl/FileUploadControl.php',
'count' => 1,
];
$config['parameters']['ignoreErrors'][] = [
'message' => '#^Return type \\(string\\|Stringable\\|null\\) of method Nepada\\\\FileUploadControl\\\\Validation\\\\FakeUploadControl\\:\\:getCaption\\(\\) should be covariant with return type \\(object\\|string\\) of method Nette\\\\Forms\\\\Controls\\\\BaseControl\\:\\:getCaption\\(\\)$#',
'path' => '../../src/FileUploadControl/Validation/FakeUploadControl.php',
Expand Down

0 comments on commit 005c5f3

Please sign in to comment.