Skip to content

Commit

Permalink
Switch to sealed arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Nov 5, 2022
1 parent 3aafa57 commit dadd7f4
Show file tree
Hide file tree
Showing 161 changed files with 1,106 additions and 1,112 deletions.
8 changes: 4 additions & 4 deletions UPGRADING.md
@@ -1,7 +1,7 @@
# Upgrading from Psalm 4 to Psalm 5
## Changed

- [BC] All shaped arrays are now sealed by default: this brings many assertion improvements and bugfixes, see [the docs for more info](https://psalm.dev/docs/annotating_code/type_syntax/array_types/#sealed-object-like-arrays).
- [BC] Shaped arrays can now be sealed: this brings many assertion improvements and bugfixes, see [the docs for more info](https://psalm.dev/docs/annotating_code/type_syntax/array_types/#sealed-object-like-arrays).

- [BC] All atomic types, `Psalm\Type\Union`, `Psalm\CodeLocation` and storages are fully immutable, use the new setter methods or the new constructors to change properties: these setter methods will return new instances without altering the original instance.
Full immutability fixes a whole class of bugs that occurred in multithreaded mode, you can now feel free to use `--threads=$(nproc)` ;)
Expand Down 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 `array{major_version, minor_version}`
Previously it accepted PHP version as `strict-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 `array{major_version, minor_version}`
Previously it accepted PHP version as `strict-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 `array{'stdClass','SimpleXMLElement','SimpleXMLIterator'}` to `null`
from `strict-array{'stdClass','SimpleXMLElement','SimpleXMLIterator'}` to `null`

## Removed
- [BC] Property `Psalm\Codebase::$php_major_version` was removed, use
Expand Down
316 changes: 158 additions & 158 deletions dictionaries/CallMap.php

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions dictionaries/CallMap_73_delta.php
Expand Up @@ -26,23 +26,23 @@
'JsonException::getLine' => ['int'],
'JsonException::getMessage' => ['string'],
'JsonException::getPrevious' => ['?Throwable'],
'JsonException::getTrace' => ['list<array{file?:string,line?:int,function:string,class?:class-string,type?:\'::\'|\'->\',args?:array<mixed>}>'],
'JsonException::getTrace' => ['list<strict-array{file?:string,line?:int,function:string,class?:class-string,type?:\'::\'|\'->\',args?:array<mixed>}>'],
'JsonException::getTraceAsString' => ['string'],
'SplPriorityQueue::isCorrupted' => ['bool'],
'array_key_first' => ['int|string|null', 'array'=>'array'],
'array_key_last' => ['int|string|null', 'array'=>'array'],
'fpm_get_status' => ['array|false'],
'gc_status' => ['array{runs:int,collected:int,threshold:int,roots:int}'],
'gc_status' => ['strict-array{runs:int,collected:int,threshold:int,roots:int}'],
'gmp_binomial' => ['GMP|false', 'n'=>'GMP|string|int', 'k'=>'int'],
'gmp_kronecker' => ['int', 'num1'=>'GMP|string|int', 'num2'=>'GMP|string|int'],
'gmp_lcm' => ['GMP', 'num1'=>'GMP|string|int', 'num2'=>'GMP|string|int'],
'gmp_perfect_power' => ['bool', 'num'=>'GMP|string|int'],
'hrtime' => ['array{0:int,1:int}|false', 'as_number='=>'false'],
'hrtime' => ['strict-array{0:int,1:int}|false', 'as_number='=>'false'],
'hrtime\'1' => ['int|float|false', 'as_number='=>'true'],
'is_countable' => ['bool', 'value'=>'mixed'],
'net_get_interfaces' => ['array<string,array<string,mixed>>|false'],
'openssl_pkey_derive' => ['string|false', 'public_key'=>'mixed', 'private_key'=>'mixed', 'key_length='=>'?int'],
'session_set_cookie_params\'1' => ['bool', 'options'=>'array{lifetime?:?int,path?:?string,domain?:?string,secure?:?bool,httponly?:?bool,samesite?:?string}'],
'session_set_cookie_params\'1' => ['bool', 'options'=>'strict-array{lifetime?:?int,path?:?string,domain?:?string,secure?:?bool,httponly?:?bool,samesite?:?string}'],
'setcookie\'1' => ['bool', 'name'=>'string', 'value='=>'string', 'options='=>'array'],
'setrawcookie\'1' => ['bool', 'name'=>'string', 'value='=>'string', 'options='=>'array'],
'socket_wsaprotocol_info_export' => ['string|false', 'socket'=>'resource', 'process_id'=>'int'],
Expand Down

0 comments on commit dadd7f4

Please sign in to comment.