Matt Brown
316dd78e6a
Fix #509 - don’t complain about a missing param type when system parent has one
2018-02-21 11:57:52 -05:00
Matt Brown
e04c4f866c
Fix #524 - prevent fatal error when checking stubbed function from namespace
2018-02-21 11:32:52 -05:00
Matthew Brown
d10212b393
Fix perpetual diff builds
2018-02-19 23:36:36 -05:00
Tyson Andre
cdcec69536
Support the pylint output format
...
This is a compact output format that is easy to write scripts that parse.
(And errors fit on a single line)
- E.g. jenkins violation plugin works reliably with pylint.
The multi-line details are deliberately omitted.
An application can output 'console' to stdout and to
a pylint file at the same time.
Files with the extension .pylint will use this format.
Document the emacs and pylint output formats in `psalm --help`
An optional followup task would be to create unique issue codes,
I don't have any use cases for that.
2018-02-19 22:35:48 -05:00
Tyson Andre
7aeacebba4
Fix possible typos in comments and issue messages
2018-02-19 15:35:13 -05:00
Matthew Brown
81fd016120
Fix #193 - allow caching of storages
2018-02-19 00:27:39 -05:00
Tyson Andre
aea3779c96
Fix unused imports in psalm, wrong param order doc comments ( #523 )
...
(Some of the imports appear as strings elsewhere in the same file)
2018-02-18 17:55:11 -05:00
Matthew Brown
59dc239c89
Fix #522 - prevent interface instantiation
2018-02-17 18:53:02 -05:00
Matthew Brown
108ca54867
Fix #516 - make sure --find-references-to doesn’t output missing references
2018-02-17 17:45:30 -05:00
Matthew Brown
a0e88cb16f
Fix #518 - improve dead code detection to cover variable method calls
2018-02-17 17:23:57 -05:00
Matthew Brown
b041797cd0
Fix #519 - warn about variable calls on non-objects
2018-02-17 17:16:22 -05:00
Matthew Brown
af1155239e
Fix bug when assigning nested arrays with variable offsets
2018-02-17 12:32:19 -05:00
Matthew Brown
c87204acbf
Don’t check for unused vars when checking for initialiasations
...
Fixes #517
2018-02-17 12:02:31 -05:00
Matthew Brown
09f86ceee7
Introduce MissingDependency issue, separate from UndefinedClass
...
Ref #511
2018-02-17 11:36:20 -05:00
Matthew Brown
88ca7d2fa7
Fix #515 - make Psalm aware of variable array keys
2018-02-17 11:24:08 -05:00
Matthew Brown
f56edd3c04
Fix issue found by better analysis
2018-02-17 11:21:45 -05:00
Matthew Brown
7940268a13
Fix #512 - check for undefined constant in param default
2018-02-15 20:27:42 -05:00
Matthew Brown
a6b54a3607
Fix #513 - make sure numeric is treated like a number
2018-02-15 19:50:50 -05:00
Matt Brown
279b0bc16e
Fix #511 - check all class references for missing dependencies
2018-02-14 13:34:16 -05:00
Matt Brown
be75c143d4
Fix #510 - check that constructor parent classes and interfaces exist
2018-02-14 11:21:43 -05:00
Matt Brown
d0a2258806
Fix #508 - make sure trait missing property checks happen on correct file
2018-02-12 10:46:45 -05:00
Matthew Brown
affcaebc3d
Use classes, not full method ids, for plugin execution
2018-02-11 22:49:19 -05:00
Matthew Brown
f159cd5146
Add declaring/appearing method ids to method check plugin
2018-02-11 21:07:19 -05:00
Matthew Brown
e862e4ddb1
Make all plugin methods static
...
cc @TysonAndre
2018-02-11 20:56:34 -05:00
Matthew Brown
f17ba65731
Fix #438 - assign both sides of by-ref vars to mixed
2018-02-11 10:39:21 -05:00
Matthew Brown
217233472c
Fix #457 - fix objectlike property isset check
2018-02-10 23:30:40 -05:00
Matthew Brown
24416feb62
Improve handling of unset calls with possibly undefined variables
2018-02-10 10:30:08 -05:00
Nicky Robinson
8e77ff1ce9
Throw error if magic getter or setter called for undefined property or invalid type specified with annotations ( #500 )
...
* Fix path to psalm
* If a magic getter or setter is used to access a property on a class
that is not defined but a `@property` annotation for the property
exists, throw an error. If no `@property` annotation exists, it's not
an error because you're allowed to make magic getters and setters do
crazy things.
Fixes #480
* Move logic to a better place to avoid duplicate checks
* Move logic into function
* Remove some nesting
* Check psalm-seal-properties and property type correctly
2018-02-09 19:37:09 -05:00
Matthew Brown
40efa9e8aa
Fix #503 - make sure mixed array type is set for MixedMethodCall
2018-02-08 23:22:29 -05:00
Matt Brown
283e0a6af2
Migrate class constant handling into codebase classes
2018-02-08 18:18:34 -05:00
Matt Brown
6f7903716d
Move property lookup api into codebase class
2018-02-08 18:14:28 -05:00
Matt Brown
78cc1786c8
Don’t check newly-scoped vars in conditional
2018-02-08 14:46:06 -05:00
Matt Brown
72675cb5a0
Be more rigorous about atomic docblock type reconciliation
2018-02-08 13:01:39 -05:00
Matthew Brown
6955f77e2e
Fix #493 - add support for multiple @var lines per docblock
2018-02-07 23:33:31 -05:00
Matthew Brown
24e03edefa
Fix #485 when return type is a generator
2018-02-07 22:29:32 -05:00
Matthew Brown
1ae58f0386
Fix #501 - allow analysis to continue after bad constant check
2018-02-07 20:26:26 -05:00
Matt Brown
7f4be858c2
Fix #498 - add better issue type for docblock contradiction
2018-02-07 15:20:47 -05:00
Matt Brown
685ea29ebe
Move asserted var creation after conditional reconciliation
2018-02-07 14:13:57 -05:00
Matt Brown
b4281748bc
Remove redundant code found by Psalm
2018-02-07 13:57:45 -05:00
Matthew Brown
970ceab396
Check loop context var exists
...
This can happen if the parent has been reassigned
2018-02-06 21:03:36 -05:00
Matt Brown
1df4c3d196
Add DocblockTypeContradiction to find possible issues with docblock types
...
Fixes #491
2018-02-06 18:44:53 -05:00
Matt Brown
fc58655963
Make logic more Psalm-compatible
2018-02-06 13:52:59 -05:00
Matt Brown
1d46124bab
Fix issues found by detecting docblock type inconsistencies
2018-02-06 13:40:28 -05:00
Matt Brown
4b87612bb4
Add better issue message for bad array offset
...
Fixes #492
2018-02-06 11:27:01 -05:00
Matt Brown
d88eadbb0e
Fix #486 - skip first reconciliation in loop checker for do stmts
2018-02-06 11:07:52 -05:00
Matthew Brown
beb4993736
Add more text feedback when running from command line
2018-02-06 01:11:33 -05:00
Matt Brown
8747d78c39
Suppress RedundantCondition when analysing first loop of do
...
Ref #486
2018-02-05 17:29:13 -05:00
Matt Brown
2e443dce85
Revert "Fix private constructor check"
...
This reverts commit 684eb7923b
, because it introduces more problems than it solves
2018-02-05 15:53:39 -05:00
Matt Brown
684eb7923b
Fix private constructor check
2018-02-05 13:06:03 -05:00
Matthew Brown
e6c0fbf3b8
Create PropertyMap handler class
2018-02-04 12:34:08 -05:00
Matthew Brown
473a174f23
Memoise type tokenisation and move functions to more logical locations
2018-02-04 12:23:32 -05:00
Matthew Brown
77a0720b65
Break up Populator method
2018-02-03 20:03:31 -05:00
Matthew Brown
8e0998e081
Break apart the Codebase class
2018-02-03 18:56:54 -05:00
Matthew Brown
e5bc0e6129
Fix #431 - report invalid return types before invalid nullable/falsable ones
2018-02-02 19:08:10 -05:00
Matthew Brown
861d907845
Add more information to TooMany/TooFewArguments issues
...
Fixes #481
2018-02-02 11:26:55 -05:00
Matthew Brown
08c1d65ad2
Fix docblock overriden method return type
2018-02-01 09:24:57 -05:00
Matthew Brown
d8fb14e6f7
Fix incorrect template types being passed through
2018-02-01 01:52:20 -05:00
Matthew Brown
fb300baa6d
Move a bunch of code into Codebase
2018-02-01 00:50:01 -05:00
Matthew Brown
cf8734a480
Add support for generic classes
2018-01-31 23:27:25 -05:00
Matthew Brown
de9b90297a
Allow inheriting functions with nullable signatures to return void
2018-01-31 19:24:34 -05:00
Matt Brown
3d6bb23e28
Add stats breakdown for files
2018-01-31 17:09:09 -05:00
Matt Brown
fc805a926e
Add code coverage message at the end of a scan
2018-01-31 16:08:52 -05:00
Matt Brown
b2b2572e4d
Fix #478 - allow is_a checks with string arg
2018-01-30 16:45:29 -05:00
Matthew Brown
6c38b2fdfe
Fix #348 - don’t warn about a little contravariance
2018-01-29 22:29:49 -05:00
Matt Brown
c7b2ae4e0e
Fix do while nullability issue
2018-01-29 17:18:03 -05:00
Matt Brown
5200a25efa
Fix #477 - make sure that isset applies to property object
2018-01-29 15:47:25 -05:00
Matt Brown
8ad863614c
Don’t add unnecessary space between paras
2018-01-29 13:42:04 -05:00
Matt Brown
4099bf24ce
Make sure new $class args are always evaluated
2018-01-29 12:22:50 -05:00
Matt Brown
66c8637b5b
Fix unused code checks for possibly undefined vars
2018-01-29 12:13:44 -05:00
Matthew Brown
6bfb27165d
Check property defaults again
2018-01-28 21:43:26 -05:00
Matthew Brown
3482ee3b39
Split UntypedParam into MissingParamType and MissingClosureParamType
2018-01-28 20:03:47 -05:00
Matthew Brown
1c34dbe289
Fix erroneous treatment of finally blocks after return in try
...
Fixes #473
2018-01-28 19:02:31 -05:00
Matthew Brown
e0fa3adb6f
Split up CallChecker to speed up Psalm
2018-01-28 18:29:38 -05:00
Matthew Brown
ed5245bc47
Go easy on unknown invocations
2018-01-28 18:13:38 -05:00
Matthew Brown
44b8b22995
Improve checks for unused variables and params
2018-01-28 17:28:34 -05:00
Matthew Brown
4a672fade8
Add a couple of optimisations suggested by Scrutinizer
2018-01-28 17:26:09 -05:00
Matthew Brown
8b740110f4
Remove more ? from docblocks
2018-01-28 17:07:09 -05:00
Matthew Brown
7ce053bd8a
Make docblocks sligtly more phpdoc-compatible
2018-01-28 16:52:57 -05:00
Matthew Brown
eb2870562b
Remove last two that Psalm found
2018-01-28 16:06:42 -05:00
Matthew Brown
8799b856cb
Add a couple more unused code locations
2018-01-28 13:50:41 -05:00
Matthew Brown
dd32452d90
Remove more dead code found by Psalm
2018-01-28 12:43:19 -05:00
Matthew Brown
59cdc5494f
Remove unused list vars
2018-01-28 12:29:14 -05:00
Matthew Brown
f628187de9
Remove dead code found by improved Psalm checks
2018-01-28 12:01:51 -05:00
Matt Brown
2d8468cb49
Allow interface to extend travserable and pass iterable test
2018-01-26 14:08:45 -05:00
Matt Brown
576f835858
Exit early if key does not exist
2018-01-26 13:56:53 -05:00
Matt Brown
a2d11cce51
Fix static/self return type handling
2018-01-26 13:51:00 -05:00
Matt Brown
b333e90fee
Fix casing of duplicate interface method check
2018-01-26 12:00:02 -05:00
Matt Brown
1320b6dd54
Fix #472 - inherit interface method docblocks if defined just once
2018-01-26 11:50:29 -05:00
Matt Brown
5e0a8c4339
Inherit correct self return type
2018-01-26 10:59:30 -05:00
Matt Brown
62401f15fd
Prevent finding unused classes and methods when multithreaded
2018-01-25 15:40:01 -05:00
Matt Brown
75fd14c492
Fix long line
2018-01-25 14:19:22 -05:00
Matt Brown
450618cc35
Treat do expression as statements plus loop
2018-01-25 13:46:17 -05:00
Matt Brown
1a2d13ae32
Ignore falsable issues from core functions
2018-01-25 13:07:36 -05:00
Matt Brown
127c743906
Fix #471 - assign static class const to mixed
2018-01-25 10:47:15 -05:00
Matthew Brown
ea28ee709d
Improve unused variable detection slightly
2018-01-25 01:04:26 -05:00
Matt Brown
543872f186
Allow @psalm-ignore-falsable-return annotation
...
Downgrades issues around use of current(), reset(), end() etc.
2018-01-24 18:52:58 -05:00
Matt Brown
f46cf729bb
Allow null checks against preg_replace and related
2018-01-24 17:07:03 -05:00
Matt Brown
93ac3eaadb
Fix #213 by evaluating switch statements better
2018-01-24 16:15:53 -05:00
Matt Brown
24cbe6a52a
Fix #466 - initialize variable
2018-01-24 13:52:34 -05:00
Matt Brown
e905fc2660
Prevent offset if key doesn’t exist
2018-01-24 13:50:33 -05:00
Matt Brown
f0ee7203ec
Copy over infinite loop protection
2018-01-24 13:38:53 -05:00
Matt Brown
445b128a50
Fix recursion in static calls too
2018-01-24 13:26:24 -05:00
Matt Brown
72a4f148ff
Prevent infinite loops when analysing private functions that call each other
2018-01-24 13:11:23 -05:00
Matt Brown
0018dee5e3
Fix single file checks
2018-01-24 12:00:10 -05:00
Matthew Brown
78e34c0548
Ignore nonexistent static class constants
2018-01-24 00:17:20 -05:00
Matthew Brown
b06cfd025a
Allow continue inside case statement as alias for break
...
Fixes #464
2018-01-24 00:01:08 -05:00
Matt Brown
dea5d92e9b
Add support for static::class
2018-01-23 15:46:14 -05:00
Matt Brown
c0fda0ef1e
Allow instanceof static checks
2018-01-23 14:46:46 -05:00
Matt Brown
abf561bb7d
Improve Psalter return type additions
2018-01-23 12:03:18 -05:00
Matthew Brown
507007a2bf
Add DeprecatedInterface and emit DeprecatedClass in more places
...
Fixes #463
2018-01-23 09:09:43 -05:00
Matthew Brown
fdadcd3a70
Fix implemented interface checks for self/static
2018-01-23 01:32:16 -05:00
Matt Brown
e249c27308
Don’t update return types to null
2018-01-22 18:00:19 -05:00
Matt Brown
e58e824af3
Make sure replacements only happen when called for
2018-01-22 13:54:32 -05:00
Matthew Brown
2994d1e339
Add tests for reference checks
2018-01-21 23:42:57 -05:00
Matthew Brown
e8487e86f0
Make sure else/elseif roots are at the if declaration
2018-01-21 22:05:57 -05:00
Matthew Brown
68b00ea49a
Add automatic fix for PossiblyUndefinedVariable
2018-01-21 16:24:20 -05:00
Matthew Brown
bc9761f6c9
Create Codebase out from ProjectChecker
2018-01-21 13:45:33 -05:00
Matthew Brown
e05a7c00cc
Break FileScanner out from FileChecker
2018-01-21 12:44:46 -05:00
Matthew Brown
9b6b03ff9f
Create Config before ProjectChecker, and remove test-specific code from FileChecker
2018-01-21 10:22:04 -05:00
Matthew Brown
67ef894ecc
Add extra trait test
2018-01-21 00:32:45 -05:00
Matthew Brown
92e43b8fa0
Add a few optimisations
2018-01-20 21:22:33 -05:00
Matthew Brown
799aef628e
Fix type assignment checks
2018-01-20 11:48:16 -05:00
Matthew Brown
5200ffa214
Do not crash on intersection type method lookup
2018-01-20 01:04:15 -05:00
Matt Brown
6ce4aa19e4
Fix formatting in examples
2018-01-18 17:41:14 -05:00
Matt Brown
4b4e09277c
Fix #450 - add checks for duplicate array keys
...
And fix the embarassing errors in tests
2018-01-18 17:16:50 -05:00
Tyson Andre
77b41f4e9f
Bring phpdoc @param
up to date
2018-01-18 16:07:48 -05:00
Scott
2bab66855b
Specify delimiter in preg_quote
...
```
PHP Warning: preg_match(): Unknown modifier 't' in /home/scott/project-redacted/vendor/vimeo/psalm/src/Psalm/Checker/Statements/Block/IfChecker.php on line 166
```
2018-01-17 18:15:13 -05:00
Matt Brown
a253ca68bc
Allow array_filter to inspect closure bodies
2018-01-17 16:07:46 -05:00
Matt Brown
2212d7c032
Reinstate $this type after parent call
...
Fixes #444
2018-01-17 11:00:58 -05:00
Matthew Brown
26945acce6
Move ClassLikeChecker::analyze into ClassChecker and InterfaceChecker
2018-01-14 13:08:24 -05:00
Matthew Brown
bd6e4a09bd
Refactor to break up too-large-files
2018-01-14 12:09:40 -05:00
Matthew Brown
e402ae978a
Fix Array_ items nullability
2018-01-13 18:33:32 -05:00
Matthew Brown
2a38bec5bc
Fix style
2018-01-13 02:08:53 -05:00
Matthew Brown
f3bfb089ad
Don’t investigate property mutations if they’re not visible
2018-01-13 01:52:46 -05:00
Matthew Brown
95553ffc0e
Fix by ref method location
2018-01-13 01:25:13 -05:00
Matthew Brown
5b45909d6f
Use better method for determining by-reference status of functions
2018-01-13 01:15:00 -05:00
Matthew Brown
5d9ebd06d6
Don’t check classes after extension_loaded call
2018-01-12 23:47:36 -05:00
Matthew Brown
573260b16d
Don’t warn about null array access if we’re ignoring null issues
2018-01-12 18:04:11 -05:00
Matt Brown
21eafd8bfc
Fix #352 with a mixed copout if the use is passed by reference
2018-01-12 12:33:26 -05:00
Matthew Brown
7fa541e39b
Allow reference-returning functions to be passed as arguments of byref functions
2018-01-11 23:18:13 -05:00
Matt Brown
4ea1eb3e2c
Fix #436 - get the right location for stubbed functions before analysing their calls
2018-01-11 17:39:12 -05:00
Matthew Brown
fb9f20f4b8
Find unused properties with dead code checks
...
Fixes #424
2018-01-10 23:29:18 -05:00
Matt Brown
d93906243d
Fix incorrect missing return type
2018-01-10 13:04:37 -05:00
Matt Brown
72848477c2
Add all Possibly* issues to more lenient config
...
And add granularity to InvalidPropertyAssignment* issues
2018-01-10 10:56:43 -05:00
Matthew Brown
75daea5f04
Fix #382 - improve reserved word checks
2018-01-10 00:07:47 -05:00
Matthew Brown
6b68da0e4d
Always check typehints for bad classes
2018-01-09 22:46:55 -05:00
Matthew Brown
89af8f2c2c
Fix #434 - preserve formatting when replacing docblocks
2018-01-09 22:33:36 -05:00
Matt Brown
27e47365e3
Fix #422 - be better about checking isset call variables
2018-01-09 19:33:39 -05:00
Matt Brown
3b5ddb8dc2
Reduce use of __toString and remove profiling
2018-01-09 15:44:31 -05:00
Matt Brown
edde8930af
Speed up Psalm by caching result of Union::getId
2018-01-09 15:05:48 -05:00
Matt Brown
1a048040bf
Move IssueBuffer finish logic into the command line
2018-01-09 11:49:10 -05:00
Matt Brown
916ae930e2
Use properly-cased version of class name
2018-01-09 10:49:29 -05:00
Matthew Brown
3f3c1380ee
Fix erroneous error about no parent when analysing trait call
2018-01-09 09:22:23 -05:00
Matthew Brown
de269f969b
Void return types shouldn’t magically become null ones
2018-01-09 00:29:43 -05:00
Matt Brown
b373d6093a
Be more lenient with nullable docblock types, allow no return statements
2018-01-08 17:17:49 -05:00
Matt Brown
65bd144cec
Remove typehint
2018-01-08 11:05:29 -05:00
Matthew Brown
c28b804633
Fix potential filtering of non-zero keys
2018-01-08 01:38:25 -05:00
Matthew Brown
8ababf1537
Allow assertions on mixed vars
2018-01-08 00:14:02 -05:00
Matthew Brown
8e4f8fabe3
Fix getenv calls
...
Fixes #386
2018-01-08 00:09:22 -05:00
Matthew Brown
bb41b92789
Filter forumulae to remove assertions on unknowable things
2018-01-07 23:59:25 -05:00
Harrison Heck
78346b3400
Fix method call missing object.
2018-01-07 23:49:26 -05:00
Matthew Brown
66fa081488
Fix issue with nullable types going into docblock
2018-01-07 18:06:31 -05:00
Matthew Brown
fe96868e27
Add documentation
2018-01-07 17:25:23 -05:00
Matthew Brown
e8ad6a477e
Fix missing docblocks
2018-01-07 17:25:23 -05:00
Matthew Brown
693c7a81fa
Improve tracking of docblock types
2018-01-07 17:25:23 -05:00
Matthew Brown
39685e1be6
Collapse Issue inheritance and rename new issues
2018-01-07 17:25:23 -05:00
Matthew Brown
29b09f9633
Continue after param replacement
2018-01-07 17:25:23 -05:00
Matthew Brown
dc053e699b
Fix resolution of same-namespaced classes
2018-01-07 17:25:23 -05:00
Matthew Brown
05d2c3dcb8
Fix differ to only use available commands
2018-01-07 17:25:23 -05:00
Matthew Brown
456a2ebaaa
Add --dry-run option
2018-01-07 17:25:23 -05:00
Matthew Brown
0e67aae21b
Allow updating of params
2018-01-07 17:25:23 -05:00
Matthew Brown
5bae869dc6
Break file manipulation out into Psalter
2018-01-07 17:25:23 -05:00
Matt Brown
928b01a7c7
Find and fix code issues where functionality is available
2018-01-07 17:25:23 -05:00
Matt Brown
53d8c7ba52
Fix issue ideas
2018-01-07 17:25:23 -05:00
Matt Brown
a76fde5b98
Break out mismatching param/return type issues from InvalidDocblock
2018-01-05 12:11:12 -05:00
Matt Brown
45eaea1ed9
Flesh out callmap type
2018-01-05 11:50:27 -05:00
Matthew Brown
2ebf6a0ef5
Allow non-lethal method signature mismatches to be suppressed
2018-01-05 01:04:07 -05:00
Matthew Brown
40587292a5
Don’t warn about wider child param types
2018-01-05 00:55:48 -05:00
Matthew Brown
6f5a214365
Allow param redefinition, but complain if it differs to parent class
2018-01-05 00:19:35 -05:00
Matthew Brown
c9173c7da3
Add more specific issues for falsable/nullable invalid return types
2018-01-04 21:36:16 -05:00
Matthew Brown
6cff92d813
Don’t worry about invalid closure docblocks
2018-01-04 20:35:43 -05:00
Matthew Brown
a8ac9d4fdc
Flesh out return types before comparing
2018-01-04 20:13:09 -05:00
Matthew Brown
5995de0c9f
Fix possible nullref
2018-01-04 19:31:12 -05:00
Matthew Brown
6e7bab58c4
Be better about inherited core method arg types
2018-01-04 18:58:03 -05:00
Matthew Brown
db7abc2b90
Add more debug output when using reflection/composer classmap
2018-01-04 14:13:54 -05:00
Matthew Brown
12aef22f05
Fix issue where byref differences would not be highlighted
2018-01-04 14:01:17 -05:00
Matthew Brown
8a8253ac4c
Fix indentation
2018-01-02 21:23:48 -05:00
Matt Brown
13931766ce
Add PHP 7.2-compatibility for Psalm development
2018-01-02 19:55:07 -05:00
Matt Brown
e6aae2f2e2
Fix issue assigning string-typed properties without a string cast
2018-01-02 18:01:59 -05:00
Matt Brown
310f91ea81
Warn when methods with typehints don’t return for all codepaths
2018-01-02 16:57:40 -05:00
Matt Brown
fdff250c4a
Preserve keys when merging arrays
2018-01-02 12:59:22 -05:00
Matthew Brown
cc81d78dfd
Add code replacement api to allow Psalm to update arbitrary parts of the codebase
...
Fixes #264
2018-01-02 09:46:50 -05:00
Matthew Brown
81cfe09fae
Improve reporting of classlike locations in docblocks
2018-01-01 20:04:03 -05:00
Matthew Brown
a1247aeb60
Remove unused var
2018-01-01 12:13:32 -05:00
Matthew Brown
7418d6685f
Add PossibyInvalidFunctionCall, emitted when function call may not be valid
2018-01-01 12:00:02 -05:00
Matthew Brown
5afe3b10fa
Scan compoer autoload files before any sweep of code
2018-01-01 11:47:03 -05:00
Matthew Brown
290cf396d4
Remove unnecessary suppression
2017-12-31 13:12:19 -05:00
Matthew Brown
2d24f9e99d
Don’t complain about unused variables when they’re passed by reference
2017-12-30 09:30:02 -05:00
Matthew Brown
752e99ad2e
Reduce PossiblyUnusedParam false positives
2017-12-30 08:47:00 -05:00
Matthew Brown
f81642c1eb
Fix location of function param vars
2017-12-29 21:28:21 -05:00
Matthew Brown
37a3c0a81e
Avoid checking classes named Null, because PHP will complain
...
Ref #415
2017-12-29 19:45:32 -05:00
Matthew Brown
086b314df8
Cut down on interface PossiblyUnusedMethod reports
2017-12-29 19:38:01 -05:00
Matthew Brown
875bb8c072
Improve dead code detection, reducing false positives for params
2017-12-29 17:27:16 -05:00
Matthew Brown
8efc939a5f
Move Psalm execution code into PHP file that Psalm can analyse
2017-12-29 17:02:56 -05:00
Matthew Brown
0b58ee425d
Fix trait method evaluation order
2017-12-29 11:26:28 -05:00
Matthew Brown
c38cf9b672
Migrate type reconciliation code to its own class
2017-12-29 10:55:53 -05:00
Matthew Brown
81efe28f79
Fix #403 by complaining about return values in void functions
2017-12-28 21:49:03 +01:00
Matthew Brown
b96ab18d4b
Improve throw issue message
2017-12-28 21:35:25 +01:00
Matthew Brown
b8c349166e
Add InvalidCatch and InvalidThrow to prevent erroneous exceptions
...
Fix #411 and fix #412
2017-12-28 20:40:28 +01:00
Matthew Brown
dd0f046aee
Fix #410 - make sure anything inside a catch statement is treated as Throwable ( #413 )
2017-12-28 01:49:36 +01:00
Matthew Brown
becce4ae36
Use composer classmap where available to remove need for reflection of vendor classes
2017-12-28 00:56:10 +01:00
Matthew Brown
57592aca41
Fix #409 - PropertyNotSetInConstructor can be suppressed at the property level
2017-12-27 12:27:59 +01:00
Matthew Brown
e2e1094ec6
Fix #407 - improve treatment of array_merge unpacked args
2017-12-23 02:09:58 +01:00
Matthew Brown
ec92b40ed3
If class checking fails for storage reasons, don’t quit analysis
2017-12-23 01:26:08 +01:00
Matthew Brown
58c7aa74b4
Prevent recursion when analysing constructor property assignments
2017-12-23 01:01:59 +01:00
Matthew Brown
2f5b05887b
Promote CircularReference from exception to issue
2017-12-22 18:56:59 +01:00
Matthew Brown
c5ea5178e1
Remove unnecessary issue type
2017-12-22 16:09:56 +01:00
Matthew Brown
84260c5edc
Prohibit array pass by ref
2017-12-22 15:21:23 +01:00
Matthew Brown
714d0678b1
Fix file analysis after realpath fix
2017-12-19 13:08:47 -05:00
Matthew Brown
abc9c051a9
Improve analysis of constant arrays
2017-12-19 09:48:01 -05:00
Matthew Brown
53d887d356
Make sure nested lists get some sort of assignments
2017-12-18 23:13:18 -05:00
Matthew Brown
45fc9fd5d9
Check LHS of property when RHS is variable
2017-12-18 22:35:03 -05:00
Matthew Brown
ab3b8a0cf2
Make array{a:string} a subtype of array<string, string>
...
cc @weirdan
2017-12-18 20:08:45 -05:00
Matthew Brown
17edb2bbe6
Add better understanding of arrays with keyed integer offsets ( #400 )
...
* Add tests for keyed integer assignemnt
* First pass to get keyed integer assignment working
* Fix array assignment to object-like with different key type
* Improve treatment of objectlikes for callable and iterable comparisons
* Fix array assignment to strings and addition
* Convert expression to CNF
* Do better at merging property types
* Fix array_rand key type
2017-12-18 18:47:17 -05:00
Matt Brown
72da8f655a
Don’t stop analysis after mixed method call
2017-12-18 11:05:53 -05:00
Matt Brown
597ed0ed12
Fix #401 - don’t panic when checking generator against other types
2017-12-18 10:58:46 -05:00
Matthew Brown
4b0cee6142
Only complain about redundant conditions if there’s one negated clause
2017-12-18 00:47:36 -05:00
Matthew Brown
4ff26cdd8f
Fix RedundantCondition complaint when examining CNF queries
2017-12-18 00:39:00 -05:00
Matthew Brown
2ec09b26d2
Clone all types on assignment
2017-12-17 23:22:26 -05:00
Matthew Brown
3b7c84f484
Detect instances where loop invariants are invalidated
...
Fixes #389
2017-12-17 10:58:03 -05:00
Matthew Brown
c1ce543e81
Make sure to clear previously inferred types when rechecking trait statements
...
Fixes #399
2017-12-17 01:06:12 -05:00
Matthew Brown
ad67256be0
Remove more methods never called
2017-12-16 10:59:04 -05:00
Matthew Brown
2011b8fb8f
Remove dead code
2017-12-16 10:51:04 -05:00
Matt Brown
8ca5fbefea
Invalidate clauses when assigning root vars
2017-12-15 17:34:21 -05:00
Matt Brown
3b4a7a97bc
Don’t treat callmap scalar types as any sort of filtering mechanism
...
Fixes #393 and fixes #394
2017-12-15 16:48:06 -05:00
Tyson Andre
136d48f77c
Support @property-read and @property-write as new tags. ( #317 )
...
In combination with `@psalm-seal-properties`, this can be used to
have in-depth checking of magic properties.
2017-12-14 14:22:27 -05:00
Matt Brown
52c414f1d2
Fix return {expr} checks for void functions
2017-12-14 12:50:02 -05:00
Matt Brown
d440e4bbb1
Keep going after seeing a type coercion
2017-12-14 11:33:18 -05:00
Matt Brown
b319f54ff6
Fix issue with equality of scalar types not from docblock
2017-12-14 11:23:20 -05:00
Matthew Brown
dc65c14bc4
Fix properties fetches with self
2017-12-13 22:29:38 -05:00
Matthew Brown
34c133d5d0
Add for post conditions to assignment map analysis
2017-12-13 22:04:37 -05:00
Matthew Brown
298ee214e9
Only allow variables greater than a number to be non-null
2017-12-13 20:48:01 -05:00
Matthew Brown
e63441af1e
Make sure $a > 0 removes null from $a
...
Fixes #186
2017-12-13 20:06:19 -05:00
Matthew Brown
e55fe2f158
Don’t complain about possibly undefined vars when calling unset
...
Fixes #139
2017-12-13 19:46:58 -05:00
Matt Brown
dd11a792fd
Add trailing commas
2017-12-13 15:57:10 -05:00
Matt Brown
4b8c242f5d
Create fake get_class/gettype statements where necessary
2017-12-13 15:56:05 -05:00
Matt Brown
51a2f12bbf
Only update inner loop vars that have changed given preconditions
2017-12-11 12:03:50 -05:00
Matt Brown
301e393e37
Remove resource and callable from falsy checks
2017-12-11 11:32:14 -05:00
Matthew Brown
146cb12277
Refine function arguments if they match non-docblock equivalents
2017-12-10 21:14:30 -05:00
Matthew Brown
46feaaf1c6
Don’t run try/catch analysis twice
2017-12-10 20:21:21 -05:00
Matthew Brown
a2d5bc59ad
Get rid of undefined variable issues
2017-12-10 18:34:22 -05:00
Matthew Brown
db72ef29d8
Fix type reassignment in catches
2017-12-10 18:09:38 -05:00
Matthew Brown
f8207fe490
Improve handling of try/catch blocks, suppressing RedundantCondition where necessary
...
Fixes #355
2017-12-10 17:36:33 -05:00
Matthew Brown
a413e0496a
Fix #361 by terminating analysis if loop statements have issues
2017-12-10 16:22:45 -05:00
Matthew Brown
31ce716647
Widen empty array checks
2017-12-10 16:17:27 -05:00
Matthew Brown
c95af0bb57
Fix issue with assigning empty type
2017-12-10 14:56:51 -05:00
Matthew Brown
a345ec49a1
Fix is_bool checks on true vars
2017-12-09 16:05:31 -05:00
Matthew Brown
42dcd136ca
Improve treatment of true and fix #369
2017-12-09 15:51:38 -05:00
Matthew Brown
13f290038a
Improve RedundantCondition checks and add true type
...
Fixes #383
2017-12-09 14:53:39 -05:00
Matt Brown
bfccdb417f
Pass through ignore_nullable_issues flag when verifying return statements
2017-12-07 16:08:09 -05:00
Matt Brown
eca7351472
Add return-level issues as well as function-level ones
...
Fixes #379
2017-12-07 15:50:25 -05:00
Matthew Brown
2a7b48ce5f
Add support for infinite loops
...
Fixes #381
2017-12-06 23:46:41 -05:00
Matt Brown
6c84fecce9
Always update the parent context from the loop context
...
Fixes #377
2017-12-06 19:20:24 -05:00
Matthew Brown
e08b11b144
Improve TemplateChecker
2017-12-06 01:05:51 -05:00
Matthew Brown
0eedad4f6a
Add UndefinedGlobalVariable issue and asssociated Possibly... one
2017-12-06 00:56:00 -05:00
Matthew Brown
a87a1f0dc9
Make sure undeclared array offset vars have type mixed
...
Fixes #360
2017-12-06 00:35:41 -05:00
Matthew Brown
df90d72ad1
Emit return type errors at the function itself, not its parent
...
Fixes #363
2017-12-06 00:11:05 -05:00
Matthew Brown
59b50bdcdd
Add proper types for magic constants
...
Fixes #362
2017-12-06 00:05:01 -05:00
Matthew Brown
52fc81e4ab
Remove need for a __toString return type
...
Fixes #364
2017-12-05 23:47:50 -05:00
Matt Brown
d10898b853
Remove code that only caused pain
2017-12-05 16:54:24 -05:00
Matt Brown
e2b1b24dbf
Fix empty checks, make them more like isset checks
...
Fixes #372
2017-12-05 12:14:10 -05:00
Matt Brown
98085b2267
Fix #371 - improve handling of do statements broken in loop refactor
2017-12-05 11:05:10 -05:00
Matthew Brown
a8a1489a8f
Fix closure naming convention so it doesn’t confuse method id checks
2017-12-05 01:47:49 -05:00
Matt Brown
1f57881310
Break out PossiblyNullArrayOffset and NullArrayOffset from InvalidArrayOffset
2017-12-04 11:20:31 -05:00
Gerrit Addiks
de09bd846c
Fixes #367 ; Added missing declaration for var_comment variable in ForEachChecker ( #368 )
2017-12-04 08:50:59 -05:00
Matthew Brown
8abd77c70f
Revert to from_docbblock status of outer loop
2017-12-04 00:13:46 -05:00
Matthew Brown
0134d7bf5c
Keep track of referenced loop vvars
2017-12-03 23:50:51 -05:00
Matthew Brown
69ca6bd0a0
Get LHS clauses of && expression after evaluation
2017-12-03 18:33:54 -05:00
Matthew Brown
02dcb2be95
Get or LHS clauses after evaluating statements
2017-12-03 18:22:25 -05:00
Matthew Brown
f5ca4b1c52
Also remove var from clauses when updating
2017-12-03 17:36:50 -05:00
Matthew Brown
6843dfb7fc
Remove from_docblock status if we make a successful method call
2017-12-03 17:21:20 -05:00
Matthew Brown
7d003c5bc1
Fix erroneous treatment of or clauses in if statements
2017-12-03 16:25:52 -05:00
Matthew Brown
181d1bb129
Don’t complain about redundant conditions for possibly undefined vars
2017-12-03 15:00:59 -05:00
Matthew Brown
cb4691fb44
Always set templated types as being from docblocks
2017-12-03 13:22:06 -05:00
Matthew Brown
cff7f35d00
Change __toString type conversions to more precise getId checks
2017-12-03 12:44:08 -05:00
Matthew Brown
cb9079ca88
Improve generic param replacement
2017-12-03 11:23:40 -05:00
Matthew Brown
be3212eb42
Remove conflicting clauses from switch assertions
2017-12-03 00:58:24 -05:00
Matthew Brown
9a83990053
Clear clauses made redundant by pre-loop assignments
2017-12-02 20:02:29 -05:00
Matthew Brown
d20b8d3034
Improve loop analysis ( #365 )
2017-12-02 18:28:18 -05:00
Matthew Brown
ed626db553
Widen switch redefined vars if defined in each case
2017-12-02 18:06:21 -05:00
Matthew Brown
cfeb4c2586
Simplify vars_possibly_in_scope types
2017-12-02 13:32:20 -05:00
Matt Brown
062d46c132
Update to latest php-cs-fixer
2017-11-30 19:00:09 -05:00
Matthew Brown
888b5dae00
Move LoopChecker into its own file
2017-11-30 01:07:20 -05:00
Matthew Brown
2b34fa0cd0
Fix #357 by passing right set of issues to FunctionLikeChecker::compareMethods
2017-11-30 00:07:36 -05:00
Matthew Brown
52f9225356
Add separate issues for implemented return type mismatch
2017-11-30 00:01:41 -05:00
Matthew Brown
0ea6540018
Fix #358 , don’t emit PropertyNotSetInConstructor on public final classes/methods
2017-11-29 23:46:56 -05:00
Matthew Brown
0c2b2b69b3
Fix #348 - allow signature return types to be non-nullable if parent is nullable
2017-11-28 23:09:09 -05:00
Matthew Brown
f4212d897c
Fix erroneous empty array creation in SwitchChecker
...
Fixes #354
2017-11-28 22:33:37 -05:00
Matthew Brown
6c9d90850a
Don’t complain when there are duplicate clauses if due to an assignment
...
Fixes #356
2017-11-28 22:17:03 -05:00
Matt Brown
1173dcc6a2
Don’t stop reconciling types when encountering problem
2017-11-28 17:42:00 -05:00