Skip to content

Commit

Permalink
Add back temporary support for strict-array
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Nov 11, 2022
1 parent 01064fe commit 9da26de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions UPGRADING.md
Expand Up @@ -29,13 +29,13 @@

- [BC] The parameter `$php_version` of `Psalm\Type\Atomic::create()` renamed
to `$analysis_php_version_id` and changed from `array|null` to `int|null`.
Previously it accepted PHP version as `strict-array{major_version, minor_version}`
Previously it accepted PHP version as `array{major_version, minor_version}`
while now it accepts version ID, similar to how [`PHP_VERSION_ID` is
calculated](https://www.php.net/manual/en/reserved.constants.php#constant.php-version-id).

- [BC] The parameter `$php_version` of `Psalm\Type::parseString()` renamed to
`$analysis_php_version_id` and changed from `array|null` to `int|null`.
Previously it accepted PHP version as `strict-array{major_version, minor_version}`
Previously it accepted PHP version as `array{major_version, minor_version}`
while now it accepts version ID.

- [BC] Parameter 0 of `canBeFullyExpressedInPhp()` of the classes listed below
Expand Down Expand Up @@ -805,7 +805,7 @@
- [BC] Class `Psalm\Type\TaintKind` became final
- [BC] Class `Psalm\Type\Union` became final
- [BC] Property `Psalm\Config::$universal_object_crates` changed default value
from `strict-array{'stdClass','SimpleXMLElement','SimpleXMLIterator'}` to `null`
from `array{'stdClass','SimpleXMLElement','SimpleXMLIterator'}` to `null`

## Removed
- [BC] Property `Psalm\Codebase::$php_major_version` was removed, use
Expand Down
2 changes: 1 addition & 1 deletion src/Psalm/Internal/Type/TypeParser.php
Expand Up @@ -1483,7 +1483,7 @@ private static function getTypeFromKeyedArrayTree(
throw new TypeParseTreeException('A callable array cannot be empty!');
}

if ($type !== 'array' && $type !== 'list') {
if ($type !== 'array' && $type !== 'strict-array' && $type !== 'list') {
throw new TypeParseTreeException('Unexpected brace character');
}

Expand Down
2 changes: 2 additions & 0 deletions src/Psalm/Internal/Type/TypeTokenizer.php
Expand Up @@ -37,6 +37,8 @@ class TypeTokenizer
'object' => true,
'empty' => true,
'callable' => true,
// will likely remove this in the near future
'stict-array' => true,
'array' => true,
'non-empty-array' => true,
'non-empty-string' => true,
Expand Down

0 comments on commit 9da26de

Please sign in to comment.