Brown
f180fb23bc
Fix #4178 - always detect missing property types
2020-09-13 16:50:50 -04:00
Bruce Weirdan
cd110c7e2f
Added @psalm-stub-override
for classlikes and methods ( #4177 )
...
Fixes vimeo/psalm#1252
2020-09-13 16:40:31 -04:00
orklah
da47588f91
replace return;
by return null;
in every non-void method, add return null;
when mising, add return types, remove redundant phpdoc ( #4176 )
2020-09-13 16:39:06 -04:00
orklah
ead107fa9e
More return types ( #4173 )
...
* add native return types
* redundant phpdoc
2020-09-12 11:24:05 -04:00
Brown
02a58f787b
Fix #4148 - add Closure to scanned classes when arrow function is seen
2020-09-07 11:11:01 -04:00
orklah
8c7423505a
add native param types ( #4137 )
...
* add native param types
* redundant phpdoc
* add more param types and adds "?" to nullable types
* remove redundant phpdoc
* add more param types and remove redundant phpdoc
* add more param types and remove redundant phpdoc
2020-09-06 19:36:47 -04:00
Matthew Brown
422271b2cf
Prevent variables named "haystack" from receiving literal strings
...
cc @staabm
2020-09-05 00:35:48 -04:00
Brown
4d82d3ddad
Fix #4128 - improve understanding of preg_match_all
2020-09-04 18:10:14 -04:00
orklah
f66d57f19d
add native return types ( #4116 )
...
* add native return types
* remove redundant phpdoc
2020-09-04 16:26:33 -04:00
orklah
73f6fcde48
Short list syntax ( #4102 )
...
* Short list syntax
* revert unrelated CS
2020-09-02 00:17:41 -04:00
Brown
548ac1129c
Fix crash with @var
over echo
2020-09-01 00:12:12 -04:00
Brown
99d6af0f9a
Support static return type
2020-08-30 13:32:42 -04:00
Brown
f34e54ec41
Support PHP 8 union types
2020-08-30 13:16:37 -04:00
Brown
92239add4d
Add some backwards-incompatible changes for 4.x
2020-08-30 11:44:14 -04:00
Brown
988e17f11d
Make clause fully immutable
2020-08-26 15:35:29 -04:00
Brown
ba1ff21af4
Add a couple more pure annotations
2020-08-23 18:53:34 -04:00
Olle
3630b4a2f9
Merge remote-tracking branch 'remotes/upstream/master'
2020-08-18 15:59:46 +00:00
Brown
1468a28273
Fix #3999 - allow @psalm-type to reference imported type right above
2020-08-18 09:34:07 -04:00
Bruce Weirdan
7adc25c421
Improve import errors ( #3997 )
...
* Better errors for invalid type imports
Fixes vimeo/psalm#3885
* Finishing touches
Docs, schema, CS
* Drop unused import
* Drop more unused imports
2020-08-16 22:53:53 -04:00
Matthew Brown
ec2178d14a
Fix #3927 - prevent crash with bad type ref
2020-08-16 12:43:46 -04:00
Matthew Brown
8731b10bc6
Use older method
2020-08-15 10:31:24 -04:00
Brown
cdef4ec351
Alter docblock params too
2020-08-14 16:26:55 -04:00
Brown
dbcf154036
Add fixer for mismatching param names
2020-08-14 15:25:21 -04:00
Matthew Brown
72ecb57def
Improve names of things
2020-08-14 00:27:33 -04:00
Brown
209d17c868
Fix #2891 - treat autoloaded constants better
2020-08-13 09:14:27 -04:00
Brown
42c3a703b5
Fix #3741 - detect scalar class constants in if-true assertions
2020-08-12 17:03:41 -04:00
m0003r
e81593f359
Localize types on magic properties ( #3971 )
...
* Fix #3949 - localize types on magic properties
* fix failing tests
* fix code style
Co-authored-by: m03r <m03r@m03r.net>
2020-08-10 12:45:21 -04:00
Matthew Brown
6085e42fc1
Detect mismatching param names effectively
2020-08-10 09:58:43 -04:00
Matthew Brown
50cc3a8afa
Align paramter names
2020-08-09 23:19:59 -04:00
Brown
bcf0df4170
Fix a bug with lowercase-string unions
2020-08-05 20:05:57 -04:00
Brown
488a899823
Fix Psalm issues
2020-08-05 19:49:09 -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
20a9b103ec
Restrict narrowing fix
2020-08-03 02:20:58 -04:00
Brown
6919e88423
Add performance logging under a --debug-performance flag
2020-07-30 15:30:19 -04:00
Brown
7367e8e6c2
Allow assertions of non-empty lists on typed lists
...
Fixes #3906
2020-07-29 18:10:43 -04:00
Brown
8c5e4edab0
Fix extra test
2020-07-26 15:50:07 -04:00
Brown
657f9db2e0
Fix bugs
2020-07-26 15:21:05 -04:00
Brown
23f5d66516
Fix #3897 - support aliasing final methods
2020-07-26 14:46:52 -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
76bd5b6278
Refactor type comparison
2020-07-21 19:40:35 -04:00
Brown
5392ae0b39
Fix UnusedMethodCall examples
2020-07-16 18:14:15 -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
Barney Laurance
3f8aa64ee9
Treat methods of internal or psalm internal classes as internal ( #3698 )
...
When both the method and the class are annotated as psalm-internal,
but to different namespaces, we consider the method internal to
whichever namespace is longer, i.e. the smaller code module.
Issue reported at https://github.com/vimeo/psalm/issues/3457
2020-06-28 13:15:54 -04:00
Brown
de85e7c539
Fix blips
2020-06-24 13:19:14 -04: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
Olle
fffbccdacb
More work on self-out (WIP)
2020-06-21 22:18:14 +00: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
Olle
20cde0ca2c
New tag @self-out (WIP)
2020-06-18 20:46:49 +00:00
Matthew Brown
081a284759
Fix #3567 - remember which variables a callable sets byref in use
2020-06-14 11:58:50 -04:00
Andrei Petre
3497ca07b6
Extending final class is prohibited #3037 ( #3576 )
2020-06-13 00:29:59 -04:00
Brown
a6c0991073
Fix #3532 - expand type alias types recursively
2020-06-07 12:01:04 -04:00
Brown
4d149de764
Fix #3506 - prevent black classes in throws check
2020-06-01 14:56:27 -04:00
Brown
30907f0269
Clean up comment parsing
2020-05-28 22:14:41 -04:00
Brown
b9ea115487
Support string class_alias calls with leading backslash
...
Fixes #3465
2020-05-27 08:14:47 -04:00
Brown
d04e21ee5a
Define mixin declaring classname
2020-05-26 23:32:07 -04:00
Brown
b4855b3ecd
Catch errors during yield annotation tokenisation
...
Fixes #3430
2020-05-26 17:57:55 -04:00
Brown
118b700436
Simplify sink mapping for internal calls
2020-05-25 13:10:06 -04:00
Brown
240b2f898c
Add some negative test cases for @mixin
...
Also fix #3452
2020-05-25 00:19:52 -04:00
Matthew Brown
15e753e279
Fix #3443 - add InvalidDocblock issue for @psalm-assert Foo|!Bar
2020-05-23 22:52:21 -04:00
Brown
dc73e25157
Detect taints in include calls
2020-05-22 23:53:37 -04:00
Brown
1b84fc2c12
Fix #3419 - don’t add null to return type when template/conditional return is used
2020-05-22 12:44:19 -04:00
Matthew Brown
187b944680
Add faster taint analysis
2020-05-22 12:33:29 -04:00
Brown
0b2da18f1e
Break up StatementsAnalyzer
2020-05-19 12:56:30 -04:00
Brown
5ee1487a01
Make ExpressionAnalyzer more beautiful
2020-05-18 15:13:27 -04:00
Brown
013467dc0e
Add reference to ensure proper hydration
2020-05-15 00:31:55 -04:00
Brown
2d92943625
Add support for expansion of type aliases
2020-05-15 00:15:48 -04:00
Brown
48504aa88c
Pass through typa aliases where appropriate
2020-05-14 00:48:58 -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
28349c6423
Remove mixin_fqcln hack
2020-05-10 09:04:30 -04:00
Brown
65b4263315
Fix #3320 - add final flag to pseudo methods where appropriate
2020-05-08 07:28:12 -04:00
Brown
4295f9525f
Fix #3313 - add check for very specific pattern
2020-05-07 12:30:15 -04:00
Matthew Brown
dc64d4b1ca
Support evaluation of boolean conditionals in scanning stage
...
Fixes #3290
2020-05-03 10:44:00 -04:00
Matthew Brown
23b0a18632
Fix property type
2020-05-03 10:22:52 -04:00
Matthew Brown
b69c37acdf
Simplify logic around evaluating expressions a little
2020-05-03 10:19:15 -04:00
feek
c5319fc379
fix: mixin parameter of self should be properly resolved ( #3280 )
...
Co-authored-by: Matthew Brown <github@muglug.com>
2020-05-02 14:32:43 -04:00
Brown
07e5250292
Fix #3273 - add support for func_num_args() in conditional type
2020-05-01 16:02:53 -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
Brown
6b42efed3f
Fix #3150 - only inherit docblock return when same type is returned
2020-04-20 09:22:58 -04:00
Brown
7af771a006
Fix #3132 - resolve array access in constant properly
2020-04-18 12:39:00 -04:00
Brown
61f5a06a7b
Fix #3174 - always scan @mixin classes
2020-04-18 11:57:25 -04:00
Brown
5ef82b53f6
Fix #3137 - support nested templates in class definitions
2020-04-17 01:16:15 -04:00
Brown
1309eece2e
At the very least interpret nested templates as templates
2020-04-17 00:56:11 -04:00
Brown
c733d6d373
Only perform assertions where the property type is known
...
cc @m0003r
2020-04-12 12:56:33 -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
1bf1a6e46b
Accept partial match of template type
2020-04-04 17:14:33 -04:00
Brown
4aae4fc631
Add slash
2020-04-04 11:16:26 -04:00
Brown
b73b75f1a1
Allow newlines in shortcut version of return type provider
2020-04-04 11:04:00 -04:00
Brown
989269a6f6
Ignore issue
2020-04-04 09:39:39 -04:00
Brown
56cc5fb611
Allow shortcut for specifying conditional template types
2020-04-04 09:31:12 -04:00
Brown
af4a7cabe9
Fix #3057 and add support for @psalm-yield annotation
2020-04-02 22:38:10 -04:00
Brown
72104a52ad
Improve file invalidation when using --diff mode
2020-04-02 17:18:04 -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
iggyvolz
94b246b987
Initial commit ( #3013 )
2020-03-24 18:32:57 -04:00
Matthew Brown
43189b3d55
Allow types to be traversed
2020-03-14 23:54:51 -04:00