1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-14 18:36:58 +01:00
Commit Graph

291 Commits

Author SHA1 Message Date
Brown
2d621f185a Fix #2166 - inherit twice from docblocks 2019-09-25 12:02:59 -04:00
Matthew Brown
80059f9139 Scrub inferred mutation-free when method is overridden 2019-09-22 09:40:08 -04:00
Matthew Brown
ae46c9e132 Fix #2114 - make builtin constructors mutation free 2019-09-21 21:07:27 -04:00
Brown
c5ef2516b5 Fix #2150 - add detection for unnecessary @var annotations
And also remove them from codebase
2019-09-19 11:59:43 -04:00
Brown
0ac9108814 Fix #2139 - allow comprehension of constant ternaries 2019-09-17 11:29:41 -04:00
Brown
a0f7e73aea Fix #2127 - improve behaviour of suppression discovery in threaded mode 2019-09-16 11:58:42 -04:00
Matthew Brown
0b4981f01b Fix #1551 - do better at inferring class constant types 2019-09-14 14:26:31 -04:00
Matthew Brown
deb36e8b27 Allow array_map alone when it uses a closure 2019-09-09 21:28:56 -04:00
Brown
a6baa2d04c Allow callables to be understood as pure
Fixes #2112
2019-09-09 12:11:04 -04:00
Brown
b49444b8ad Allow immutable objects to be cloned
Fixes #2111
2019-09-09 11:14:40 -04:00
Brown
21aa162d0a Make assert() pure
Fixes #2113
2019-09-09 10:43:10 -04:00
Brown
56c884845f Static methods inside @psalm-immutable class should be permitted
Fixes #2109
2019-09-09 10:38:55 -04:00
Matthew Brown
6b52b84bee Fix #2101 - use more accurate fallback when match isn’t found 2019-09-08 14:44:59 -04:00
Matthew Brown
a032978a85 Use a better check for functional purity 2019-09-08 11:49:14 -04:00
Matthew Brown
3dbfedb51a Make purity test more strict again 2019-09-08 11:34:16 -04:00
Matthew Brown
0fc8c9a9bb Soften definition of purity to allow functions that return by-ref output 2019-09-08 11:32:04 -04:00
Matthew Brown
8be43398f0 Add better handling of print_r 2019-09-07 13:01:36 -04:00
Brown
de5df1e36a Warn about unnecessary use of DateTimeImmutable 2019-09-03 13:49:15 -04:00
Matthew Brown
9cbe389285 Fix #910 - dead code issues with abstract vendor method 2019-09-01 16:52:40 -04:00
Matthew Brown
e8500e5e51 Anything calling rand/mt_rand can’t be pure 2019-08-30 16:41:59 -04:00
Brown
b7b4baff8f Add support for @immutable
Fixes #1272
2019-08-30 12:36:35 -04:00
Ilija Tovilo
e0cd04d809 Add more impure functions to configuration (#2053)
* Add more impure functions to configuration

Closes #2050

* Change note
2019-08-23 08:50:13 -04:00
Thomas Bley
149402abda Extend impure functions (#2042)
* extended impure functions, fixes #2038

* extended UnusedCodeTest #2038
2019-08-21 13:12:13 -04:00
Brown
3001eb9d34 Move taint location to end 2019-08-21 09:53:00 -04:00
Matthew Brown
4fff6c28a9
add slashes 2019-08-20 19:02:23 -04:00
Brown
9696fb8dce Follow taint to source when reporting 2019-08-20 17:38:15 -04:00
Matthew Brown
6ea68e9f7f Clean up more unused @psalm-suppress annotations 2019-08-18 16:59:56 -04:00
Matthew Brown
c5f62d261d Remove redundant @psalm-suppress in Psalm’s codebsae 2019-08-18 16:10:12 -04:00
Matthew Brown
2a5e0d8f39 Fix #1444 - track unused suppressions 2019-08-18 14:27:50 -04:00
Brown
a4d57e5524 Fix #2018 - prevent fatal error on class_aliased class reference 2019-08-15 10:17:27 -04:00
Brown
3d01708c6c Improve backtrace of property-involved issues 2019-08-14 11:47:58 -04:00
Brown
e92896f145 Fix taint records 2019-08-14 09:52:59 -04:00
Matthew Brown
600999a3a8 Add better typing 2019-08-14 00:47:57 -04:00
Brown
c3949e3194 Improve taint protection for exec-related commands 2019-08-13 19:18:50 -04:00
Brown
d6e084ec9c Remove false-positive for callmap function arg 2019-08-13 14:53:31 -04:00
Brown
55cfbdcd5f Fix erroneous complaint for str_replace 2019-08-13 14:26:25 -04:00
Brown
b5614d03f8 Add detection for unused function calls 2019-08-13 13:15:23 -04:00
Matthew Brown
d5b026839c Add support for different taint types ref #1990 2019-08-12 23:16:05 -04:00
Matthew Brown
dec612a47e Remove blank line 2019-08-08 23:06:52 -04:00
Matthew Brown
53817ed40b Fix #1991 - allow overlapping code to subsume manipulations inside 2019-08-08 22:58:54 -04:00
Brown
955899ade0 Builtin functions are assumed to be pure 2019-08-07 15:21:15 -04:00
Brown
16a1dc8538 Fix errors 2019-08-06 18:56:36 -04:00
Brown
14b37b95af Fix potential recursion 2019-08-06 17:29:44 -04:00
Brown
fc8d2bd563 Do more taint creation for magic properties 2019-08-06 14:27:21 -04:00
Brown
6eb62591ab Specialise calls when functions are pure 2019-08-05 18:33:33 -04:00
Matthew Brown
b2c0993cdc Add framework for taint analysis to Psalm
Ref #611
2019-08-04 10:37:36 -04:00
Matthew Brown
c76380174f Fix infinite recursion on property types 2019-07-22 23:54:33 -04:00
2e3s
f15cc7dd5b Mark private properties unused when referenced only in constructor (#1962)
* Mark private properties unused when referenced only in constructor

If a private property is used only in constructor then most likely
it's a dead code since there is no need to have the class property.
But such static properties can be accessed between the calls.

* Ignore the private property issue on alter

* Fix the related dead code psalm

* Add a missing condition into the test
2019-07-21 23:29:16 -04:00
Tyson Andre
5d5a9c6eac Remove redundant casts and unused use statements (#1955)
* Remove redundant casts

(not sure about older versions of php-parser)

* Remove unused use statements
2019-07-18 23:37:36 -04:00
Bruce Weirdan
e0a59ce117 Fixed PHP 7.4 related issues (#1957)
- s/fn/f/g (fn is a reserved keyword in 7.4)
- ReflectionType::__toString() warning (this method is deprecated in 7.4)

Note that some issues are caused by `phpspec/propecy` code and will be
fixed when phpspec/propecy#432 lands. Most were caused by
`ReflectionType::__toString()` usage in
`Psalm\Internal\Codebase\Reflection` though.
2019-07-18 23:36:39 -04:00
Matthew Brown
74e1b521a5 Add support for completing builtin class names
Fixes #1863
2019-07-17 22:50:57 -04:00
Matthew Brown
ab50c6ce2e Fix #1949 - check that aliased name doesn’t exist before transforming 2019-07-17 20:33:44 -04:00
Sergey Melesh
af875439e7 Inherit throws docblock from parent class by default (#1947) 2019-07-14 17:29:04 -04:00
Sergey Melesh
ee1387473f Fix throws docblock inheritance (#1945) 2019-07-13 10:10:51 -04:00
Brown
12eeb8b320 Fix #1935 - clear stub grandchildren 2019-07-11 18:23:02 -04:00
Brown
7268558aa7 Prevent unnecessary warnings 2019-07-11 11:07:39 -04:00
Matthew Brown
da42be175f Apply PHPCS fixes
Fixes #1880
2019-07-05 16:27:53 -04:00
Matthew Brown
422d9944d8 Fix #1903 - inherit @method from parent interfaces 2019-07-04 22:39:28 -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
Brown
e876feb0ea Allow users to pass file names to Function::getStorage 2019-07-01 14:20:14 -04:00
Matthew Brown
ca53019d6b Simplify class completion lookup
Ref #1822
2019-06-29 21:32:26 -04:00
Matthew Brown
6b7788b502 Fix FileAnalyzer memory leak 2019-06-29 21:06:21 -04:00
Tyson Andre
791b30a6d8 Fix redundant casts/conditions in psalm (#1874)
This includes a check for array_map that was accidentally an assignment
2019-06-29 12:32:44 -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
16bf5f11e1 Fix #1845 - prevent string return when expecting template 2019-06-25 15:06:02 -04:00
Matthew Brown
d96246a824 Improve template handling robustness 2019-06-25 09:06:23 -04:00
Matthew Brown
c0b86bd40d Use uppercase template_type_extends keys 2019-06-24 23:43:04 -04:00
Brown
69b05f5052 Improve handling of parent method calls 2019-06-24 17:45:10 -04:00
Matthew Brown
766b1b0384 Add reference, not type
Ref #1835
2019-06-23 09:10:43 -04:00
Matthew Brown
37ffd6dad6 Fix #1832 - add references to docblock types 2019-06-23 08:47:49 -04:00
Brown
aa6677a177 Add autocompletion for some classes
Ref #1822
2019-06-21 17:10:35 -04:00
Matthew Brown
7fc11af49e Fix docblocks with @andrew-demb’s suggestions 2019-06-16 09:12:32 -04:00
Matthew Brown
41cdde514f Fix #1784 - detect missing end brackets 2019-06-15 17:57:40 -04:00
Matthew Brown
2d5f332ebf Fix #1781 by improving handling of callmap options 2019-06-15 16:10:48 -04:00
Brown
edf3307f84 Fix Psalm errors 2019-06-14 15:55:23 -04:00
Brown
1bc1af140f Move method calls outside classes and __CLASS__ constants 2019-06-14 15:54:15 -04:00
Brown
58b6ce3483 Fix bugs when moving methods that reference each other 2019-06-14 14:41:44 -04:00
Brown
844442e039 Fix #1780 - set open file contents on save 2019-06-13 15:25:55 -04:00
Brown
9c4599a0f0 Add better support for inheriting docblocks 2019-06-11 11:19:57 -04:00
Brown
7cf8c362f0 Fix #1766 - interpret interface parent extends properly 2019-06-11 10:49:39 -04:00
Brown
010f911d22 Fix replacement of local types 2019-06-11 10:33:52 -04:00
Brown
45f2d986e6 Allow multiple class renames at once 2019-06-10 17:09:34 -04:00
Matthew Brown
c0a9ccb385 Fix handling of unused params in threaded mode 2019-06-09 17:02:21 -04:00
Matthew Brown
42cc201e9e Fix #1698 - better understand inherited docblock return types 2019-06-08 09:44:22 -04:00
Matthew Brown
20c66f693e Fix handling of class const types 2019-06-06 18:46:40 -04:00
Matthew Brown
4fc5d1d5c8 Rewrite use statements 2019-06-05 22:13:33 -04:00
Matthew Brown
f327d75116 Add actual file moving 2019-06-05 08:50:24 -04:00
Brown
f309c755f8 Add ability to move classes 2019-06-05 08:50:24 -04:00
Brown
778b95d335 Add support for moving class constants 2019-06-04 11:14:49 -04:00
Matthew Brown
a9809ab28a Add property moving & renaming 2019-06-04 00:32:19 -04:00
Brown
ae8ccdbcd7 Add add info notification to progress 2019-06-03 11:20:42 -04:00
Marco Pivetta
624c7bc6fb Renamed Fn to TFn to allow for PHP 7.4 compatibility 2019-06-03 08:21:25 -04:00
Matthew Brown
fc0f625f62 Add safeguards to prevent bad refactor input 2019-06-02 23:33:57 -04:00
Matthew Brown
2439a9f6a0 Allow instance method renaming, too 2019-06-02 12:02:39 -04:00
Matthew Brown
5eb7cb9b04 Improve file update progress output 2019-06-02 09:59:45 -04:00
Matthew Brown
2b0a17c1c8 Add simple tool to move static methods 2019-06-02 01:10:50 -04:00
Matthew Brown
909e02d441 Move var docblocks within function 2019-06-01 12:25:57 -04:00
Matthew Brown
7e4de611bf Migrate class references in static calls 2019-06-01 10:07:45 -04:00
Matthew Brown
cc89b9254d Add initial ideas for moving static methods
Ref #1595
2019-06-01 00:56:54 -04:00
Brown
a060da95bf Allow MissingParamType alteration to be done in multithreaded mode 2019-05-31 11:55:24 -04:00