`mb_strtolower()` may return characters we generally consider uppercase
when it's given the encoding argument. This PR makes Psalm to err on the
side of caution and treat the return type as `string` rather than
`lowercase-string` in this case
Refs vimeo/psalm#6908
- Fixed inconsistencies in callmap delta files (mainly 8.0)
- Added several missing changes in the bc_* functions
- Added several missing changes in the mb_* functions
- Added several missing changes in the xml_parser_* functions
- Fixed several issues with sodium_ functions
- Removed all but one of the date_* functions. All were marked as having lost the option to return false, despite this only being true for date_format
* ConcatAnalyzer improvements.
Deduplicate code.
Improve type inference.
Allow literal type inference when only one side has multiple types (fixes#5483).
Fix invalid type inference with negative int as right operand.
* Fix inference to be lowercase-string when concatenating int.
* Fix TNonEmptyLowercaseString to not be subtype of TNonFalsyString.
'0' is a non-empty-lowercase-string that is falsy.
* Fix other issues with non-falsy-string.
* Nest ands and ors
Co-authored-by: Matthew Brown <github@muglug.com>
* #4997 added more precise stub for `count()` returning `0` or `positive-int` on known types
* #4997 updated `count()` to support `\SimpleXmlElement` and `\ResourceBundle` counting, as well as handling hardcoded 2-element-arrays cases
This patch:
* adds support for `count(\SimpleXmlElement)` (https://www.php.net/manual/en/simplexmlelement.count.php)
* adds support for `count(\ResourceBundle)` (https://www.php.net/manual/en/resourcebundle.count.php)
* removes usage of global constants from stub (not supported - see https://www.php.net/manual/en/function.count.php)
* adds support for identifying fixed-element-count arrays, for example `count(callable&array)`, which is always `2`
* #4997 adapted `FunctionCallReturnTypeFetcher` to infer `TPositiveInt` for `count(TNonEmptyArray)` and `count(TNonEmptyList)`
* The `FunctionCallReturnTypeFetcher` is responsible for defining the precise type of a `\count(T)`
expression when given a `T`, so we baked the whole type resolution for `positive-int`, `0` and
`positive-int|0` directly in there.
While this complicates things, it is also true that it is not possible right now (for the stubs)
to provide the level of detail around `count()` that is required by the type inference system
for such a complex function with so many different semantics.