Matthew Brown
d0fc48cfaf
Remove unnecessary whitespace
2018-03-15 00:37:08 -04:00
Matt Brown
822d0a116e
Reflect all numeric types passed to abs
...
Fixes #576
2018-03-14 18:05:36 -04:00
Matt Brown
d9ab5e62d6
Prevent unnecessary warnings when checking trait-required methods
2018-03-14 10:51:13 -04:00
Matt Brown
0bd229a86f
Add better checks for trait-related fatal errors
2018-03-13 18:12:05 -04:00
Matt Brown
0637e02a6d
Fix build bug
2018-03-13 13:50:53 -04:00
Matt Brown
52b6a5cbde
Fix #571 - fix buggy handling of packed vars
2018-03-13 13:50:41 -04:00
Matt Brown
ef35cfc6fe
Fix #566 - check for abstract methods inheriting from non-abstract ones
2018-03-13 12:52:00 -04:00
Matthew Brown
5cd8b3cccd
Don’t ignore @function calls
...
Fixes #570
2018-03-12 23:48:10 -04:00
Matthew Brown
73fadab0b5
Make Phar more robust to object namespace changes
2018-03-12 00:01:52 -04:00
Matt Brown
b54fb06552
Handle variable paths in a less naive fashion
...
Fixes #564
2018-03-08 15:57:46 -05:00
Matt Brown
19ee843d6c
Emit InvalidOperand if both sides are not numeric
2018-03-08 14:30:40 -05:00
Matt Brown
56bdb924f5
Fix #563 - improve error message and ignore falsable issues for strtotime
2018-03-08 14:04:00 -05:00
Matt Brown
4873228e52
Fix #561 - add all the do-defined vars before checking loop
2018-03-08 11:17:27 -05:00
Matt Brown
cd521e7ba5
Also flesh out object like array types
2018-03-07 13:54:46 -05:00
Matt Brown
4bf652863b
Also check for non-false returns on LessSpecificReturnType
2018-03-07 11:16:56 -05:00
Matt Brown
4248cacbaf
Flesh out template type before replacing
2018-03-06 14:23:41 -05:00
Matt Brown
6d767de043
Ignore nullable class strings where appropriate
2018-03-06 14:11:32 -05:00
Matt Brown
fac5554e13
Fix errors around static class constants in template vars
2018-03-06 13:59:59 -05:00
Matt Brown
b664c85642
Add new issue conditional on config flag
2018-03-06 12:19:50 -05:00
Matt Brown
357ad1aa82
Add config flags to allow stricter class invocation checks
2018-03-06 11:20:59 -05:00
Matt Brown
57bbdc8034
Replace classlike name with more accurate context self
2018-03-05 18:05:12 -05:00
Matt Brown
7c5986de01
Add return type checks for missing classes
2018-03-05 17:46:13 -05:00
Matt Brown
aff689deea
Add support for __CLASS__ in template types
2018-03-05 17:36:08 -05:00
Matt Brown
57c2adb923
Fix #558 - add extra tests around functionality
2018-03-05 17:10:52 -05:00
Matt Brown
850998ed1a
Add class-string type for enforcing use of ::class constants
2018-03-05 16:06:06 -05:00
Matt Brown
d8825701f5
Fix #556 - closure params with defaults can still accept extra
2018-03-05 10:29:19 -05:00
Matthew Brown
a0be2e390a
Fix case of mapping function before analysis
2018-03-05 09:05:38 -05:00
Matthew Brown
67cad2063d
Fix #555 - fix function name mapping class
2018-03-05 09:01:24 -05:00
Matthew Brown
806b032b13
Downgrade UndefinedMethod to PossiblyUndefinedMethod issue when one type has __call defined
2018-03-04 13:23:40 -05:00
Matthew Brown
a0ce8791d3
Detect fatal issues where property access is overridden
...
Fixes #547
2018-03-04 12:24:50 -05:00
Matthew Brown
3b48f43fdc
Throw exception if function doesn’t exist
2018-03-03 16:52:48 -05:00
Matthew Brown
ecef628e21
Prevent iterating over undefined class
2018-03-03 16:52:04 -05:00
Matthew Brown
9fe4a97851
Fix issue with do
2018-03-03 13:21:52 -05:00
Matthew Brown
e419a8fe01
Exit early when there’s an issue in block-level elements
...
Fixes #550
2018-03-03 13:20:41 -05:00
Matt Brown
276c1a785d
Allow underscores to be ignored by UnusedParam checks
2018-03-02 11:32:34 -05:00
Matthew Brown
d94abc42e8
Fix array location
2018-03-02 08:38:16 -05:00
Matthew Brown
ee6a9b98fb
Allow arrays to be called (ugh)
2018-03-02 00:49:53 -05:00
Matthew Brown
154341577d
Give expected/actual argument counts
2018-03-02 00:07:19 -05:00
Matthew Brown
799e81bc96
Improve callable issue message
2018-03-02 00:03:07 -05:00
Matthew Brown
6fbd8753d5
Fix $function_id when checking for method existence
2018-03-01 23:52:11 -05:00
Matthew Brown
cc19f50c04
Prevent missing classes from confounding callable arg checks
2018-03-01 23:43:52 -05:00
Matthew Brown
6660aa8a00
Fix #548 - check array_map/array_filter args for param matches
2018-03-01 23:33:21 -05:00
Matt Brown
80864b1ce8
Don’t be concerned about unused params named $_
...
Fixes #540
2018-02-27 11:39:26 -05:00
Matt Brown
1f358e36ef
Fix #544 - remove possibly assigned try vars from catch initialisations
2018-02-27 11:25:27 -05:00
Matthew Brown
115e647c3c
Fix #543 - register static vars properly so their references can be caught
2018-02-26 19:32:26 -05:00
Matt Brown
30c6aa5c68
Add missing spaces
2018-02-26 11:09:17 -05:00
Matt Brown
93b714d7c8
Fix #541 - make array_map on object-like more accurate
2018-02-26 11:01:30 -05:00
Matt Brown
9d165bee7b
Fix generic return type for array_map
...
Ref #541
2018-02-26 10:39:48 -05:00
Matthew Brown
47cb74ddd1
Fix issue where namespaced function could be treated as root
2018-02-25 11:13:00 -05:00
Matthew Brown
956972b4a4
Fix #539 - evaluate global variable usage
2018-02-25 10:43:54 -05:00
Matt Brown
ad3fe0974f
Fix indentation
2018-02-23 15:41:07 -05:00
Matt Brown
441506ad6f
Fix #216 - scan assert* functions for assertions, then apply to current context
2018-02-23 15:39:33 -05:00
Matt Brown
25400e8010
Simplify logic to avoid Psalm bug
2018-02-22 11:57:15 -05:00
Matt Brown
1f7d95dde0
Add better typing rules for generic objects
2018-02-22 11:20:03 -05:00
Matt Brown
09d708981a
Add mixed checks to property __set calls
2018-02-21 19:34:21 -05:00
Matt Brown
5471b89391
Make array coercion an error
2018-02-21 18:59:31 -05:00
Matt Brown
a81c73301b
Warn early if the file being analysed has not been properly scanned
2018-02-21 13:54:11 -05:00
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
Matt Brown
252fa8da78
Fix #346 by making a change in from_docblock invalidate clauses
2017-11-28 17:27:19 -05:00
Matt Brown
33f003f427
Don’t complain about repeat isset calls on array keys
...
Fixes #347
2017-11-28 16:52:52 -05:00
Matthew Brown
4b7d4f9015
Don’t worry about !null either
2017-11-28 02:01:21 -05:00
Matthew Brown
018843fe65
Prevent empty type array when evaluating !falsy
2017-11-28 01:59:18 -05:00
Matthew Brown
e0cea0017c
Add more stringent checks when surfacing RedundantCondition
2017-11-28 01:40:55 -05:00
Matthew Brown
f27bd50abe
Add RedundantCondition issue, replacing FailedTypeResolution ( #344 )
...
* Group changes
* Don’t worry about vars defined before exiting
* Fix issues with vars defined in conditionals
* Add failing test
* Only add failed reconciliation flag if nothing could be salvaged
* Avoid notice when removing clauses
* Improve handling of loops
* Fix evaluation of binary op expressions
* Remove unset vars from outer context after loop
* Ignore RedundantCondition in some more configs
2017-11-28 00:46:41 -05:00
Matthew Brown
f16642dad2
Better switch analysis ( #343 )
...
* Experiment with good switch analysis
* Improve switch accuracy at expense of some processor cycles
* Evaluate switch case expression in case context
2017-11-28 00:25:21 -05:00
Matt Brown
8fff59f7de
Fix union of intersection types
2017-11-27 19:15:01 -05:00
Matt Brown
b8b1169a03
Consolidate intersection type checks in one place
2017-11-27 18:07:38 -05:00
Matt Brown
bd22f9425c
Fix #175 - support interface intersection types with other interfaces
2017-11-27 16:49:59 -05:00
Matt Brown
a6f3781452
Fix #340 - give up with mixed type when accessing unknown key on objectlike
2017-11-27 12:01:23 -05:00
Matt Brown
8b0d99e28b
Fix extending of core classes that do bad things
2017-11-27 11:43:06 -05:00
Matthew Brown
afcbc113c9
Fix #228 , fix #336 by improving checking of inherited signatures
2017-11-26 16:03:17 -05:00
Matthew Brown
18cf05e087
Always keep track of assigned var ids
2017-11-25 11:21:45 -05:00
Matthew Brown
18e68a60de
Fix #334 by allowing interfaces as foreach args to be correctly interpreted
2017-11-24 12:57:00 -05:00
Matthew Brown
c86e73ddb6
Always keep track of referenced var ids
...
which we can use for analysis elsewhere
2017-11-24 12:17:28 -05:00
Matthew Brown
4312ef380b
Fix issues found by improved Psalm checks
...
cc @TysonAndre, found with RedundantCondition checks
2017-11-24 12:10:30 -05:00
Matthew Brown
fd3de443b2
Update loop with union of existing types
2017-11-21 22:13:46 -05:00
Matthew Brown
df06c64b3e
Allow suppression of InvalidToString
2017-11-21 21:53:12 -05:00
Matthew Brown
e3b688b06d
Fix #316 - self resolves to proper class
2017-11-21 21:50:39 -05:00
Matthew Brown
0c917f632d
Also check for non-scalar types in reconciliation
2017-11-21 21:00:06 -05:00
Matthew Brown
b1a35d6a6e
Remove numeric types with !is_numeric check, fix #330
2017-11-21 20:58:08 -05:00
Matthew Brown
ad74563327
Improve handling of switch statements with default cases
2017-11-20 20:39:27 -05:00
Matt Brown
60c9f1ca96
Ignore socket_select when assigning byref params
2017-11-20 17:34:32 -05:00
Matt Brown
a069cf4ea9
Don‘t turn a string into an array|string by accident
2017-11-20 17:10:05 -05:00
Matt Brown
0c2ea418e3
Fix #327 - prevent null array value from killing assignment
2017-11-20 16:19:40 -05:00
Matt Brown
a206e3dbc9
Pay attention to ignore_nullable_issues when comparing types
2017-11-20 13:31:30 -05:00
Matt Brown
f46fd0b79f
Fix array access on objects
2017-11-20 11:49:26 -05:00
Matthew Brown
957600623c
Fix issue with byref template params leaking
2017-11-20 00:12:17 -05:00
Matthew Brown
ccc0583bf8
Fix issue with bad assign after array_pop/array_shift
2017-11-19 23:46:32 -05:00
Tyson Andre
cea5dca5dc
Allow using nullable shorthand (?
) within an array ( #326 )
2017-11-19 23:36:37 -05:00
Matthew Brown
ae799da8d0
Add root array var when updating array key type in if
2017-11-19 23:25:14 -05:00
Matthew Brown
5698b2d363
Update root var with more accurate object-like type
2017-11-19 22:28:52 -05:00
Matthew Brown
90bcd99eab
Fix issue where array_shift/array_pop didn’t mark array as modified
2017-11-19 21:36:09 -05:00
Matthew Brown
8b2df09f0f
Fix issue with object-like reassignment
2017-11-19 21:24:29 -05:00
Matthew Brown
3418eb494a
Always set a fallback mixed type on a mixed property fetch
2017-11-19 14:58:48 -05:00
Matthew Brown
8d62fc8ad1
Only update array type if it doesn’t have an object
2017-11-19 14:38:00 -05:00
Matthew Brown
f18616b2f9
Provide fallback if array keys not found
2017-11-19 14:23:39 -05:00
Matthew Brown
95429b7037
Fix invalid assignment to Union
2017-11-19 14:09:20 -05:00
Matthew Brown
942bc0a663
Add new MixedTypeCoercion issue, fixes #320
2017-11-19 13:42:48 -05:00
Matthew Brown
75b6e21801
Fix #315 - improve checking of object-like arrays in function params
2017-11-19 13:05:35 -05:00
Matthew Brown
5ff4badf33
Refactor array analysis to improve reliability and accuracy ( #325 )
2017-11-19 12:33:43 -05:00
Matthew Brown
1a39224abc
Fix issues that improved array checks found
2017-11-19 12:14:02 -05:00
Matt Brown
39baa00fd3
Fix issue with nested object-like array updating
2017-11-17 16:33:36 -05:00
Tyson Andre
1c25ca1a0c
Fix false positives, add tests of @psalm-seal-properties
( #318 )
2017-11-17 16:19:48 -05:00
Matt Brown
2a96e323e7
Fix assignment to arrays after object-like
2017-11-17 12:27:16 -05:00
Matt Brown
3f324141ef
Fix error message when changing keys
2017-11-17 11:43:06 -05:00
Matt Brown
6710fd4231
Fix double mixed issue with array offsets
2017-11-17 11:32:12 -05:00
Matthew Brown
a08306973a
Fix #302 - add a way to seal objects with magic properties
2017-11-16 20:47:58 -05:00
Matthew Brown
440db3be89
Fix #313 - correctly analyse closure self return types
2017-11-16 20:06:00 -05:00
Matthew Brown
7d33db0d19
Fix issue with array unification after scanning
2017-11-16 01:11:46 -05:00
Matthew Brown
36a760657d
Fix #311 and introduce PossiblyInvalidArrayOffset
2017-11-16 00:27:11 -05:00
Matthew Brown
6c9cdd896b
Separate InvalidArrayAccess and InvalidArrayOffset
2017-11-15 21:10:07 -05:00
Matthew Brown
abe7c003ab
Fix #309 - borrowing fix from @TysonAndre
2017-11-15 20:45:53 -05:00
Matt Brown
bce8bdb46e
Ignore traversable, iterable etc for RawObjectIteration
2017-11-15 12:09:13 -05:00
Matt Brown
4ff9ec2853
Don’t warn about traversable objects
2017-11-15 11:58:46 -05:00
Matt Brown
a99135c4d0
Fix #300 - add PossiblyInvalidPropertyFetch
2017-11-15 11:44:13 -05:00
Matt Brown
c5faa2d06a
Fix #299 - add PossiblyInvalidMethodCall
2017-11-15 11:34:40 -05:00
Matt Brown
9111b1c725
Fix #301 - add PossiblyInvalidPropertyAssignment
2017-11-15 11:15:03 -05:00
Matthew Brown
f96f3a467d
Fix #296 - add issue for raw object iteration
2017-11-14 22:55:48 -05:00
Matthew Brown
2e6b93e4d0
Fix #289 , make inferred type of yield from expressions mixed
2017-11-14 22:29:15 -05:00
Matthew Brown
3ade4b9559
Fix #293 , be case invariant to self & static
2017-11-14 21:56:29 -05:00
Matthew Brown
b2ae9a2892
Fix #291 , #292 and #297 by improving docblock parsing
2017-11-14 21:43:31 -05:00
Matthew Brown
160a95a8bf
Fix too-long line
2017-11-13 21:21:54 -05:00
Matt Brown
7e8ae33d56
Fix #288 - get rid of MethodSignatureMismatch issues where PHP doesn’t worry
2017-11-13 16:31:33 -05:00
Tyson Andre
d9a142ac7d
Fix incorrect strpos argument order ( #287 )
...
Detected via static analysis
2017-11-11 21:48:43 -05:00
Matthew Brown
a0a9128375
Fix #285 - add PossiblyInvalidArrayAccess
2017-11-11 21:22:11 -05:00
Matthew Brown
4f2a200b45
Fix #283 - add more refined PossiblyUndefinedMethod check
2017-11-11 14:53:35 -05:00
Matthew Brown
2f1e3652b7
Fix #274 - improve array addition inference for objectlike arrays
2017-11-11 14:19:57 -05:00
Matthew Brown
126fd9a3a1
Fix #286 - ignore terrible param types
2017-11-11 11:28:49 -05:00
Matthew Brown
0ea48752d1
Fix #284 - allow __get calls inside class if property undefined
2017-11-11 01:17:10 -05:00
Matt Brown
59265ef2bf
Fix #276 - fix false positive in magic call
2017-11-10 18:08:26 -05:00
Matt Brown
e49573e7f6
Fix #279 - make sure referenced vars updated always in or
2017-11-09 16:42:39 -05:00
Matt Brown
ff5ea32ea3
Fix #277 - infer stdClass from object cast
2017-11-09 15:58:09 -05:00
Tyson Andre
e2dd3db70f
Fix phpdoc in psalm's codebase referring to missing params. ( #273 )
...
Also, don't use `@return self` in __construct, it returns void.
2017-11-08 23:32:22 -05:00
Matthew Brown
765d82548d
Remove more dead code
2017-11-08 23:27:51 -05:00
Tyson Andre
b3505cfbef
Get rid of unused variables in psalm's codebase ( #272 )
...
* Remove unused variables
* Fix more unused variables
* Fix remaining detected undefined variables
Other 20 detected undefined variable warnings were false positives.
2017-11-08 23:14:27 -05:00
Matthew Brown
a7b32beb4e
Add better checks for array_rand’s signature
2017-11-08 21:56:54 -05:00
Matthew Brown
dd86513fc5
Fix #271 - remove invalid complaint about private overridden method
2017-11-08 21:27:23 -05:00
Matt Brown
750d18d20a
Fix #266 - do better analysis of array_rand
...
And also have better fallback when accessing string key on object-like array
2017-11-07 17:38:54 -05:00
Matt Brown
e0371aed62
Introduce file manipulation concept to plugins
2017-11-07 14:46:53 -05:00
Matt Brown
490e78e136
Add isset check for safety
2017-11-06 15:42:39 -05:00
Matt Brown
97de8f7684
Allow Psalm to check static call LHS vars
2017-11-06 15:37:49 -05:00
Matt Brown
4b573bde1f
Fix get_class($e) !== checks
2017-11-06 12:04:38 -05:00
Matt Brown
81493a639e
Add more robust property assignment when property not defined
2017-11-03 12:27:01 -04:00
Matthew Brown
a651fad6f0
Fix #263 - add support for @psalm-param and @psalm-var annotations
2017-11-02 21:45:17 -04:00
Matt Brown
b163c296ff
Fix templated return types in traits
2017-11-02 15:07:39 -04:00
Matthew Brown
aeb9882281
Add back support for TObject property fetch
2017-10-29 17:44:13 -04:00
Matthew Brown
35e6cf8108
Change MissingInclude to MissingFile
2017-10-29 17:36:02 -04:00
Matthew Brown
afc8cb4068
Check for property fetch mocks
2017-10-29 17:33:26 -04:00
Matthew Brown
b618bd798d
Add new issues for missing required files
2017-10-29 14:39:23 -04:00
Matthew Brown
51280c1670
Allow byref args of socket_select to pass through unchanged
2017-10-28 16:26:45 -04:00
Matthew Brown
24980cd7d7
Constrain user-defined functions and methods
2017-10-28 16:05:35 -04:00
Matthew Brown
45df0292b1
Never constrain by-ref array variables
2017-10-28 15:33:29 -04:00
Matthew Brown
bee14d184f
Add better check for property
2017-10-28 15:17:32 -04:00
Matthew Brown
30acb9e3b7
Improve array function byref understanding by hard-coding rules
2017-10-28 13:56:29 -04:00
Matt Brown
8b7d82ddf6
Fix #2 - suppress errors for single lines
2017-10-26 18:19:19 -04:00
Matt Brown
d06e844748
Fix issue simplifying callable types
2017-10-26 16:05:57 -04:00
Matt Brown
897c70f8f5
Add back support for switch-getclass ::class constants
2017-10-26 15:07:36 -04:00
Matthew Brown
122b354c4c
Ignore get_class and instanceof checks for arbitrary classes in traits
2017-10-24 00:01:43 -04:00
Matthew Brown
467bbba593
Prevent falsy values from leaking into the type system
2017-10-23 22:04:07 -04:00
Matt Brown
c850ef644d
Add PossiblyFalseReference and PossiblyFalseArgument issues
...
Useful for catching error cases
2017-10-23 11:47:00 -04:00
Matthew Brown
a34de5b79c
Fix #257 - prevent collapsing callable into string
2017-10-23 08:00:28 -04:00
Matthew Brown
e41e1fa57d
Fix #256 - don’t crash when encountering types that match one another
2017-10-23 07:35:28 -04:00
Matthew Brown
2c18686c8c
Fix #247 - allow is_callable checks on array
2017-10-22 21:07:06 -04:00
Matthew Brown
a85cd1db8a
Add support for get_class and get_type negation checks
2017-10-22 20:17:04 -04:00
Matthew Brown
4d32c72ef8
Fix #250 and fix #255 - handle switch statements like PHP does
2017-10-22 19:53:53 -04:00
Matthew Brown
c7d55bf6de
Improve aseertion finding by digging deeper into trivial comparisons
2017-10-22 19:11:28 -04:00
Matthew Brown
f9032924e6
Allow == true comparisons to be evaluated to !falsy
2017-10-22 12:09:22 -04:00
Matthew Brown
f6e01b5925
Change empty type assertions to "falsy"
...
As empty has a special meaning
2017-10-22 11:57:41 -04:00
Matt Brown
3c6a8a0b24
Fix #251 - allow Psalm to analyse Wordpress
2017-10-19 19:19:29 -04:00
Matt Brown
c395930a06
Fix missing function issue ref #251
2017-10-19 18:23:18 -04:00
Matthew Brown
295792d550
Fix #235 - add psalm.xml option to support igbinary serializer
2017-10-15 12:38:47 -04:00
Matthew Brown
657d154288
CacheProvider -> ParserCacheProvider
2017-10-15 11:57:44 -04:00
Matthew Brown
38c8a1d9cf
Stop analysing statements if expression has errors
2017-10-12 20:24:22 -04:00
Matthew Brown
b7f6d15a24
Don’t freak out over incorrectly-cased classes
2017-10-12 19:53:12 -04:00
Matthew Brown
1b7a5c2944
Fix #236 - incorrect operand issue text
2017-10-12 08:51:57 -04:00
Matthew Brown
deb489e82d
Fix #232 - discard clauses when evaluating catch block
2017-10-10 23:09:19 -04:00
Matthew Brown
862d22e83c
Fix #230 - invalidate root vars on $arr[]= assignment
2017-10-10 23:01:52 -04:00
Matthew Brown
beea51d7bf
Fix property check
2017-10-07 15:05:05 -04:00
Matthew Brown
cbc889a498
Add cache-clearing mechanism
2017-10-07 14:41:16 -04:00
Matthew Brown
e47198b326
Add workaround for Psalm checking itself on PHP 5.6
2017-10-07 11:38:51 -04:00
Matthew Brown
9774131876
Fix #224 - explicit string casts fail when no __toString present
2017-10-07 11:27:54 -04:00
Matthew Brown
483b4c75f3
Fix #223 - array_map with too few args should have issue
2017-10-07 10:33:19 -04:00
Matthew Brown
6b4bd47ddb
Fix #181 and #225 - resolve problems with self in comments/return statements
2017-10-07 10:22:52 -04:00
Matthew Brown
1cc13bdeeb
Prevent TNamedObject from having a leading slash
2017-10-06 23:35:16 -04:00
Matthew Brown
5bd6228708
Fix #220 - don’t worry about parent property access
2017-09-24 08:17:27 -04:00
Matt Brown
6f911c7386
Emit more specific operand issues
2017-09-20 11:22:17 -04:00
Matthew Brown
e42e590442
Add more descriptive exception messages
2017-09-20 08:43:54 -04:00
Matthew Brown
1a9592fc62
Fix #215 where ReflectionMethod implementing class is not a parent class or parent interface
2017-09-19 23:35:37 -04:00
Matt Brown
d380bf3f19
Fix #209 - fix issue with file load order results change
2017-09-18 16:10:08 -04:00
Matthew Brown
e84586cfaa
Fix return type space issue
2017-09-16 15:08:11 -04:00
Matthew Brown
7c261d7d1f
Add return after every special type
2017-09-16 15:00:50 -04:00
Matthew Brown
391696bc83
Use a blacklist, not a whitelist
2017-09-16 13:28:33 -04:00
Matthew Brown
3a8efec728
Add error for pass by reference
2017-09-16 13:16:21 -04:00
Matthew Brown
fc6b663c8a
Only write files if they’re changed
2017-09-16 12:52:46 -04:00
Matthew Brown
9a3cb742cb
Refactor docblock manipulation and add tests for it
2017-09-16 12:45:20 -04:00
Matthew Brown
995e92a8c3
Remove empty if block
2017-09-14 00:36:38 -04:00
Matthew Brown
2a4a6fc490
Exit early if checking iterable for methods
2017-09-14 00:32:14 -04:00
Matthew Brown
313e1c383c
Fix edge-case issue with abstract class not fully implementing interface
2017-09-13 23:57:11 -04:00
Matt Brown
5b3531b5a5
Fix null coalescing on nullable output
2017-09-13 14:35:42 -04:00
Matt Brown
eee8442af6
Fix #199 - allow classes to suppress PropertyNotSetInConstructor warnings
2017-09-13 11:32:13 -04:00
Matt Brown
439a1ddc97
Exit early if a bad class is detected
2017-09-11 11:58:11 -04:00