1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-11 16:59:45 +01:00
Commit Graph

117 Commits

Author SHA1 Message Date
Bruce Weirdan
6554aa05a7
Emit MixedMethodCall when calling new on object 2022-11-19 17:29:35 -04:00
Bruce Weirdan
d7561919b2
Allow new on objects
Fixes vimeo/psalm#8355
2022-11-19 16:53:07 -04:00
Bruce Weirdan
d122cef1ca Mark inferred mutation-free constructor as such
Previously Psalm treated those constructors as explicitly mutation-free,
and thus required descendant constructors to be explicitly marked too.

Fixes vimeo/psalm#8602
2022-11-10 19:55:25 -04: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
c9ff8c2c67 Prevent re-resolution of static 2022-10-17 20:31:11 +02:00
34000ca90d Fixes 2022-10-16 13:59:15 +02:00
748a74bb2c Merge remote-tracking branch 'origin/4.x' into HEAD 2022-10-16 13:41:27 +02:00
Gregory Hargreaves
41a6afda32 Add check for const with reserved word class 2022-10-07 09:44:10 +01:00
6f51b4a432
Fix tests 2022-01-31 10:28:47 +01:00
52872c05a8
Fixes 2022-01-31 10:06:32 +01:00
8d0c1c62e8
Ensure all template parameters are specified in classes, interfaces, traits 2022-01-31 10:06:31 +01:00
AndrolGenhald
2fe4fc397c Enable extensions based on composer.json instead of those loaded at runtime (fixes #5482). 2022-01-27 16:30:14 -06: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
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
rarila
97e6511fab Set number of lines before and after namespace. 2021-12-15 04:58:32 +01:00
ralila
8fb2e0f885 Handle some partials 2021-12-04 21:55:53 +01:00
ralila
fdaed941ad use return type hints instead of php doc "@return void" 2021-11-26 20:59:41 +01:00
orklah
e2bb9859e4 fix tests 2021-11-01 22:27:43 +01:00
orklah
1efe272aed stub for is_a 2021-10-12 22:12:51 +02:00
Matt Brown
d93c30d997 Fix Never test for latest PHP Parser 2021-05-03 16:59:24 -04:00
Bruce Weirdan
d57dde0d15
Allow phantom classes in instanceof expression (#5498)
Fixes vimeo/psalm#5481
2021-03-29 00:11:45 -04:00
AndrolGenhald
d4590711d6
Fix object-like array keys when combining string and automatic keys (fixes #5427). (#5428)
* Fix object-like array keys (fixes #5427).

* Fix incorrect return types for tests.

* Fix false positive list with literal int key.
2021-03-19 21:44:44 -04:00
Bruce Weirdan
04bb2b1182
Prevent invalid Traversable implementation (#5171)
* Prevent invalid Traversable implementation

Fixes vimeo/psalm#5167

* Document new issue

* CS fix
2021-02-06 22:10:05 -05:00
Barney Laurance
0cd5442c47
Enforce property type invariance (#5131)
* Implement NonInvariantChildProperty detection

See https://github.com/vimeo/psalm/issues/4184

* Delete test cases with 'parentSetsWiderTypeInConstructor'

As I understand it these are not valid test cases. They
emit NonInvariantPropertyType issues which seems correct - the property
type variation is I think a latent bug in the sample code.

* Reduce shortcode for NonInvariantPropertyType to 1+max used shortcode on master
2021-01-31 11:32:24 -05:00
Bruce Weirdan
d659957b88
Resolve class aliases when accessing properties (#5068)
* Resolve class aliases when accessing properties

* Moved Properties::getClasslikeStorage() to ClassLikes::getStorageFor()
2021-01-21 19:38:17 -05:00
Matt Brown
324e9d11c3 Fix tests 2020-11-08 11:04:39 -05:00
Matt Brown
3e9c5d3600 Add support for @return never 2020-11-04 12:30:02 -05:00
Matt Brown
6922caf9f6 Fix #4466 use better differentiation for class_exists second param 2020-11-01 13:14:17 -05:00
orklah
ead107fa9e
More return types (#4173)
* add native return types

* redundant phpdoc
2020-09-12 11:24:05 -04:00
Brown
afce2dc66f Tighten up rules around instantiation a bit more 2020-08-06 10:18:55 -04:00
Brown
c0b0036109 Fix #3934 - prevent unsafe use of new static 2020-08-05 19:39:27 -04:00
Brown
e3ff856cac Improve treatment of static in intersection 2020-03-27 19:17:44 -04:00
Brown
1bfc61d402 Allow final classes to bypass static checks 2020-03-24 18:14:10 -04:00
Brown
ec34a16291 Warn about invalid static returns 2020-03-24 18:00:20 -04:00
Matthew Brown
f128c8ffda Fix overriding of mapped property type visibility 2020-03-11 17:41:05 -04:00
Matthew Brown
1dc26afb27 Fix #2958 - prevent overriding final methods 2020-03-10 21:26:02 -04:00
Brown
2c8688dd97 Don’t crash when conditionally defining classes with properties 2020-03-09 14:24:19 -04:00
Matthew Brown
aea33824e6 Fix #1555 - allow phantom class constants 2020-02-18 19:46:05 -05:00
Brown
8989737e51 Fix #2775 - use lowercase strings in a couple more places 2020-02-13 17:44:16 -05:00
Matthew Brown
07a53f6b81 Fix #2789 - Numeric should not be a reserved class name 2020-02-11 22:34:34 -05:00
Matthew Brown
872365f444 Fix #2539 - use unaliased parent class name 2020-01-01 17:23:13 -05:00
Bruce Weirdan
33142e7637 Use unalised trait name when importing aliased trait (#2393)
Fixes vimeo/psalm#2392
Refs vimeo/psalm#2278
2019-11-29 01:21:00 -05:00
lhchavez
216f991b0c Normalize stringified type names (#2239)
This change makes stringified types more normalized. Concretely it sorts
all union types, reconciled types, and sorts the keys within object-like
types.
2019-10-17 01:14:33 -04:00
Matthew Brown
f8a2eae0e2 Fix #2186 - use expanded class name for aliased class 2019-09-30 22:15:48 -04:00
Matthew Brown
5d94e340ee Remove unused suppressions in tests 2019-08-18 15:34:32 -04:00
Brown
a4d57e5524 Fix #2018 - prevent fatal error on class_aliased class reference 2019-08-15 10:17:27 -04:00
Matthew Brown
90854c4094 Fix broken behaviour when analysing interface test methods 2019-07-28 19:44:36 -04:00
Matthew Brown
ab50c6ce2e Fix #1949 - check that aliased name doesn’t exist before transforming 2019-07-17 20:33:44 -04:00
Matthew Brown
da42be175f Apply PHPCS fixes
Fixes #1880
2019-07-05 16:27:53 -04:00