Skip to content

Commit

Permalink
Update phpstan ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
xificurk committed Jan 8, 2024
1 parent a89dad1 commit 34397a5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
20 changes: 2 additions & 18 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,12 @@ parameters:
message: "#^Parameter \\#1 \\$value \\(bool\\|Nette\\\\Utils\\\\Html\\|string\\) of method Nepada\\\\FileUploadControl\\\\FileUploadControl\\:\\:setRequired\\(\\) should be contravariant with parameter \\$value \\(bool\\|object\\|string\\) of method Nextras\\\\FormComponents\\\\Fragments\\\\UIControl\\\\BaseControl\\:\\:setRequired\\(\\)$#"
count: 1
path: src/FileUploadControl/FileUploadControl.php
-
message: "#^Parameter \\#1 \\$value of method Nette\\\\Forms\\\\Rules\\:\\:setRequired\\(\\) expects bool\\|string, bool\\|Nette\\\\Utils\\\\Html\\|string given\\.$#"
count: 1
path: src/FileUploadControl/FileUploadControl.php
-
message: "#^Return type \\(Nette\\\\Utils\\\\Html\\|string\\|null\\) of method Nepada\\\\FileUploadControl\\\\Validation\\\\FakeUploadControl\\:\\:getCaption\\(\\) should be covariant with return type \\(object\\|string\\) of method Nette\\\\Forms\\\\Controls\\\\BaseControl\\:\\:getCaption\\(\\)$#"
count: 1
path: src/FileUploadControl/Validation/FakeUploadControl.php
-
message: "#^Method Nepada\\\\FileUploadControl\\\\Validation\\\\FakeUploadControl\\:\\:getCaption\\(\\) should return Nette\\\\Utils\\\\Html\\|string\\|null but returns object\\|string\\.$#"
count: 1
path: src/FileUploadControl/Validation/FakeUploadControl.php
-
message: "#^Parameter \\#1 \\$message \\(Nette\\\\Utils\\\\Html\\|string\\) of method Nepada\\\\FileUploadControl\\\\Validation\\\\FakeUploadControl\\:\\:addError\\(\\) should be contravariant with parameter \\$message \\(object\\|string\\) of method Nette\\\\Forms\\\\Controls\\\\BaseControl\\:\\:addError\\(\\)$#"
message: "#^Parameter \\#1 \\$message \\(Nette\\\\Utils\\\\Html\\|string\\) of method Nepada\\\\FileUploadControl\\\\Validation\\\\FakeUploadControl\\:\\:addError\\(\\) should be contravariant with parameter \\$message \\((object\\|)?string(\\|Stringable)?\\) of method Nette\\\\Forms\\\\Controls\\\\BaseControl(<.*>)?\\:\\:addError\\(\\)$#"
count: 1
path: src/FileUploadControl/Validation/FakeUploadControl.php
-
Expand All @@ -75,10 +67,6 @@ parameters:
message: "#^Parameter \\#2 \\$validator \\(\\(callable\\(\\)\\: mixed\\)\\|string\\) of method Nepada\\\\FileUploadControl\\\\FileUploadControl\\:\\:addConditionOn\\(\\) should be contravariant with parameter \\$validator \\(mixed\\) of method Nextras\\\\FormComponents\\\\Fragments\\\\UIControl\\\\BaseControl\\:\\:addConditionOn\\(\\)$#"
count: 1
path: src/FileUploadControl/FileUploadControl.php
-
message: "#^Cannot cast mixed to string\\.$#"
count: 1
path: src/FileUploadControl/FileUploadControl.php
-
message: "#^Dead catch \\- Throwable is never thrown in the try block\\.$#"
count: 1
Expand All @@ -103,15 +91,11 @@ parameters:
message: "#^Parameter \\#2 \\$size of class Nepada\\\\FileUploadControl\\\\Storage\\\\Metadata\\\\FileUploadMetadata constructor expects int, mixed given\\.$#"
count: 1
path: src/FileUploadControl/Storage/Metadata/FileUploadMetadata.php
-
message: "#^Parameter \\#1 \\$control \\(Nette\\\\Forms\\\\Control\\<mixed\\>\\) of method Nepada\\\\FileUploadControl\\\\FileUploadControl\\:\\:addConditionOn\\(\\) should be contravariant with parameter \\$control \\(Nette\\\\Forms\\\\IControl\\) of method Nextras\\\\FormComponents\\\\Fragments\\\\UIControl\\\\BaseControl\\:\\:addConditionOn\\(\\)$#"
count: 1
path: src/FileUploadControl/FileUploadControl.php
- # Used for checksum only
message: "#^Calling sha1\\(\\) is forbidden, use hash\\(\\) with at least SHA\\-256 for secure hash, or password_hash\\(\\) for passwords$#"
count: 1
path: src/FileUploadControl/Storage/Metadata/FileUploadMetadata.php
- # false positive
message: "#^Invalid var phpdoc of \\$files\\. Cannot assign array\\<string\\>\\|string to array\\<int, Nette\\\\Http\\\\FileUpload\\>$#"
message: "#^Invalid var phpdoc of \\$files\\. Cannot assign array.* to array\\<int, Nette\\\\Http\\\\FileUpload\\>$#"
count: 1
path: src/FileUploadControl/FileUploadControl.php
20 changes: 20 additions & 0 deletions tests/PHPStan/conditional.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,26 @@
$config['parameters']['ignoreErrors'][] = [
'message' => '~contains generic type Nette\\\\Forms\\\\Control<mixed> but interface Nette\\\\Forms\\\\Control is not generic~',
];
$config['parameters']['ignoreErrors'][] = [
'message' => '#^Cannot cast mixed to string\\.$#',
'path' => '../../src/FileUploadControl/FileUploadControl.php',
'count' => 1,
];
$config['parameters']['ignoreErrors'][] = [
'message' => '#^Return type \\(Nette\\\\Utils\\\\Html\\|string\\|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',
'count' => 1,
];
$config['parameters']['ignoreErrors'][] = [
'message' => '#^Parameter \\#1 \\$control \\(Nette\\\\Forms\\\\Control\\<mixed\\>\\) of method Nepada\\\\FileUploadControl\\\\FileUploadControl\\:\\:addConditionOn\\(\\) should be contravariant with parameter \\$control \\(Nette\\\\Forms\\\\IControl\\) of method Nextras\\\\FormComponents\\\\Fragments\\\\UIControl\\\\BaseControl\\:\\:addConditionOn\\(\\)$#s',
'path' => '../../src/FileUploadControl/FileUploadControl.php',
'count' => 1,
];
$config['parameters']['ignoreErrors'][] = [
'message' => '#^Parameter \\#1 \\$value of method Nette\\\\Forms\\\\Rules\\:\\:setRequired\\(\\) expects bool\\|string, bool\\|Nette\\\\Utils\\\\Html\\|string given\\.$#',
'path' => '../../src/FileUploadControl/FileUploadControl.php',
'count' => 1,
];
}

return $config;

0 comments on commit 34397a5

Please sign in to comment.