1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-12 01:09:38 +01:00
Commit Graph

97 Commits

Author SHA1 Message Date
Matthew Brown
1a4ddc7cdd
Support value types (#707)
* Add first idea

* Add initial count experiments

* Remove false positives

* Fix getId to support changes in conditionals

* Add better tests

* Strip types when not exists

* Fix array offsets

* More fixes

* Add class constant value types

* Clone constants everywhere

* Don’t complain unnecessarily

* Be more lenient with possibly invalid __sets

* Fix mixed issues

* Fix bug concerning orred string equality

* Remove unnecessary casts
2018-05-03 13:56:30 -04:00
Matthew Brown
35725267f9 Fix #691 - Allow comparisons to float for integer results 2018-04-24 23:02:20 -04:00
Matt Brown
1f3837d972 Fix #686 - allow undefined class inside class_exists call 2018-04-19 12:16:00 -04:00
Matt Brown
6ae39c84fc Use more locals 2018-04-13 11:28:15 -04:00
Matt Brown
60c6bb4021 Fix #650 - be more judicious about inserting mixed into places 2018-04-06 18:28:22 -04:00
Matthew Brown
4175d1a887 Add PossiblyUndefinedVariable warning when using possibly undefined array key 2018-03-17 17:35:36 -04:00
Matthew Brown
67312be2a9 Fix #562 - allow if/else blocks to initialise vars 2018-03-08 09:30:31 -05:00
Matthew Brown
88ca7d2fa7 Fix #515 - make Psalm aware of variable array keys 2018-02-17 11:24:08 -05:00
Matthew Brown
24416feb62 Improve handling of unset calls with possibly undefined variables 2018-02-10 10:30:08 -05:00
Matt Brown
1df4c3d196 Add DocblockTypeContradiction to find possible issues with docblock types
Fixes #491
2018-02-06 18:44:53 -05:00
Matthew Brown
44b8b22995 Improve checks for unused variables and params 2018-01-28 17:28:34 -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
ea28ee709d Improve unused variable detection slightly 2018-01-25 01:04:26 -05:00
Matt Brown
72a4f148ff Prevent infinite loops when analysing private functions that call each other 2018-01-24 13:11:23 -05:00
Matthew Brown
b06cfd025a Allow continue inside case statement as alias for break
Fixes #464
2018-01-24 00:01:08 -05:00
Matthew Brown
68b00ea49a Add automatic fix for PossiblyUndefinedVariable 2018-01-21 16:24:20 -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
Matt Brown
edde8930af Speed up Psalm by caching result of Union::getId 2018-01-09 15:05:48 -05:00
Matthew Brown
bb41b92789 Filter forumulae to remove assertions on unknowable things 2018-01-07 23:59:25 -05:00
Matthew Brown
c38cf9b672 Migrate type reconciliation code to its own class 2017-12-29 10:55:53 -05:00
Matthew Brown
3b7c84f484 Detect instances where loop invariants are invalidated
Fixes #389
2017-12-17 10:58:03 -05:00
Matt Brown
8ca5fbefea Invalidate clauses when assigning root vars 2017-12-15 17:34:21 -05:00
Matthew Brown
42dcd136ca Improve treatment of true and fix #369 2017-12-09 15:51:38 -05:00
Matthew Brown
0eedad4f6a Add UndefinedGlobalVariable issue and asssociated Possibly... one 2017-12-06 00:56:00 -05:00
Matthew Brown
cff7f35d00 Change __toString type conversions to more precise getId checks 2017-12-03 12:44:08 -05:00
Matthew Brown
a47675250a Set that a type is from docblock when substituting in docblock atomic type 2017-12-03 01:24:47 -05:00
Matthew Brown
d20b8d3034
Improve loop analysis (#365) 2017-12-02 18:28:18 -05:00
Matthew Brown
3fca70c77b Always reemove clauses if from_docblock status has changed 2017-12-02 17:57:58 -05:00
Matthew Brown
cfeb4c2586 Simplify vars_possibly_in_scope types 2017-12-02 13:32:20 -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
18cf05e087 Always keep track of assigned var ids 2017-11-25 11:21:45 -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
f6e01b5925 Change empty type assertions to "falsy"
As empty has a special meaning
2017-10-22 11:57:41 -04:00
Matthew Brown
b43c2d5f0c Fix #231 - add special case for === false checks 2017-10-10 22:36:33 -04:00
Matthew Brown
9f9e8a1b30 Improve API for inference 2017-09-03 20:52:54 -04:00
Matthew Brown
73694ab04e Suggest types when complaining of untype params
Ref #204
2017-09-02 18:15:52 -04:00
Matthew Brown
368b6670d7 Fix a few edgecases 2017-06-29 00:28:37 -04:00
Matthew Brown
bc35f88859 Fix issue with $this instanceof checks in traits 2017-06-23 00:39:37 -04:00
Matt Brown
f49d167a49 Add tracking from where a trait was included 2017-06-21 14:22:52 -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
SignpostMarv
adef59629a scrutinizer-ci (#152)
* swapping phpcs for php-cs-fixer

* workaround for php-cs-fixer treating parenthesis following echo as the function call variant

* amending rules

* blank_line_before_return

* majority of files pass with these disabled, could remove later

* combine_consecutive_unsets

* concat_space

* placeholder for if vimeo/psalm ever goes php:^7.0

* function_to_constant

* disabling include

* linebreak_after_opening_tag, lowercase_cast, magic_constant_casing

* mb_str_functions disabled

* method_separation

* native_function_casing

* native_function_invocations

* new_with_braces disabled to match usage

* no_alias_functions

* no_blank_lines_after_class_opening

* no_blank_lines_after_phpdoc

* no_blank_lines_before_namespace

* no_empty_comment

* no_empty_phpdoc

* no_empty_statement

* no_extra_consecutive_blank_lines

* no_leading_import_slash to discuss

* no_leading_namespace_whitespace

* no_mixed_echo_print

* no_multiline_whitespace_around_double_arrow

* no_multiline_whitespace_before_semicolons

* no_php4_constructor

* no_short_bool_cast

* no_short_echo_tag

* no_singleline_whitespace_before_semicolons

* no_spaces_around_offset

* no_trailing_comma_in_list_call

* no_trailing_comma_in_singleline_array

* no_unneeded_control_parentheses to discuss

* no_unreachable_default_argument_value

* no_unused_imports to discuss

* no_useless_else to discuss

* no_useless_return

* no_whitespace_before_comma_in_array

* no_whitespace_in_blank_line

* non_printable_character

* normalize_index_brace

* ordered_class_elements to discuss

* ordered_imports to discss

* php_unit_construct

* php_unit_dedicate_assert

* php_unit_fqcn_annotation

* php_unit_strict to discuss

* php_unit_test_class_requires_covers to discuss

* phpdoc_add_missing_param_annotation

* phpdoc_align to discuss

* phpdoc_annotation_without_dot to discuss

* phpdoc_indent to discuss

* phpdoc_inline_tag

* phpdoc_no_access

* phpdoc_no_alias_tag

* phpdoc_no_empty_return

* phpdoc_no_package

* phpdoc_no_useless_inheritdoc

* phpdoc_order to discuss

* phpdoc_return_self_reference

* phpdoc_scalar to discuss

* phpdoc_separation to discuss

* phpdoc_single_line_var_spacing

* phpdoc_summary to discuss

* phpdoc_to_comment to discuss

* phpdoc_trim to discuss

* phpdoc_types

* phpdoc_var_without_name

* pow_to_exponentiation

* pre_increment to discuss

* protected_to_private

* psr0 turned off

* psr4 turned on

* random_api_migration

* return_type_declaration to discuss

* self_accessor to discuss

* semicolon_after_instruction

* short_scalar_cast

* silenced_deprecation_error turned off

* simplified_null_return to discuss

* single_quote

* space_after_semicolon

* standardize_not_equals

* strict_comparison to discuss

* strict_param to discuss

* ternary_operator_spaces

* ternary_to_null_coalescing should be set to true if vimeo/psalm ever goes php:^7.0

* trailing_comma_in_multiline_array to discuss

* trim_array_spaces

* unary_operator_spaces

* whitespace_after_comma_in_array to discuss

* multi-version scrutinizer to match travis

* binary_operator_space

* not the best solution, but it works to exclude the call map from php-cs-fixer

* reducing verbosity of config where defaults were used

* dry run php-cs-fixer as part of tests

* disabling rule pending FriendsOfPHP/PHP-CS-Fixer#2739

* enabling no_unused_imports

* enabling ordered_imports

* ignoring user-defined .php_cs

* using $TRAVIS_COMMIT_RANGE to only test modified files

* enabling no_leading_import_slash

* conditionally testing everything

* filter output then perform exact match

* restoring phpcs via partial cherry pick of f65c618
2017-05-26 18:26:14 -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
Matthew Brown
8d46c65815 Only make non-null if inside constructor 2017-04-14 23:26:58 -04:00
Matthew Brown
ce6ca58291 Fix #114 - add optional Hack-like checks calls 2017-04-14 21:32:14 -04:00
Matthew Brown
ce5b35169b Treat empty & !empty as special straddling types 2017-04-02 19:06:18 -04:00
Matthew Brown
a8220ba4f1 Fix bug where empty string could confuse 2017-04-02 18:28:06 -04:00
Matthew Brown
a09e668dbc Only allow before/after clause comparisons on non-mixed types 2017-04-02 17:25:21 -04:00