1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 12:55:26 +01:00
Commit Graph

8103 Commits

Author SHA1 Message Date
Matt Brown
ccdb29abfa Improve handling of property-mutating calls 2021-02-10 12:09:21 -05:00
Matt Brown
2dc86651a4 Check context var exists 2021-02-09 14:13:24 -05:00
orklah
88fe805c27
Prevent throwing a division by zero when encountering a literal division by zero (#5182) 2021-02-09 11:48:59 -05:00
Matt Brown
c7b7da46e9 Add slashes 2021-02-09 11:48:24 -05:00
Matt Brown
61478bb003 Use generics to allow property subclassing
cc @bdsl
2021-02-09 11:40:52 -05:00
Matt Brown
8aaa489733 Make more operations generic-safe 2021-02-09 11:37:48 -05:00
Matt Brown
b9dac8c46c Add slashes 2021-02-09 10:57:19 -05:00
Matt Brown
a955dabfe5 Account for context var not existing 2021-02-09 10:46:33 -05:00
Matt Brown
2b9d307cab Fix #5184 - remove this vars from parent context where possible 2021-02-09 10:23:22 -05:00
Matt Brown
03b54e369b Fix test 2021-02-09 01:37:56 -05:00
Matt Brown
ecfc4726d7 Limit removal of vars further 2021-02-09 00:53:09 -05:00
Matt Brown
ad0b575080 Better fix for #5180 2021-02-08 23:31:49 -05:00
Matt Brown
9b8fdf154d Revert "Allow refinement of $this properties based on subclass"
This reverts commit 1d5d2403e2.
2021-02-08 22:50:50 -05:00
Matt Brown
1d5d2403e2 Allow refinement of $this properties based on subclass
Fixes #5180
2021-02-08 22:46:32 -05:00
Matt Brown
2b2d1c1060 Add null check 2021-02-08 09:44:46 -05:00
Barney Laurance
509aadc08a
Remove all (but one) properity declarations that needed NonInvariantDocblockPropertyType suppressed (#5174)
The remaining property
\Psalm\Internal\Analyzer\NamespaceAnalyzer::$source seems a bit harder
to fix
2021-02-08 09:36:42 -05:00
Matt Brown
876a772edc Fix #5176 - substitute in actual argument when instance type found 2021-02-08 09:29:41 -05:00
Matt Brown
3be1bb7342 Limited fix for #5028 2021-02-07 22:56:37 -05:00
Bruce Weirdan
e3d73a3166
Allow suppressing thrown interfaces and their descendants (#5178)
Fixes vimeo/psalm#5177
2021-02-07 21:08:29 -05:00
Matt Brown
3bf7a73c61 Simplify TypeExpander::expandAtomic 2021-02-07 13:14:26 -05:00
Matt Brown
649d1f6ad6 Don’t recursively expand generic types 2021-02-07 11:31:42 -05:00
Matt Brown
8b5e0fc754 Fix #5172 - prevent calling function with implicitly-broader type 2021-02-07 11:07:22 -05:00
Matt Brown
5e2d252edb Fix invariance checks 2021-02-07 01:58:03 -05:00
Matt Brown
4d76f7545c Allow property type invariance on templated properties
This is a bit of a hack – the comparison should be similar to the ones done in MethodComparator, but this avoids false-positives for now
2021-02-07 01:45:48 -05:00
Matt Brown
049b2c3f7a Prevent check triggering for commonly-extended classes 2021-02-07 01:24:08 -05:00
Matt Brown
f2d202e2bb Add less severe issue for docblock property type invariance cc @bdsl
This is less likely to break everything
2021-02-07 00:52:29 -05:00
Bruce Weirdan
04bb2b1182
Prevent invalid Traversable implementation (#5171)
* Prevent invalid Traversable implementation

Fixes vimeo/psalm#5167

* Document new issue

* CS fix
2021-02-06 22:10:05 -05:00
Valentin Udaltsov
7bea6f5b3c
Improved PDO::pgsqlGetNotify signature (#5169) 2021-02-06 22:07:37 -05:00
Bruce Weirdan
b72c5a0fa2
Mark variables in throw arguments as used (#5166)
Fixes vimeo/psalm#5164
2021-02-06 22:07:01 -05:00
Saif Eddin Gmati
d740c1679c
allow libraries to provide psalm plugins (#5165) 2021-02-06 22:06:00 -05:00
Oliver Hader
56b7cb2423
[TASK] Update documentation (#5163)
* [TASK] Fix code highlighting in documentation

* [TASK] Document stubs.file.preloadClasses configuration
2021-02-06 22:04:44 -05:00
orklah
343d020408
improve psalter capacities for anonymous class extending real classes (#5146) 2021-02-04 09:59:38 -05:00
Matt Brown
ff325b3e70 Fix #5141 - combine numeric-string and non-empty-string to non-empty-string 2021-02-03 17:40:41 -05:00
Matt Brown
a0420fb704 Add non-falsy-string to allow more accurate checks 2021-02-03 17:19:48 -05: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
Matt Brown
7dbdc8c59e Fix #5144 - prevent exception during taint analysis 2021-02-02 14:16:15 -05:00
Matt Brown
0eed186edf Fix #5140 - always replace closure return types, whether or not a matching input type is present 2021-02-01 21:40:30 -05:00
Philip Hofstetter
25659dd1a9
add missing parameter names to DateTime::createFromInterface (#5138)
this causes `Trying to access array offset on value of type int in
src/Psalm/Internal/Codebase/InternalCallMapHandler.php`
2021-02-01 10:20:12 -05:00
Matt Brown
0f2a07a9a3 Fix #5137 – support @psalm-flow in methods 2021-01-31 22:40:48 -05:00
Matt Brown
c1d868f950 Fix #5127 - delay transformation of base classes based on inheritance until later 2021-01-31 12:33:07 -05:00
Barney Laurance
156690d46c
Make max_used_shortcode_script executable (#5133) 2021-01-31 11:50:55 -05:00
Barney Laurance
0cd5442c47
Enforce property type invariance (#5131)
* Implement NonInvariantChildProperty detection

See https://github.com/vimeo/psalm/issues/4184

* Delete test cases with 'parentSetsWiderTypeInConstructor'

As I understand it these are not valid test cases. They
emit NonInvariantPropertyType issues which seems correct - the property
type variation is I think a latent bug in the sample code.

* Reduce shortcode for NonInvariantPropertyType to 1+max used shortcode on master
2021-01-31 11:32:24 -05:00
Franz Zieris
e2e7efb949
Update installation.md (#5130)
Make sure URL is rendered as a link
2021-01-30 20:28:41 -05:00
Joe Hoyle
a3dcc52e9a
Track references on global variables (#5122)
* Track references on global variables

Add global type references to the type map, and fix up unused detection on global variables.

* Add null assertions

* PHPCS
2021-01-28 18:58:02 -05:00
Joe Hoyle
5759472168
Add constant fetch to reference map (#5115)
* Add constant fetch to reference map

To support showing constant types on hover of constant references, we need to add them to the ref map.

* Fix root constants

* PHPCBF
2021-01-28 11:18:28 -05:00
Matt Brown
359a0166e3 Fix #4631 - prevent reusing named params 2021-01-27 22:53:55 -05:00
Matt Brown
4807d38507 Fix using std library functions 2021-01-27 22:28:33 -05:00
yaegassy
7ce5b7ec13
docs: Update config of vim-lsp in language_server.md (#5117) 2021-01-27 20:46:56 -05:00
Matt Brown
dd11e541a7 Fix #4010 – don’t create interface intersections unless there’s no overlap 2021-01-27 12:48:32 -05:00