Matthew Brown
0f5b0fd65d
Fix location of traits
2020-03-02 23:07:21 -05:00
Matthew Brown
2cf2ead43b
Remove stray comma
2020-03-02 22:30:06 -05:00
Matthew Brown
c0c878cc9d
Don’t cache all traits
2020-03-02 22:27:54 -05:00
Brown
93d2d4d1a7
Add slash
2020-03-02 16:02:45 -05:00
Brown
86d52bbf4f
Remove unused code
2020-03-02 15:49:05 -05:00
Brown
ceebc9e81d
Only invalidate methods that call a removed trait
2020-03-02 15:26:57 -05:00
Brown
61ecd2a5fe
Limit constructor check invalidation
2020-03-02 11:20:52 -05:00
Brown
548d9fca2c
Add references to property-defining classes
2020-02-26 16:49:14 -05:00
Brown
712806b452
Fix #2874 - understand doubly-inherited interface templates
2020-02-24 17:58:44 -05:00
Matthew Brown
d3f8e80c4a
Move reference map generation into separate file
2020-02-23 14:53:31 -05:00
Brown
7d99a15072
Fix #2805 - forbid passing in mutable class to mutation-free context
2020-02-21 18:25:35 -05:00
Matthew Brown
196a0a5c4e
Replace issue data array with object
2020-02-16 18:24:40 -05:00
Matthew Brown
bacc7f254c
Remove unnecessary extension check
2020-02-15 10:42:29 -05:00
Matthew Brown
d0d0c019cd
Fix aliasing
2020-02-14 22:39:07 -05:00
Matthew Brown
653353709a
Use MethodIdentifier object instead of string
2020-02-14 20:54:26 -05:00
Matthew Brown
477d38e6eb
Suppress issue
2020-02-13 18:20:24 -05:00
Brown
210d65d0d6
Add a few lowercase-string types
2020-02-13 17:52:23 -05:00
Brown
8989737e51
Fix #2775 - use lowercase strings in a couple more places
2020-02-13 17:44:16 -05:00
Brown
1c42875179
Support lowercase-string and warn about unnecessary calls to strtolower
2020-02-13 16:38:58 -05:00
Brown
f141f7c526
Improve --diff checks by including trait-using classes in dependents
2020-02-11 16:39:33 -05:00
Matthew Brown
bbdb1254ad
Add line break
2020-02-05 08:51:11 -05:00
Lars Moelleken
759cfe4555
add more impure function calls
2020-02-05 08:51:11 -05:00
Brown
4c83ca75b3
Fix #2738 - clear out property issues when modifying constructors
2020-02-03 16:43:25 -05:00
Pavel Batečko
ecf85aef12
Add generic definition of DOMNamedNodeMap ( #2703 )
...
* Fix #2638 - propagate phantom classes to recursive calls to Scanner::queueClassLikeForScanning()
* Add generic definition of DOMNamedNodeMap
2020-01-29 08:39:07 -05:00
Philip Hofstetter
5774cfed7d
mark additional impure functions ( #2699 )
...
both `fflush` and `vprintf` have very similar cousins already declared
as having side-effects.
This fixes #2687
2020-01-27 08:12:40 -05:00
Brown
311164f5ee
Fix #2679 - session_start is impure
2020-01-23 10:26:11 -05:00
Matthew Brown
8202af957d
Index issues by file to reduce some lookups
2020-01-21 21:07:44 -05:00
Brown
d434f7fb9d
Add list identification for late-resolved constants
...
Fixes #2624
2020-01-15 11:54:01 -05:00
Brown
7482b9e56f
Emit all stubs discovered by Psalm during analysis
...
Fixes #827
2020-01-08 17:23:40 -05:00
Brown
adfb488986
Fix #2565 - prevent infinite recursion when analysing file with @mixin annotations that reference each other
2020-01-07 17:06:44 -05:00
Brown
07aaa3f99d
Don’t complain about method mismatches for @mixin
2020-01-06 18:04:28 -05:00
Matthew Brown
2fb5a9d326
Few small improvements
2020-01-05 18:37:07 -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
Brown
5f5a942a32
Improve handling of interface-implementing edge-case
2020-01-02 15:24:03 -05:00
Matthew Brown
02fd1659ef
Ignore serialize/unserialize methods
...
Fixes #2511
2019-12-31 07:56:35 -05:00
Matthew Brown
c79ba0b09e
Include non-empty-string type in more places
2019-12-30 07:25:36 -05:00
Matthew Brown
55c2f7faa2
Fix #2508 - don’t replace templated types with generic ones inside own function
2019-12-28 18:38:02 -05:00
Bruce Weirdan
4110ec351b
Make travis green again ( #2518 )
...
* Bumped phpspec/prophecy version to prevent 7.4 deprecations
* Fix DOMDocument::$config type
This property was documented as containing DOMConfiguration object, but
in fact always returned `null` (see [php source](ee80567a83/ext/dom/document.c (L542)
)).
DOMConfiguration class is removed in PHP 8.
* Dropped unused use
* Allow to set PHP 8.0 as current version
* Fix CallMap issues for PHP 8.0
- Use both major and minor version to load deltas
- Don't load non-existent deltas
- Stop at lowest possible delta
2019-12-27 19:06:09 -05:00
Matthew Brown
2f2cd85a6a
Identify invalid static property array assignment
2019-12-27 10:34:51 -05:00
Matthew Brown
6b81f8c64a
Fix #2506 - use correct flag when checking classes after analysis
2019-12-24 01:02:34 +00:00
Matthew Brown
59aeb6b6c3
Fix #2490 - allow overriding renamed trait methods in subclass
2019-12-20 20:11:27 +00:00
Matthew Brown
395cac0e0b
Add specific exception
2019-12-20 18:08:53 +00:00
Matthew Brown
a4191171bf
Fix #2483 - treat intersecting PHPDocs from interfaces better
2019-12-20 01:42:57 +00:00
Matthew Brown
3ef93fd795
Add slash
2019-12-15 13:34:12 -05:00
Matthew Brown
090ad90de3
Fix build issues
2019-12-15 13:28:38 -05:00
Matthew Brown
72f3c306d7
Fix #2471 - don’t erroneously template class-strings
2019-12-15 13:23:04 -05:00
Matthew Brown
c3d8315ab9
Don’t inherit parameter covariance
2019-12-14 10:06:40 -05:00
Brown
2e322ee214
Don’t try to fix missing trait method params
...
Fixes #2427
2019-12-10 17:32:39 -05:00
Brown
b3cf9d3958
Catch circular references in constants
...
Fixes #2453
2019-12-10 16:16:44 -05:00
Brown
a3e51d6f13
Fix resolution for class names in lazily-evaluated class constants
...
Fixes #2413
2019-12-04 13:33:50 -05:00
Matthew Brown
aa4daea182
Add extra safety feature
2019-12-03 01:59:36 -05:00
Matthew Brown
97de060df9
Fix #2279 - add parameter typehint by default
2019-12-03 01:49:43 -05:00
Matthew Brown
dd05f6e3ca
Speed up missing property type consolidation
2019-12-03 00:57:26 -05:00
Brown
821f3528d2
Fix #701 - indicate issues fixable with Psalter
2019-12-02 15:24:01 -05:00
Matthew Brown
5fe3a4a5a9
Fix #2368 - don’t register class-file mapping
...
Sometimes it’s not a real class there, just a class_alias call
2019-12-01 23:47:36 -05:00
Brown
1f07ea7ee7
Tighten up Psalm’s inference
2019-11-25 15:20:31 -05:00
Brown
0bcb7863f3
Use better system for storing inferred types and assertions
2019-11-25 11:44:54 -05:00
Matthew Brown
3d9c94e29a
Fix #2363 - catch possible class not found errors when getting method
2019-11-21 08:56:47 -05:00
Matthew Brown
2369bac943
Preserve self refs where possible
2019-11-16 19:59:08 -05:00
Brown
b693b726c7
Improve handling of default extended params
2019-11-14 12:12:09 -05:00
Brown
4be3180512
Add more impure functions
2019-11-13 13:22:04 -05:00
Brown
96586f16c0
Fix phpcs issues
2019-11-11 10:11:42 -05:00
Brown
4bf632bc23
Only extend covariant flag to vars without template param
2019-11-04 11:12:59 -05:00
Matthew Brown
a82e35a59f
Fix #2291 - extended covariant template param types should be treated as covariant
2019-11-01 18:25:07 +01:00
Matthew Brown
5910a362ea
Improve report output of taint analysis
2019-10-19 17:59:10 -04:00
Brown
8978e5c7f1
Add sink for print_r
2019-10-18 15:28:15 -04:00
Brown
aa5d82d30d
Fix #2228 - load functions defined on traits included in a class
2019-10-15 12:09:08 -04:00
Brown
5e649f684c
Fix erroneous return type resolution
2019-10-14 17:10:30 -04:00
Matthew Brown
3dc96edf08
Update file references again
2019-10-13 23:37:15 -04:00
Matthew Brown
477fa8cba8
Set file references before they’re used
2019-10-13 23:30:01 -04:00
Matthew Brown
a0d484a314
Reduce duplicate calls
2019-10-13 22:05:16 -04:00
Matthew Brown
8c6b234c2c
Improve speed of taint analysis
2019-10-13 20:10:31 -04:00
Matthew Brown
e1e2ff3e57
Improve shuffling
2019-10-13 20:09:50 -04:00
Matthew Brown
7e76d3386d
Fix phpcs issues
2019-10-13 12:38:16 -04:00
Matthew Brown
3c00f3d029
Limit taint file re-analysis
2019-10-13 12:34:40 -04:00
Matthew Brown
cd8534fb6c
Shuffle file analysis order for more even threaded workload distribution
2019-10-13 12:33:18 -04:00
Matthew Brown
d0a9bf24f8
Void-returning functions are going to be impure
2019-10-13 09:51:25 -04:00
2e3s
a658566429
Add impure functions for mcrypt and iterator_apply ( #2227 )
2019-10-13 09:43:25 -04:00
Matthew Brown
5918278af3
Fix cache growth thanks to array_recursive
2019-10-11 20:17:07 -04:00
Brown
09cf864d9b
Mark preg_replace_callback as sometimes-pure
2019-10-11 13:54:33 -04:00
Matthew Brown
03c39cbe7c
Fix #2223 - make sure lists are handled in more places
2019-10-10 20:16:43 -04:00
Brown
94001aad4a
Fix #2208 - handle templated property types appropriately
2019-10-04 13:51:36 -04:00
bugreportuser
d8855282c6
Add more impure functions ( #2203 )
2019-10-03 15:01:31 -04:00
Brown
f8f8b633b1
Suppress a bunch of PossiblyUndefinedArrayOffset issues
2019-10-01 15:44:43 -04:00
Matthew Brown
81464d8dbf
Fix #2179 - add gz* to list of impure functions
2019-09-27 09:50:33 -04:00
Matthew Brown
cbc142671d
Fix #2175 - support late-resolved empty arrays
2019-09-27 09:05:56 -04:00
Brown
2fa0e05802
Fix #2169 - always use most immediate function storage when analysing
2019-09-25 18:48:41 -04:00
Brown
648dda67ed
Fix Psalm issues
2019-09-25 13:12:29 -04:00
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