Skip to content

Commit

Permalink
Allow @var mixed annotations (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
MidnightDesign authored Oct 9, 2023
1 parent d0a62be commit 98ac273
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion php-cs-fixer-rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@
],
'no_multiline_whitespace_around_double_arrow' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => true,
'no_superfluous_phpdoc_tags' => [
// Psalm wants us to have an explicit type annotation whenever we assign `mixed` to a variable.
'allow_mixed' => true,
],
'no_trailing_comma_in_singleline' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
Expand Down
13 changes: 13 additions & 0 deletions tests/fixtures/valid/mixed-assignment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

/**
* @param array<string, mixed> $struct
*/
function getFoo(array $struct): void
{
/** @var mixed $foo */
$foo = $struct['foo'];
echo $foo;
}

0 comments on commit 98ac273

Please sign in to comment.