Olle
3630b4a2f9
Merge remote-tracking branch 'remotes/upstream/master'
2020-08-18 15:59:46 +00:00
Matthew Brown
72ecb57def
Improve names of things
2020-08-14 00:27:33 -04:00
Matthew Brown
6085e42fc1
Detect mismatching param names effectively
2020-08-10 09:58:43 -04:00
Brown
c0b0036109
Fix #3934 - prevent unsafe use of new static
2020-08-05 19:39:27 -04:00
Daniel Melchior
fa73c7c9d9
Fix #3757 - allow multiple mixins ( #3772 )
2020-08-05 15:49:19 -04:00
Brown
657f9db2e0
Fix bugs
2020-07-26 15:21:05 -04:00
Barney Laurance
ff432ff73d
Simplify error messages and implementation for internal errors ( #3881 )
...
* Use more consistent language for Internal errors
There's no meaningful distinction between something being internal and
being 'marked as internal'.
* Rename property psalm_internal to internal in all storage classes
This property holds metadata that can be set using either @internal
or @psalm-internal in docblocks
* Change types of internal properties in storage from ?string to string
Simpler type is easier to handle. Non-internal methods can be considered
to be internal to the entire universe of PHP code, i.e. that code whose
namespace starts with the empty string. It's not a special case.
2020-07-24 09:32:54 -04:00
Barney Laurance
3bc91b9944
Fix multiple issues with @internal and @psalm-internal ( #3841 )
...
* Add passing tests for property fetch on an @internal class
I'm trying to work out why the equivilent InvalidCodeParse test is
failing for PsalmInternal
* Treat all properties of a psalm-internal class as psalm-internal
* Remove all $internal properties from storage - use psalm_internal instead
@internal can be represented as internal to the namespace root, avoiding
the need to check for both properties in storage later.
* Raise InternalClass issue when an internal class is used with e.g. instanceOf
* fix docs and tests
* Add return type declartion to code example in doc
* Don't allow class psalm-internal to overide a tighter method psalm-internal
* Break up long line
* Code style - move && from EOL to SOL
* Restore misplaced &&
* Fix code style
* Fix namespace fetching so it works
Co-authored-by: Matthew Brown <github@muglug.com>
2020-07-22 19:27:35 -04:00
Brown
262bb9fd89
Invalidate memoized getter method results after property assignment
2020-07-16 12:59:49 -04:00
Brown
b361b44889
Rip out plain getter property logic cc @m0003r
...
It gets in the way of the other IMO more useful memoisation logic (e.g. when a getter is declared final)
2020-07-16 12:42:59 -04:00
Olle
285348efe9
New annotation: @psalm-if-this-is
2020-07-08 19:51:02 +00:00
Olle Härstedt
d8e8ce428e
Add new annotation: @psalm-self-out ( #3650 )
...
* Add new config: sealAllMethods
* Add some more tests
* Fix codesniffer issue with preg_quote
* Fix missing method in test
* New tag @self-out (WIP)
* Add self_out_type to method storage
* Add some notes
* More work on self-out (WIP)
* More work on self-out (WIP)
* Use psalm-self-out instead of self-out
* Remove extra file
* Cleanup
* Wrap around try-catch - how to check if a method has/should have storage?
* New method hasStorage()
* Fix indentation
* Fix some errors
* Fix indentation
* Cast storage type to type
* Add proper use-statement in method storage
* Correct test class name
* Allow self_out to be null
* method_id can be string (why, when?)
Co-authored-by: Olle <noemail>
2020-07-01 18:10:24 -04:00
Olle
290207dd3f
Merge remote-tracking branch 'upstream/master'
2020-06-30 17:01:56 +00:00
Olle
111f4b4f6e
Add proper use-statement in method storage
2020-06-30 15:33:14 +00:00
Brown
c29b3744ec
Change storage of out types
2020-06-24 11:51:31 -04:00
Olle
79d2e25084
Merge remote-tracking branch 'upstream/master'
2020-06-23 17:08:12 +00:00
Brown
e8be2c500e
Support taint flows in more functions
2020-06-22 17:53:03 -04:00
Brown
dc83c2e2fc
Add annotation for taint sources
2020-06-21 00:58:56 -04:00
Brown
8f2e28c36b
Improve tainting of specializable classes
2020-06-19 01:22:51 -04:00
Olle
9d284f1331
Add self_out_type to method storage
2020-06-18 21:55:43 +00:00
Matthew Brown
081a284759
Fix #3567 - remember which variables a callable sets byref in use
2020-06-14 11:58:50 -04:00
Brown
d04e21ee5a
Define mixin declaring classname
2020-05-26 23:32:07 -04:00
Matthew Brown
187b944680
Add faster taint analysis
2020-05-22 12:33:29 -04:00
Brown
2d92943625
Add support for expansion of type aliases
2020-05-15 00:15:48 -04:00
Brown
006c6e09f1
Add more details to type alias creation
2020-05-14 00:41:50 -04:00
Brown
190c9ce27e
Use TypeAlias object to allow future extension
2020-05-13 19:29:59 -04:00
Brown
0fc3398631
Move parsing methods into internal namespace
2020-05-13 19:12:45 -04:00
Brown
2af0a17d03
Fix #3236 - allow use-checking of more methods starting with __
2020-05-12 22:39:26 -04:00
Brown
28349c6423
Remove mixin_fqcln hack
2020-05-10 09:04:30 -04:00
Brown
f0487c216d
Add slash
2020-04-27 09:50:27 -04:00
Brown
95dbb93732
Fix #3237 - allow mixin to reference generic params
2020-04-27 09:10:24 -04:00
Brown
d88c31f461
Support templated @mixin
2020-04-26 16:49:52 -04:00
m0003r
77270dc9b7
Getters automagic ( #3122 )
...
* When method is a plain getter: (1) correct method return type if property type is known (2) auto assert-if-true that corresponding property is not falsy
* do not use getter automagic if getter is overridden somewhere
2020-04-12 08:40:24 -04:00
Brown
af4a7cabe9
Fix #3057 and add support for @psalm-yield annotation
2020-04-02 22:38:10 -04:00
Matthew Brown
93735712f0
Fix #3032 - always replay docblock issues when analysing files
2020-03-28 19:54:55 -04:00
Matthew Brown
de6aee32d1
Fix #3035 - improve templating for property assignments
2020-03-28 17:18:21 -04:00
Brown
61ecd2a5fe
Limit constructor check invalidation
2020-03-02 11:20:52 -05:00
Matthew Brown
653353709a
Use MethodIdentifier object instead of string
2020-02-14 20:54:26 -05:00
Brown
210d65d0d6
Add a few lowercase-string types
2020-02-13 17:52:23 -05:00
Matthew Brown
93fc1b1cc7
Fix #2729 - allow mutation of otherwise-readonly properties
2020-02-02 15:35:12 -05:00
Brown
7482b9e56f
Emit all stubs discovered by Psalm during analysis
...
Fixes #827
2020-01-08 17:23:40 -05:00
Matthew Brown
9fa2db1b6c
Move Union::getTypes to Union::getAtomicTypes
2020-01-04 12:20:26 -05:00
Matthew Brown
d5d4a1826d
Add initial support for @mixin Foo
2020-01-02 23:50:19 -05:00
Matthew Brown
44441042f0
Fix style things
2019-12-30 11:07:04 -05:00
Matthew Brown
19faa31865
Allow assertions on nested properties
2019-12-30 10:01:31 -05:00
Matthew Brown
55c2f7faa2
Fix #2508 - don’t replace templated types with generic ones inside own function
2019-12-28 18:38:02 -05:00
Matthew Brown
a4191171bf
Fix #2483 - treat intersecting PHPDocs from interfaces better
2019-12-20 01:42:57 +00:00
Brown
1f07ea7ee7
Tighten up Psalm’s inference
2019-11-25 15:20:31 -05:00
Brown
b29227aaf6
Allow taints to be removed via annotation
2019-10-15 16:25:27 -04:00
Matthew Brown
0b4981f01b
Fix #1551 - do better at inferring class constant types
2019-09-14 14:26:31 -04:00
Matthew Brown
4cac8cd70f
Don’t complain about mutating call when it was inferred during reflection
2019-09-08 10:36:57 -04:00
Matthew Brown
85ae8f93d2
Clear out property assignments when necessary
2019-09-07 18:34:18 -04:00
Brown
b7b4baff8f
Add support for @immutable
...
Fixes #1272
2019-08-30 12:36:35 -04:00
Brown
2b2988b072
Fix #2019 - allow union in @throws
2019-08-13 15:44:18 -04:00
Matthew Brown
d5b026839c
Add support for different taint types ref #1990
2019-08-12 23:16:05 -04:00
Matthew Brown
7ed30cd5b0
Add support for @readonly annotation
2019-08-11 16:01:37 -04:00
Matthew Brown
b2c0993cdc
Add framework for taint analysis to Psalm
...
Ref #611
2019-08-04 10:37:36 -04:00
Matthew Brown
76508e6d64
Improve behaviour of templated template assertions
...
Fixes #1956
2019-07-21 01:40:19 -04:00
Matthew Brown
3df248eea2
Add concept of purity to functions and methods
2019-07-18 01:31:48 -04:00
Matthew Brown
da42be175f
Apply PHPCS fixes
...
Fixes #1880
2019-07-05 16:27:53 -04:00
Matthew Brown
efe096c7ab
Fix #1897 - add support for unions in @psalm-assert annotations
2019-07-04 15:05:55 -04:00
Matthew Brown
df3d7e1d2c
Make line endings mostly all the same
2019-07-03 16:58:27 -04:00
Matthew Brown
ca53019d6b
Simplify class completion lookup
...
Ref #1822
2019-06-29 21:32:26 -04:00
LeSuisse
f29826b958
Fully qualify constants and function calls ( #1849 )
...
This should give a small performance boost.
Part of #1837 .
The change is enforced via phpcs and can be autofixed
with phpcbf.
2019-06-26 16:52:29 -04:00
Matthew Brown
31c8a2e4d7
Add offsets to type tokenisation
...
Ref #1832
2019-06-22 23:30:40 -04:00
Ilija Tovilo
78588ced16
Only add newlines to function signature on hover ( #1834 )
...
Most editors do not render the newlines for autocompletions which makes
things look worse.
2019-06-22 15:59:16 -04:00
Ilija Tovilo
caca3e52c9
Display function signature on multiple lines when it has parameters ( #1833 )
2019-06-22 13:07:56 -04:00
Brown
aa6677a177
Add autocompletion for some classes
...
Ref #1822
2019-06-21 17:10:35 -04:00
Brown
9c4599a0f0
Add better support for inheriting docblocks
2019-06-11 11:19:57 -04:00
Matthew Brown
c0a9ccb385
Fix handling of unused params in threaded mode
2019-06-09 17:02:21 -04:00
Matthew Brown
42cc201e9e
Fix #1698 - better understand inherited docblock return types
2019-06-08 09:44:22 -04:00
Brown
f309c755f8
Add ability to move classes
2019-06-05 08:50:24 -04:00
Brown
778b95d335
Add support for moving class constants
2019-06-04 11:14:49 -04:00
Matthew Brown
cc89b9254d
Add initial ideas for moving static methods
...
Ref #1595
2019-06-01 00:56:54 -04:00
Brown
a060da95bf
Allow MissingParamType alteration to be done in multithreaded mode
2019-05-31 11:55:24 -04:00
Matthew Brown
cd969c51e5
Generate missing param types from callers
...
Fixes #1707
2019-05-31 01:47:35 -04:00
Matthew Brown
790bc53bfd
Fix #1681 - interpret parent annotation properly
2019-05-25 11:51:09 -04:00
Barney Laurance
cd673538f1
psalm-internal - refactor - use snake_case not camelCase
2019-05-14 18:54:16 -04:00
Barney Laurance
ce5d307f83
psalm-internal - present fetching internal property from other namespace
2019-05-14 18:54:16 -04:00
Barney Laurance
b29e041d3c
psalm-internal - prevent call to method marked psalm-internal from other namespace
2019-05-14 18:54:16 -04:00
Barney Laurance
4415ef0dbd
psalm-internal - prevent invalid extention of class internal to other namespace
2019-05-14 18:54:16 -04:00
Brown
24dbc34bbe
Use better solution for inherited more-specific return types
2019-05-09 10:41:30 -04:00
Brown
629eeed3e6
Fix incorrect message when inheriting parent docblock
2019-05-09 10:26:06 -04:00
Brown
751253ddf0
Fix #1603 - prevent invalid covariant template classes from being passed
2019-05-06 16:38:08 -04:00
Brown
80e28d6a4a
Add support for unused method & property automated removal
2019-04-17 11:12:18 -04:00
Brown
26e2de93c7
Prepare to enable paralellised use of --find-dead-code
...
References #1548
2019-04-12 18:28:07 -04:00
Brown
783f028f70
Fix #1498 - use template types from parent function
2019-03-25 11:25:43 -04:00
Brown
b9ba24929d
Refactor storage of template names to prevent clashes
2019-03-22 15:59:10 -04:00
Matthew Brown
a0659a02f1
Fix #1418 - support templated union types
2019-03-16 11:15:25 -04:00
Matthew Brown
564da61937
Add missing return type
2019-03-01 09:24:52 -05:00
Matthew Brown
4cc93644e5
Added more descriptive type for callables
...
Ref #1408
2019-03-01 09:06:37 -05:00
Matthew Brown
317f790bde
New plugin hooks ( #1405 )
...
* Add a bunch of new hooks
* Add more integrations
* Add some broken tests
* Add more things
* Fix remaining interfaces
* Suppress proper issue
* UndefinedMethod should not stop analysis
* Add handlers for two custom method return types
2019-03-01 08:57:10 -05:00
Brown
601f303de2
Fix position of invalid param
2019-02-27 16:00:44 -05:00
Bruce Weirdan
abb1c95b94
Limited custom metadata to be (array of) scalars
...
Also moved `$custom_metadata` property to trait
2019-02-25 10:19:31 -05:00
Bruce Weirdan
19a9ff4bcf
Added custom storage metadata
2019-02-25 10:19:31 -05:00
Matthew Brown
081ba4b204
Fix #1072 - add support for @use SomeTrait<T>
2019-01-27 23:12:40 -05:00
Matthew Brown
f67bab6d52
Restrict template-extends to actual extends
2019-01-27 21:00:27 -05:00
Brown
cd0a7441d9
Add warnings for extended template param counts off
2019-01-24 17:55:03 -05:00
Brown
0d52dc4e00
Fix #1232 - allow checking of extended templated function returns
2019-01-24 15:03:13 -05:00
Matthew Brown
8bc17e47be
Fix #1227 - allow genric params in @psalm-assert
2019-01-22 23:42:54 -05:00