Brown
92239add4d
Add some backwards-incompatible changes for 4.x
2020-08-30 11:44:14 -04:00
Brown
7dba9bc50a
Add a bunch of immutable & pure annotations
2020-08-24 19:29:00 -04:00
Bruce Weirdan
1cf5153700
Test parallelization ( #4045 )
...
* Run tests in random order
Being able to run tests in any order is a pre-requisite for being able
to run them in parallel.
* Reset type coverage between tests, fix affected tests
* Reset parser and lexer between test runs and on php version change
Previously lexer was reset, but parser kept the reference to the old
one, and reference to the parser was kept by StatementsProvider. This
resulted in order-dependent tests - if the parser was first initialized
with phpVersion set to 7.4 then arrow functions worked fine, but were
failing when the parser was initially constructed with settings for 7.3
This can be demonstrated on current master by upgrading to
nikic/php-parser:4.9 and running:
```
vendor/bin/phpunit --no-coverage --filter="inferredArgArrowFunction" tests/ClosureTest.php
```
Now all tests using PHP 7.4 features must set the PHP version
accordingly.
* Marked more tests using 7.4 syntax
* Reset newline-between-annotation flag between tests
* Resolve real paths before passing them to checkPaths
When checkPaths is called from psalm.php the paths are resolved, so we
just mimicking SUT behaviour here.
* Restore newline-between-annotations in DocCommentTest
* Tweak Appveyor caches
* Tweak TravisCI caches
* Tweak CircleCI caches
* Run tests in parallel
Use `vendor/bin/paratest` instead of `vendor/bin/phpunit`
* Use default paratest runner on Windows
WrapperRunner is not supported on Windows.
* TRAVIS_TAG could be empty
* Restore appveyor conditional caching
2020-08-23 10:32:07 -04:00
Brown
67f9adb33c
Allow adding pure annotations to functions
...
Ref #4036
2020-08-23 10:28:26 -04:00
Olle
3630b4a2f9
Merge remote-tracking branch 'remotes/upstream/master'
2020-08-18 15:59:46 +00: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
Brown
cdef4ec351
Alter docblock params too
2020-08-14 16:26:55 -04: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
Matthew Brown
73321339a3
Bump nikic/php-parser
2020-08-09 16:23:43 -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
Daniel Melchior
fa73c7c9d9
Fix #3757 - allow multiple mixins ( #3772 )
2020-08-05 15:49:19 -04:00
Brown
76bd5b6278
Refactor type comparison
2020-07-21 19:40:35 -04:00
Olle
45457acdf7
Merge remote-tracking branch 'upstream/master'
2020-07-08 19:55:03 +00:00
Olle
285348efe9
New annotation: @psalm-if-this-is
2020-07-08 19:51:02 +00:00
lhchavez
ba63ccb825
Improve \Psalm\Internal\Scanner\DocblockParser::parse() ( #3736 )
...
This change avoids calling `str_replace()` on the original docblock and
instead only operates on the parsed (and modified) lines. This now makes
it so that if there are substrings of the docblock that match a tag
match, it won't get prematurely removed, therefore avoiding mangling of
the parsed docblock's description.
Fixes : #3735
2020-07-02 17:55:57 -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
Olle
1aec75292a
Allow self_out to be null
2020-06-30 16:00:33 +00: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
20cde0ca2c
New tag @self-out (WIP)
2020-06-18 20:46:49 +00:00
Andrei Petre
3497ca07b6
Extending final class is prohibited #3037 ( #3576 )
2020-06-13 00:29:59 -04:00
Brown
30907f0269
Clean up comment parsing
2020-05-28 22:14:41 -04:00
Matthew Brown
187b944680
Add faster taint analysis
2020-05-22 12:33:29 -04:00
Brown
111303d913
Add non-empty-lowercase-string type
2020-05-15 10:18:05 -04:00
Brown
006c6e09f1
Add more details to type alias creation
2020-05-14 00:41:50 -04:00
Brown
8f57d0c738
Fix #3204 - normalise function ids where possible
2020-04-20 21:38:35 -04:00
Brown
7af771a006
Fix #3132 - resolve array access in constant properly
2020-04-18 12:39:00 -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
43189b3d55
Allow types to be traversed
2020-03-14 23:54:51 -04:00
Matthew Brown
17afeae851
Fix support for bitwise or in constant expressions
2020-03-09 00:54:26 -04:00
Matthew Brown
c0c878cc9d
Don’t cache all traits
2020-03-02 22:27:54 -05:00
Matthew Brown
2e6fe993a8
Fix #2890 - phpstorm.meta.php scanner should be insensitive to method names
2020-03-01 17:11:44 -05:00
Matthew Brown
93fc1b1cc7
Fix #2729 - allow mutation of otherwise-readonly properties
2020-02-02 15:35:12 -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
baef67e0d8
Fix evaluation order of covariant template params before invariant ones
2019-11-30 01:02:23 -05:00
Brown
0bcb7863f3
Use better system for storing inferred types and assertions
2019-11-25 11:44:54 -05:00
Brown
96586f16c0
Fix phpcs issues
2019-11-11 10:11:42 -05:00
Brown
b29227aaf6
Allow taints to be removed via annotation
2019-10-15 16:25:27 -04:00
Matthew Brown
03c39cbe7c
Fix #2223 - make sure lists are handled in more places
2019-10-10 20:16:43 -04:00
Brown
f8f8b633b1
Suppress a bunch of PossiblyUndefinedArrayOffset issues
2019-10-01 15:44:43 -04:00
Brown
0ac9108814
Fix #2139 - allow comprehension of constant ternaries
2019-09-17 11:29:41 -04:00
Matthew Brown
0b4981f01b
Fix #1551 - do better at inferring class constant types
2019-09-14 14:26:31 -04:00
Brown
b7b4baff8f
Add support for @immutable
...
Fixes #1272
2019-08-30 12:36:35 -04:00
Brown
9835943294
Fix #2041 - make sure property is always set
2019-08-21 11:25:08 -04:00
Matthew Brown
2146f73782
Prepare for tracking unused suppressions
...
Ref #1444
2019-08-18 12:25:48 -04:00
Brown
2b2988b072
Fix #2019 - allow union in @throws
2019-08-13 15:44:18 -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
3df248eea2
Add concept of purity to functions and methods
2019-07-18 01:31:48 -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
62be1cc1b0
Add rest of files
2019-06-01 16:57:33 -04:00
Matthew Brown
736f01c29e
Store more accurate return type location
2019-06-01 13:02:20 -04:00
Matthew Brown
909e02d441
Move var docblocks within function
2019-06-01 12:25:57 -04:00
Ilija Tovilo
5a14e4b1cf
Progress bar ( #1709 )
...
* Revert "Revert "Implement better progress""
This reverts commit 4302596654
.
* Revert "Revert "Implement dots progress bar""
This reverts commit e41733d789
.
* Revert "Revert "Switch to VoidProgress by default""
This reverts commit 304ffeb0a3
.
* Revert "Revert "Pass success flag to progress""
This reverts commit 62a690ee4e
.
* Improve socket communication
* Use an underscore
* Add means to disable progress
* Add extra newline before progress bar
2019-05-30 10:30:41 -04:00
Matthew Brown
4302596654
Revert "Implement better progress"
...
This reverts commit 042070d0fd
.
2019-05-27 13:07:02 -04:00
Matthew Brown
304ffeb0a3
Revert "Switch to VoidProgress by default"
...
This reverts commit 63b46be361
.
2019-05-27 13:04:38 -04:00
Ilija Tovilo
63b46be361
Switch to VoidProgress by default
2019-05-26 23:18:48 -04:00
Ilija Tovilo
042070d0fd
Implement better progress
2019-05-26 23:18:48 -04:00
Barney Laurance
cd673538f1
psalm-internal - refactor - use snake_case not camelCase
2019-05-14 18:54:16 -04:00
Barney Laurance
ade7815f0c
Fix misleading docblocs
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
751253ddf0
Fix #1603 - prevent invalid covariant template classes from being passed
2019-05-06 16:38:08 -04:00
Matthew Brown
ea20a2bd04
Fix #1540 - use correct comparison for callable param types
2019-04-12 00:44:10 -04:00
Matthew Brown
01d6caf6a2
Catch negated instanceof bugs
2019-03-16 12:34:48 -04:00
Brown
815bf845dc
Improve handling of method/function return types
2019-02-27 17:06:44 -05:00
Matthew Brown
cdae79b9fe
Fix unnecessary params in Psalm codebase
2019-02-23 11:31:33 -05:00
Bruce Weirdan
8408effe57
Dropped unused uses
2019-02-17 13:17:45 -05:00
Matthew Brown
356a45a155
Improve ergonomics of PHPStorm meta parsing
2019-02-16 18:50:25 -05:00
Matthew Brown
fa362b04cb
Fix treatment of '' => '@' mapped value
2019-02-16 12:16:34 -05:00
Matthew Brown
0739d017ac
Use information from .phpstorm.meta.php files in stubs
2019-02-16 11:16:52 -05:00
Matthew Brown
17541b415f
Fix #1191 - allow Psalm to check against different versions of PHP
2019-02-07 12:25:57 -05:00
Matthew Brown
f67bab6d52
Restrict template-extends to actual extends
2019-01-27 21:00:27 -05:00
Matthew Brown
ee2b06ac43
Add initial support for @param-out
2019-01-19 13:32:43 -05:00
Brown
f108badd03
Fix #1067 - add support for @template-extends
2019-01-10 16:59:44 -05:00
Matthew Brown
e89425ad68
Inherit parameters via @inheritdoc
2018-12-21 11:01:24 -05:00
Matthew Brown
ca6149ed17
Improve treatment of templated params within function analysis
2018-12-17 23:29:27 -05:00
Matthew Brown
b32000fa05
Fix #689 - add checks for @internal annotations
2018-12-01 18:37:49 -05:00
Matthew Brown
d90cff8f10
Add support for overriding method visibility too
2018-11-25 11:11:33 -05:00
Matthew Brown
047b096227
Add better support for intersection properties and mocks
2018-11-24 18:31:08 -05:00
Brown
7df0361fb9
Remove unnecessary error log
2018-11-20 15:53:24 -05:00
Brown
ca602f8e17
Fix language server crash after editing trait method names
2018-11-20 15:51:47 -05:00
Brown
06974221df
Change DependencyFinderVisitor name to ReflectorVisitor and update docs
2018-11-13 14:09:43 -05:00
Matthew Brown
4688b25fd9
Move internal classes to own namespace
2018-11-12 11:20:59 -05:00