Matthew Brown
c5ea5178e1
Remove unnecessary issue type
2017-12-22 16:09:56 +01: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
Matthew Brown
2ec09b26d2
Clone all types on assignment
2017-12-17 23:22:26 -05:00
Matthew Brown
2011b8fb8f
Remove dead code
2017-12-16 10:51:04 -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
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
59b50bdcdd
Add proper types for magic constants
...
Fixes #362
2017-12-06 00:05:01 -05:00
Matt Brown
e2b1b24dbf
Fix empty checks, make them more like isset checks
...
Fixes #372
2017-12-05 12:14: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
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
Matt Brown
062d46c132
Update to latest php-cs-fixer
2017-11-30 19:00:09 -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
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
5ff4badf33
Refactor array analysis to improve reliability and accuracy ( #325 )
2017-11-19 12:33:43 -05:00
Matthew Brown
440db3be89
Fix #313 - correctly analyse closure self return types
2017-11-16 20:06:00 -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
2f1e3652b7
Fix #274 - improve array addition inference for objectlike arrays
2017-11-11 14:19:57 -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
Matthew Brown
765d82548d
Remove more dead code
2017-11-08 23:27:51 -05:00
Matt Brown
e0371aed62
Introduce file manipulation concept to plugins
2017-11-07 14:46:53 -05:00
Matthew Brown
45df0292b1
Never constrain by-ref array variables
2017-10-28 15:33:29 -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
f6e01b5925
Change empty type assertions to "falsy"
...
As empty has a special meaning
2017-10-22 11:57:41 -04:00
Matthew Brown
1b7a5c2944
Fix #236 - incorrect operand issue text
2017-10-12 08:51:57 -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
9774131876
Fix #224 - explicit string casts fail when no __toString present
2017-10-07 11:27:54 -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
Matt Brown
6f911c7386
Emit more specific operand issues
2017-09-20 11:22:17 -04:00
Matt Brown
5b3531b5a5
Fix null coalescing on nullable output
2017-09-13 14:35:42 -04:00
Matthew Brown
e89a2929d5
Infer types from numeric operations
2017-09-06 21:44:26 -04:00
Matthew Brown
9f9e8a1b30
Improve API for inference
2017-09-03 20:52:54 -04:00
Matthew Brown
11aa3558b7
Make sure encapsulated strings can also coerce param types
2017-09-02 19:48:59 -04:00
Matthew Brown
a0c27cee4f
Allow param types to be inferred from presence of concat ops
2017-09-02 19:23:00 -04:00
Matthew Brown
4175295113
Isolate where we load static storage objects ( #195 )
...
* Move FileChecker::$storage calls to provider
* Add ClassLikeStorageProvider
* Use ClassLikeStorageProvider everywhere
* Move storage arrays into providers
2017-07-29 15:05:06 -04:00
Matthew Brown
e29dd140e3
Refactor scanning and analysis, introducing multithreading ( #191 )
...
* Add failing test
* Add visitor to soup up classlike references
* Move a whole bunch of code into the visitor
* Move some methods back, move onto analysis stage
* Use the getAliases method everywhere
* Fix refs
* Fix more refs
* Fix some tests
* Fix more tests
* Fix include tests
* Shift config class finding to project checker and fix bugs
* Fix a few more tests
* transition test to new syntax
* Remove var_dump
* Delete a bunch of code and fix mutation test
* Remove unnecessary visitation
* Transition to better mocked out file provider, breaking some cached statement loading
* Use different scheme for naming anonymous classes
* Fix anonymous class issues
* Refactor file/statement loading
* Add specific property types
* Fix mapped property assignment
* Improve how we deal with traits
* Fix trait checking
* Pass Psalm checks
* Add multi-process support
* Delay console output until the end
* Remove PHP 7 syntax
* Update file storage with classes
* Fix scanning individual files and add reflection return types
* Always turn XDebug off
* Add quicker method of getting method mutations
* Queue return types for crawling
* Interpret all strings as possible classes once we see a `get_class` call
* Check invalid return types again
* Fix template namespacing issues
* Default to class-insensitive file names for includes
* Don’t overwrite existing issues data
* Add var docblocks for scanning
* Add null check
* Fix loading of external classes in templates
* Only try to populate class when we haven’t yet seen it’s not a class
* Fix trait property accessibility
* Only ever improve docblock param type
* Make param replacement more robust
* Fix static const missing inferred type
* Fix a few more tests
* Register constant definitions
* Fix trait aliasing
* Skip constant type tests for now
* Fix linting issues
* Make sure caching is off for tests
* Remove unnecessary return
* Use emulative parser if on PHP 5.6
* Cache parser for faster first-time parse
* Fix constant resolution when scanning classes
* Remove test that’s beyond a practical scope
* Add back --diff support
* Add --help for --threads
* Remove unused vars
2017-07-25 16:11:02 -04:00
Matthew Brown
bc35f88859
Fix issue with $this instanceof checks in traits
2017-06-23 00:39:37 -04:00
Matt Brown
e5c25eae97
Fix #172 - make sure new coalesce vars escape brackets
2017-06-20 15:38:32 -04:00
Matt Brown
e1d5eab7a2
Fix long line
2017-06-20 14:07:54 -04:00
Matt Brown
473040ca8f
Fix #171 by supporting exit statements for fopen
2017-06-20 13:25:37 -04:00
Matthew Brown
93e7486d5e
Reduce line length
2017-05-26 20:17:56 -04:00
Matthew Brown
22a716f4da
Improve formatting of phpdocs
2017-05-26 20:16:18 -04:00
Matthew Brown
d6909193ea
Add additional formatting changes
2017-05-26 20:05:57 -04:00
Matthew Brown
688a72c794
Fix #36 - emit issues on deprecated properties
2017-05-25 01:32:34 -04:00
Matthew Brown
4fd46e1752
Improve formatting
2017-05-24 22:07:49 -04:00
Matthew Brown
7532e32b9d
Fixed spacing and use statement formatting
2017-05-19 00:48:26 -04:00
Matt Brown
cadaef14e6
Carry forward ignore_nullable_return in fleshOutType
2017-05-10 12:49:59 -04:00
github@muglug.com
9ff8736e53
Add the means to ignore PossiblyNull* errors from the type itself
2017-05-09 16:38:58 -04:00
Matt Brown
9cabf428c4
Only make isset $this->property mixed if not already defined
2017-04-28 16:41:54 -04:00
Jon Ursenbach
f65c618b2e
PSR-2 adjustments and adding PHPCS checks into the Travis config. ( #149 )
...
* PSR-2 adjustments and adding PHPCS checks into the Travis config.
* Reverting some CallChecker changes and no longer casting vars to null.
2017-04-28 00:31:55 -04:00
Matt Brown
bd6a623bfd
Fix possible empty type when inferredType not set
2017-04-21 16:33:18 -04:00
Matt Brown
f7daa6e768
Fix #143 by allowing scalar types to be passed through
2017-04-21 14:06:47 -04:00
Matthew Brown
2bdd062400
Ternary else should ignore if expression context
2017-04-15 13:46:18 -04:00
Vladimir Komissarov
818e3be00c
Fix undefined global constant in closure
2017-04-14 17:03:09 +07:00
SignpostMarv
46a0b03aac
enable the exposure of the source line number when DocblockParseException is thrown
2017-04-11 22:14:15 +01:00
Matthew Brown
40427839ea
Get all variables possibly assigned in conditional
2017-04-06 22:56:37 -04:00
Matthew Brown
20b0460a33
Fix #123 - ternary byref vars now adjusted
2017-04-06 21:53:29 -04:00
Matthew Brown
075cc5f50d
Add by-reference clause removal
2017-04-02 17:37:56 -04:00
Matt Brown
5b34163d8d
Add ability to insert suppressed issues on functions
2017-03-31 11:21:34 -04:00
Matthew Brown
066b1e011e
Prevent creating empty objectlike
2017-03-20 02:05:58 -04:00
Matthew Brown
cb2ed860fb
Make sure to invalidate clauses in all parent contexts when asserting
2017-03-18 15:24:14 -04:00
Matthew Brown
c33e66813a
Move type algebra functionality to separate checker
2017-03-18 13:37:00 -04:00
Matthew Brown
9b41bc9b37
Add slower (but more accurate) loop checks
2017-03-14 20:14:25 -04:00
Matt Brown
3d2be3410e
Infer loop types without @var comments
2017-03-13 18:06:56 -04:00
Matt Brown
ae0ca9553f
Remove training wheels
2017-03-13 12:02:28 -04:00
Matthew Brown
5cd1b6735f
Add even more references in docblocks
2017-03-01 22:27:52 -05:00
Matthew Brown
cd5f727d2e
Collect explicit references to classes/methods
2017-02-26 23:09:18 -05:00
Matthew Brown
8db6921f1c
More graceful early exit if not checking variables
2017-02-24 21:27:52 -05:00
Matthew Brown
fa3b292fd4
Fix #101 - restrict the values of pass-by-ref variables
2017-02-23 00:25:28 -05:00
Matthew Brown
9137727993
Fix #99 - treat null coalesce more respectfully
2017-02-17 20:50:47 -05:00
Matthew Brown
7cd1b27ff1
Add more support for logical and/or
2017-02-16 21:00:45 -05:00
Matthew Brown
2d58531631
Fix #98 - add support for logical and/or
2017-02-16 20:43:23 -05:00
Matthew Brown
500044dac1
Make sure $argv and $argc are not globally available
2017-02-12 22:12:31 -05:00
Matthew Brown
a87ea78efc
Fix variable-scoped byref issue
2017-02-12 19:07:25 -05:00
Matthew Brown
a4323359d3
Fix ternary/which/for conditionals
2017-02-12 18:47:02 -05:00
Matthew Brown
81e24de76f
Fix invalid NullPropertyFetch warning
2017-02-12 18:06:18 -05:00
Matthew Brown
2635744f4e
Simplify array inferred type
2017-02-12 16:58:04 -05:00
Matthew Brown
8e7ab59e2b
Add return types for core vars
2017-02-12 12:22:39 -05:00
Matthew Brown
7876c7ffb9
Allow mixed to override null in byref assignment
2017-02-12 11:34:07 -05:00
Matthew Brown
bb9221ba01
Analyze die/exit expressions
2017-02-11 19:42:12 -05:00
Matthew Brown
f32fabd798
Remove dead code
2017-02-11 19:30:06 -05:00
Matthew Brown
35e4b380cc
Add collection of PossiblyNull* issues
2017-02-11 17:55:08 -05:00
Matthew Brown
dbddedb20b
Don’t create objectlike if we some properties are untyped
2017-02-10 23:35:34 -05:00
Matt Brown
32d85e20da
Remove unused vars
2017-02-10 19:10:13 -05:00
Matt Brown
6b2bb7d917
Store first code location for all variables in a statement list
2017-02-07 18:09:12 -05:00
Matthew Brown
01beb97413
Fix #87 - array types from docblocks can be reasoned about safely
2017-02-03 22:07:14 -05:00
Matthew Brown
0fbf8b5619
Remove more dead code
2017-02-02 00:45:23 -05:00
Matthew Brown
d3abc0011d
Fix #80 - add dead code checks via command line
2017-01-31 23:24:33 -05:00
Matthew Brown
ff46487353
Be more discerning about unaryminus/plus inferred type
2017-01-25 21:50:34 -07:00
Matthew Brown
c14a19370f
Improve UnaryPlus/Minus still more
2017-01-25 20:23:06 -07:00
Matthew Brown
f03807e7b7
Fix unaryplus/minus type inference
2017-01-25 20:02:19 -07:00
Matthew Brown
0da9c10d36
Don’t complain when adding array and object-like array
2017-01-23 15:40:55 -07:00
Matt Brown
a67800cac7
Ignore cloning of mixed variables
2017-01-19 15:00:05 -05:00