Skip to content

Commit 98ac273

Browse files
Allow @var mixed annotations (#30)
1 parent d0a62be commit 98ac273

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

php-cs-fixer-rules.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@
4848
],
4949
'no_multiline_whitespace_around_double_arrow' => true,
5050
'no_superfluous_elseif' => true,
51-
'no_superfluous_phpdoc_tags' => true,
51+
'no_superfluous_phpdoc_tags' => [
52+
// Psalm wants us to have an explicit type annotation whenever we assign `mixed` to a variable.
53+
'allow_mixed' => true,
54+
],
5255
'no_trailing_comma_in_singleline' => true,
5356
'no_unused_imports' => true,
5457
'no_useless_else' => true,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* @param array<string, mixed> $struct
7+
*/
8+
function getFoo(array $struct): void
9+
{
10+
/** @var mixed $foo */
11+
$foo = $struct['foo'];
12+
echo $foo;
13+
}

0 commit comments

Comments
 (0)