1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-15 19:07:00 +01:00
Commit Graph

70 Commits

Author SHA1 Message Date
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
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 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
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
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
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
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