1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 09:37:59 +01:00
Commit Graph

222 Commits

Author SHA1 Message Date
Stefan Vetsch
5331091f5e Simplify argv handling, the first element is always the script name 2021-12-24 10:05:52 +01:00
Stefan Vetsch
ecc7400530 Add CliUtilsTest with test cases for old behaviour 2021-12-24 09:54:37 +01:00
rarila
97e6511fab Set number of lines before and after namespace. 2021-12-15 04:58:32 +01:00
rarila
7df7c1f070 Format declare(strict_types=1) 2021-12-15 04:42:37 +01:00
rarila
39402c233d
Return type hints (#7065)
Co-authored-by: ralila <>
2021-12-05 19:51:26 +02:00
ralila
f833085a15 Fix fqn usage in php-doc 2021-12-04 03:37:19 +01:00
ralila
d5d277f579 Set further phpcs fqn options 2021-12-03 22:44:41 +01:00
ralila
30a65685a2 Import instead of using fqn classes 2021-12-03 21:40:18 +01:00
ralila
245920e53c Import instead of using fqn 2021-12-03 20:11:20 +01:00
Maximilian Bösing
62b0a09741
qa: remove useless var annotation and the psalm suppression
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2021-11-15 19:06:33 +01:00
Maximilian Bösing
665cea7fbf
bugfix: prevent psalm from yelling about docblock type contradiction
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2021-11-15 18:36:04 +01:00
Maximilian Bösing
a2bf87b1fc
qa: ensure psalm is able to understand already verified types
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2021-11-15 18:31:28 +01:00
Maximilian Bösing
68abcaab5c
feature: extract class constant by wildcard detection into dedicated resolver
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2021-11-15 18:27:19 +01:00
orklah
c74e81ca8f fix build 2021-09-23 19:29:15 +02:00
Maximilian Bösing
d4559f5ba3
qa: add failing test regarding recursive alias resolving
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2021-08-18 16:18:44 +02:00
Maximilian Bösing
990723ce64
qa: rework unit test to use already available project_initializer
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2021-08-17 21:46:00 +02:00
Maximilian Bösing
7ab5d29e08
qa: add unit test to verify aliased interface is properly detected
Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
2021-08-17 18:40:18 +02:00
Bruce Weirdan
8c531fec4b
Tweaks
Changed the format of the historical callmap to be plain signature list,
as it isn't really a delta file and renamed the file to not be confused
with deltas.

Added a test to ensure entries in main callmap have history.
2021-08-08 18:43:42 +03:00
bjscharp
96056d329f Add simple test to verify outout of getCallMap method
Convert deltafile format to new style proposed by weirdan
Modify CallMapTest to use new format
Modify InternalCallMapHandler to use new format
Move assertions to base testcase
2021-08-08 10:39:54 +02:00
bjscharp
d1d9e3763c Removed unused test dependencies 2021-08-06 07:45:17 +02:00
bjscharp
a01b92de8a Split duplicate add/remove check off into seperate tests to deal with several extra error paths 2021-08-06 07:33:37 +02:00
bjscharp
f39c462138 Add missing bcadd function to 8.0 delta file.
To prevent similar errors, add baseline file with signatures pre-7.1, to help verify delta files are correct.
Modify test to use this to detect missing 'old' entries
2021-08-05 23:21:41 +02:00
bjscharp
ac5ea252ff Added test to detect problems and inconsistencies in CallMap files
- Fixed inconsistencies in callmap delta files (mainly 8.0)
- Added several missing changes in the bc_* functions
- Added several missing changes in the mb_* functions
- Added several missing changes in the xml_parser_* functions
- Fixed several issues with sodium_ functions
- Removed all but one of the date_* functions. All were marked as having lost the option to return false, despite this only being true for date_format
2021-08-05 19:07:31 +02:00
Bruce Weirdan
76be96ce53
Drop FakeFileProvider from tests folder
And use Psalm\Internal\Provider\FakeFileProvider
2021-07-02 03:57:57 +03:00
Bruce Weirdan
248a07fd35
Ship FakeFileProvider even with dist dev releases
Refs psalm/psalm.dev#60
2021-07-02 00:26:20 +03:00
Matt Brown
23b7ff86b7 Mark interface methods as unused even when inherited 2021-06-12 16:13:29 -04:00
Matthew Brown
6d09418a23
Detect unused return values (#5917)
* Detect unused return values

* Allow static-returning instance methods (presumed to be fluent)

* Make $is_used the default for Codebase::methodExists
2021-06-10 14:18:15 -04:00
Bruce Weirdan
6abce3525a
Enforce use sort (#5900) 2021-06-07 22:55:21 -04:00
Matt Brown
6a61298074 Fix #5810 - detect properties that are never read 2021-05-21 09:25:57 -04:00
Matt Brown
03665b9646 Revert "Correct Psalm’s concept of string emptiness"
This reverts commit 331ce8ead4.

It was too hasty
2021-02-03 01:09:58 -05:00
Matt Brown
331ce8ead4 Correct Psalm’s concept of string emptiness
It contrasted with PHP’s idea
2021-02-02 23:07:51 -05:00
Joe Hoyle
ba43e6d0f3
Remove file map cache when re-analyzing files (#5084)
* Remove file map cache when re-analyzing files

When the project is re-analyzed under the single thread condition (not using a process pool), the filemaps are not cleared before re-analyzing files. This means that file maps only get appended to. If you delete the contents of a file via the LSP, the file map will still be populated with all the old values for example.

In doing this I had to write a few more tests to check my assumptions too, so adding those additional tests.

* Rename test

* Formatting

* Formatting again!
2021-01-22 16:05:28 -05:00
orklah
09fb141e49
Document lowercase-string when possible (#4904)
* document lowercase-string

* fix missing strtolower
2020-12-29 11:42:12 +00:00
Matt Brown
667220408c Fix #4464 - bust cache when Psalm’s version changes, not just composer’s 2020-11-01 09:01:53 -05:00
orklah
ceaaa39ec3
improve phpdoc (#4352) 2020-10-17 12:36:44 -04:00
orklah
10f2966dcb
return types (#4311)
* return types

* remove willReturn for void methods
2020-10-12 15:02:52 -04:00
orklah
37a2f8a33d
unused use statements (#4228) 2020-09-22 01:10:46 -04:00
Brown
79f4e9c354 Do no writing when saving parser cache in tests 2020-09-14 09:56:39 -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
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
orklah
f66d57f19d
add native return types (#4116)
* add native return types

* remove redundant phpdoc
2020-09-04 16:26:33 -04:00
Matthew Brown
50cc3a8afa Align paramter names 2020-08-09 23:19:59 -04:00
Brown
d578c44a37 Add more mocking to tests 2020-06-06 16:57:25 -04:00
Matthew Brown
45e831252f
Remove property 2020-06-06 12:23:29 -04:00
Matthew Brown
05962fd51c
Update FakeFileReferenceCacheProvider.php 2020-06-06 12:11:33 -04:00
Matthew Brown
a1fd68975f
Use getinstance shortcut 2020-06-06 12:06:31 -04:00
Brown
831482951a Fix things 2020-06-06 11:23:05 -04:00
Brown
438eb17e58 Fix #3367 - ensure --diff works after second run, not third 2020-06-05 12:09:38 -04:00
Brown
111303d913 Add non-empty-lowercase-string type 2020-05-15 10:18:05 -04:00
Brown
110df3e4f1 Fix ProjectAnalyzer test 2020-04-12 12:02:19 -04:00
Brown
370ffa28e4 Fix #3117 - invalidate all caches when composer lockfile changes 2020-04-12 11:41:37 -04:00
Brown
72104a52ad Improve file invalidation when using --diff mode 2020-04-02 17:18:04 -04:00
Brown
971ae50bea Do prep work for #3024 - improve handling of absent class references 2020-03-26 12:35:27 -04:00
Matthew Brown
68c95c622a Save information about last runs whether or not there were errors 2020-03-26 00:46:39 -04:00
Brown
23fcbec584 Add a few more list types 2019-10-08 19:06:16 -04:00
Matthew Brown
c5f62d261d Remove redundant @psalm-suppress in Psalm’s codebsae 2019-08-18 16:10:12 -04:00
Matthew Brown
da42be175f Apply PHPCS fixes
Fixes #1880
2019-07-05 16:27:53 -04:00
Ilija Tovilo
67c3726254 Implement signature help - closes #1841 (#1862)
* Implement signature help - closes #1841

* Add explicit signature count

* [LSP] Do analysis for every signatureHelp request

See here: https://github.com/vimeo/psalm/pull/1862#issuecomment-507007346

* Don’t language server information when checking property for init

* Fix signature help for functions

* Add try-catch around signature help Functions::getStorage()
2019-07-01 15:54:32 -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
Brown
aa6677a177 Add autocompletion for some classes
Ref #1822
2019-06-21 17:10:35 -04:00
Brown
b6e9fba8e6 Track method param uses between diff runs 2019-04-29 17:29:38 -04:00
Matthew Brown
b4f24d1fa6 Fix a couple of tests, and track file references to classes 2019-04-28 12:59:36 -04:00
Matthew Brown
e08944cae0 Allow diff mode with --find-dead-code 2019-04-27 17:38:24 -04:00
Brown
ff14f671b1 Add hopefully-more-portable method for evaluating method/property usage 2019-04-16 16:07:48 -04:00
Brown
26e2de93c7 Prepare to enable paralellised use of --find-dead-code
References #1548
2019-04-12 18:28:07 -04:00
Matthew Brown
c772914910 Add some formatting 2019-03-23 14:27:54 -04: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
c43734f3ab Don’t localise PropertyNotSetInConstructor issues 2019-01-15 21:34:18 -05:00
Brown
110ca66692 Namespace test providers under Internal cc @TysonAndre 2018-11-12 11:20:59 -05:00