1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00
Commit Graph

66 Commits

Author SHA1 Message Date
Bruce Weirdan
85d4acf3b3
Fix crash when int range boundary is overflown
Fixes vimeo/psalm#9114
2023-02-09 22:57:57 -04:00
Ezequiel
423b1acbd6 Add tests for the remaining int-range aliases 2023-01-13 11:15:24 -03:00
Theodore Brown
0f4db694df Allow conditions inside loops to preserve or narrow int range
Fixes #7555, fixes #8020, fixes #8865
2022-12-18 17:35:14 -06:00
Jack Worman
1c19260cdd Require trailing commas 2022-12-18 13:20:31 -06:00
Jack Worman
643542346b Add codesniffer rules and expand php-cs-fixer to bin and test 2022-12-14 13:29:09 -06:00
cca276768e
List refactoring v5 (#8820)
* Squash

* Remove BC break

* Suppress

* Possibly fix

* Fixes

* Fix test

* Trigger build

* Update psl

* Update psl

* Fixes

* Fixes

* Cleanup

* fix

* Fix build

* Do not consider never when getting the max count

* Add assertion

* Cleanup

* Fix

* Cleanup
2022-12-13 21:40:19 +01:00
1986c8b4a8
Add support for strict arrays, fix type alias intersection, fix array_is_list assertion on non-lists (#8395)
* Immutable CodeLocation

* Remove excess clones

* Remove external clones

* Remove leftover clones

* Fix final clone issue

* Immutable storages

* Refactoring

* Fixes

* Fixes

* Fix

* Fix

* Fixes

* Simplify

* Fixes

* Fix

* Fixes

* Update

* Fix

* Cache global types

* Fix

* Update

* Update

* Fixes

* Fixes

* Refactor

* Fixes

* Fix

* Fix

* More caching

* Fix

* Fix

* Update

* Update

* Fix

* Fixes

* Update

* Refactor

* Update

* Fixes

* Break one more test

* Fix

* FIx

* Fix

* Fix

* Fix

* Fix

* Improve performance and readability

* Equivalent logic

* Fixes

* Revert

* Revert "Revert"

This reverts commit f9175100c8452c80559234200663fd4c4f4dd889.

* Fix

* Fix reference bug

* Make default TypeVisitor immutable

* Bugfix

* Remove clones

* Partial refactoring

* Refactoring

* Fixes

* Fix

* Fixes

* Fixes

* cs-fix

* Fix final bugs

* Add test

* Misc fixes

* Update

* Fixes

* Experiment with removing different property

* revert "Experiment with removing different property"

This reverts commit ac1156e077fc4ea633530d51096d27b6e88bfdf9.

* Uniform naming

* Uniform naming

* Hack hotfix

* Clean up $_FILES ref #8621

* Undo hack, try fixing properly

* Helper method

* Remove redundant call

* Partially fix bugs

* Cleanup

* Change defaults

* Fix bug

* Fix (?, hope this doesn't break anything else)

* cs-fix

* Review fixes

* Bugfix

* Bugfix

* Improve logic

* Add support for list{} and callable-list{} types, properly implement array_is_list assertions (fixes #8389)

* Default to sealed arrays

* Fix array_merge bug

* Fixes

* Fix

* Sealed type checks

* Properly infer properties-of and get_object_vars on final classes

* Fix array_map zipping

* Fix tests

* Fixes

* Fixes

* Fix more stuff

* Recursively resolve type aliases

* Fix typo

* Fixes

* Fix array_is_list assertion on keyed array

* Add BC docs

* Fixes

* fix

* Update

* Update

* Update

* Update

* Seal arrays with count assertions

* Fix #8528

* Fix

* Update

* Improve sealed array foreach logic

* get_object_vars on template properties

* Fix sealed array assertion reconciler logic

* Improved reconciler

* Add tests

* Single source of truth for test types

* Fix tests

* Fixup tests

* Fixup tests

* Fixup tests

* Update

* Fix tests

* Fix tests

* Final fixes

* Fixes

* Use list syntax only when needed

* Fix tests

* Cs-fix

* Update docs

* Update docs

* Update docs

* Update docs

* Update docs

* Document missing types

* Update docs

* Improve class-string-map docs

* Update

* Update

* I love working on psalm :)

* Keep arrays unsealed by default

* Fixup tests

* Fix syntax mistake

* cs-fix

* Fix typo

* Re-import missing types

* Keep strict types only in return types

* argc/argv fixes

* argc/argv fixes

* Fix test

* Comment-out valinor code, pinging @romm pls merge https://github.com/CuyZ/Valinor/pull/246 so we can add valinor to the psalm docs :)
2022-11-05 22:34:42 +01:00
748a74bb2c Merge remote-tracking branch 'origin/4.x' into HEAD 2022-10-16 13:41:27 +02:00
kkmuffme
1a10654cb3 fix tests 2022-09-08 13:28:43 +02:00
AndrolGenhald
285740a753 Merge branch '4.x' 2022-07-07 15:01:38 -05:00
AndrolGenhald
2f090e5722 Fix TypeCombiner::combine to not modify TIntRange arguments.
This keeps coming up in obscure places, hopefully this fixes it once and for all. I would reeeaaally love to have an immutable type system at some point...
2022-06-02 12:36:41 -05:00
Matt Brown
fccc366c1e Merge pull request #7887 from ging-dev/lsp-fixes
improve LSP
2022-04-27 10:13:17 -04:00
Matt Brown
a9e3c1fdc1 Fix namespaced min/max int range keyword issue introduced in #7775. 2022-04-27 01:44:57 -04:00
Matt Brown
d0524c2418 Forbid min bound greater than max bound in int range 2022-04-27 01:38:21 -04:00
AndrolGenhald
0bdf9425e3 Fix namespaced min/max int range keyword issue introduced in #7775. 2022-03-30 16:08:14 -05:00
Semyon
9beb0a62b2 Forbid min bound greater than max bound in int range 2022-03-11 17:26:59 +03:00
Semyon
a7e98f4bfc Forbid any non literal int in int range (except min and max named objects) 2022-03-11 17:26:07 +03:00
AndrolGenhald
9310a4ff5a Fix issues with int range unpacking and with min/max. 2022-02-18 15:55:26 -06:00
Matthew Brown
457abc6e13 Don’t subtract int from array-key if not equality 2022-02-08 11:24:05 -05:00
orklah
3b73654db7 handle literal inequality with ints 2022-01-28 21:59:30 +01:00
orklah
204d09b271 fix error with 0 being considered positive 2022-01-25 21:54:55 +01:00
orklah
a7b72b865f remove TPositiveInt usage for TIntRange 2022-01-23 22:04:18 +01:00
orklah
0e891f25ad refactor description of types in Atomic 2022-01-22 19:34:57 +01:00
Matthew Brown
0a81f8cd6c
Use objects, not strings, for assertions (#7410)
* Use objects, not strings, for assertions

* Remove unnecessary param

* Remove some unnecessary checks

* Fix bad find/replace

* Add note about assertions no longer stored as strings in UPGRADING.md
2022-01-20 17:33:06 -05:00
orklah
cb976f8416 fix merge induced errors 2022-01-18 23:07:35 +01:00
orklah
477c0113c2 Merge remote-tracking branch 'upstream/4.x' into upstream-master3 2022-01-18 18:37:04 +01:00
orklah
0beb8e7a4e fix test 2022-01-15 21:39:29 +01:00
orklah
4344c8ec3f add test 2022-01-15 21:29:24 +01:00
orklah
b633619a2c Merge remote-tracking branch 'upstream/4.x' into upstream-master 2022-01-14 21:01:25 +01:00
orklah
93fe3e81d4
Merge pull request #7304 from orklah/classconst5
Refactor Reconciler::handleLiteralEquality
2022-01-14 19:16:23 +01:00
Matthew Brown
b49682a485 Simplify issue suppression in tests 2022-01-13 14:38:17 -05:00
Matthew Brown
f439d6550b
Ensure that all entries in test arrays have explicit keys (#7386)
* Transformation that updates assertions

* Simplify transformation

* Ensure that all tests have keys

* Fix a few remaining keys
2022-01-13 13:49:37 -05:00
Bruce Weirdan
1a1b5a9e6a
Merge branch '4.x' into upstream-master 2022-01-08 23:38:29 +02:00
orklah
af28687708 fix reconciliation when the assertions is not part of the existing range and add tests 2022-01-07 19:39:19 +01:00
orklah
6296a60553 add new test that was failing before 2022-01-07 18:18:47 +01:00
orklah
0747b48d06
remove TEmpty 2022-01-03 04:09:59 +02:00
orklah
d4fcb7f61c handle literal equality with integer ranges 2021-12-26 21:09:27 +01:00
rarila
97e6511fab Set number of lines before and after namespace. 2021-12-15 04:58:32 +01:00
orklah
be9037f7b1 fix reconciliation between positive-int and inferior/superior assertions 2021-12-08 21:38:12 +01:00
ralila
8fb2e0f885 Handle some partials 2021-12-04 21:55:53 +01:00
orklah
c38139a87c Don't crash on falsy with int ranges 2021-10-24 13:59:21 +02:00
orklah
b9f14f8687 improve min/max inference, add a return type provider for rand, mt_rand and random_int 2021-10-02 09:53:58 +02:00
orklah
cc6ab8340b improve type when min = max and add test 2021-09-23 21:24:16 +02:00
orklah
f87bd56105 fix Pow 2021-09-19 19:30:03 +02:00
orklah
3d7dc740c2 fix UnaryMinus 2021-09-19 19:30:03 +02:00
orklah
a6630c49a2 fix mod calculation with ranges 2021-09-19 19:30:02 +02:00
orklah
c226285a4b fix Mul and Pow operations 2021-09-19 19:30:02 +02:00
orklah
a8a659895f add failing test 2021-09-19 19:30:02 +02:00
orklah
f789ab0655 add test and allow checking in already inferred types instead of just relying on statements from PHPParser for assertions 2021-09-19 19:30:02 +02:00
orklah
ae0586b0e6 fix shift inference 2021-09-19 19:30:02 +02:00