1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 17:52:45 +01:00
Commit Graph

183 Commits

Author SHA1 Message Date
Matt Brown
d8825701f5 Fix #556 - closure params with defaults can still accept extra 2018-03-05 10:29:19 -05:00
Matthew Brown
67cad2063d Fix #555 - fix function name mapping class 2018-03-05 09:01:24 -05:00
Matthew Brown
ee6a9b98fb Allow arrays to be called (ugh) 2018-03-02 00:49:53 -05:00
Matthew Brown
54cbee1265 Add TooManyArguments for closure test 2018-03-02 00:12:41 -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
9d165bee7b Fix generic return type for array_map
Ref #541
2018-02-26 10:39:48 -05:00
Matthew Brown
a6b54a3607 Fix #513 - make sure numeric is treated like a number 2018-02-15 19:50:50 -05:00
Matthew Brown
e862e4ddb1 Make all plugin methods static
cc @TysonAndre
2018-02-11 20:56:34 -05:00
Matthew Brown
217233472c Fix #457 - fix objectlike property isset check 2018-02-10 23:30:40 -05:00
Matt Brown
7f4be858c2 Fix #498 - add better issue type for docblock contradiction 2018-02-07 15:20:47 -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
861d907845 Add more information to TooMany/TooFewArguments issues
Fixes #481
2018-02-02 11:26:55 -05:00
Matthew Brown
3482ee3b39 Split UntypedParam into MissingParamType and MissingClosureParamType 2018-01-28 20:03:47 -05:00
Matt Brown
1a2d13ae32 Ignore falsable issues from core functions 2018-01-25 13:07:36 -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
Matthew Brown
c0a22d5f55 Increase CallChecker code coverage 2018-01-22 00:17:16 -05:00
Matthew Brown
9b6b03ff9f Create Config before ProjectChecker, and remove test-specific code from FileChecker 2018-01-21 10:22:04 -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
Matt Brown
a253ca68bc Allow array_filter to inspect closure bodies 2018-01-17 16:07:46 -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
2120d258a4 Fix formatting of return type adder 2018-01-11 15:50:58 -05:00
Matthew Brown
8e4f8fabe3 Fix getenv calls
Fixes #386
2018-01-08 00:09:22 -05:00
Stéphane Bour
9b2cfdc669 fix: add preserve_keys on array_reverse function 2018-01-03 21:57:11 -05:00
Matthew Brown
84260c5edc Prohibit array pass by ref 2017-12-22 15:21:23 +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
31ce716647 Widen empty array checks 2017-12-10 16:17:27 -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
ccc0583bf8 Fix issue with bad assign after array_pop/array_shift 2017-11-19 23:46:32 -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
a0a9128375 Fix #285 - add PossiblyInvalidArrayAccess 2017-11-11 21:22:11 -05:00
Matthew Brown
2f1e3652b7 Fix #274 - improve array addition inference for objectlike arrays 2017-11-11 14:19:57 -05:00
Matthew Brown
a7b32beb4e Add better checks for array_rand’s signature 2017-11-08 21:56:54 -05:00
Matt Brown
6d14bf65d7 Loosen restrictions on compact(), fix #267 2017-11-08 09:37:58 -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
c850ef644d Add PossiblyFalseReference and PossiblyFalseArgument issues
Useful for catching error cases
2017-10-23 11:47:00 -04:00
Matthew Brown
3a8efec728 Add error for pass by reference 2017-09-16 13:16:21 -04:00
Matthew Brown
8aabcbce35 Introduce UntypedParam warnings when functions are missing param types 2017-09-02 11:18:56 -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
Matt Brown
592194e9f2 Fix #187 by splitting abs into int and float versions 2017-07-14 18:09:25 -04:00
Matt Brown
ac70ea31b2 Change test assertion keying 2017-06-29 10:22:49 -04:00
Matthew Brown
d6909193ea Add additional formatting changes 2017-05-26 20:05:57 -04:00
Matthew Brown
8f317cd8a2 Fix #133 - emit issue when calling no-constructor class with args 2017-05-24 23:11:40 -04:00
Matthew Brown
4fd46e1752 Improve formatting 2017-05-24 22:07:49 -04:00
Matt Brown
77da5ca99e Fix #156 - allow objectlike arrays to be merged nicely 2017-05-05 18:53:45 -04:00
Jon Ursenbach
11bc153deb Rewriting and streamlining every unit test with data providers. (#147)
* Rewriting and streamlining every unit test with data providers.

All unit tests have been rewritten into PHPUnit data providers
to reduce the amount of unnecessary code-reuse through out the
test suite.
2017-04-24 23:45:02 -04:00
Matt Brown
f011197090 Fix #124 - don’t check array_filter closures when >2 args passed 2017-04-07 18:30:15 -04:00
Matthew Brown
a63602ce45 change to trigger travis 2017-04-03 13:35:04 -04:00
Matthew Brown
89bf409537 Cast phpversion to string 2017-04-03 13:09:02 -04:00
Matthew Brown
431de10c5c Prevent array_filter test running on HHVM 2017-04-03 12:53:10 -04:00
Matt Brown
fe43c4e37f Fix #122 - allow multiple types of filtering 2017-04-03 12:36:49 -04:00
Matt Brown
7baf942eaa Prevent false positives after extract call 2017-02-27 10:52:43 -05:00
Matthew Brown
9579460c59 Fix #97 - is_callable shouldn’t prevent evaluation of calls to existing functions 2017-02-16 20:51:53 -05:00
Matthew Brown
32dd5d5512 Be better about dealing with byref args when not checking functions 2017-02-15 01:47:03 -05:00
Matt Brown
83a978ea80 Fix array_filter on string-keyed arrays 2017-02-13 19:16:25 -05:00
Matthew Brown
2f2b487236 Fix #96 2017-02-12 12:31:39 -05:00
Matthew Brown
14c487d3e6 Always supply default template params as return type 2017-02-10 22:51:47 -05:00
Matt Brown
c0a6fc9125 Fix #90 - add genericised stubs for common array functions 2017-02-10 18:12:59 -05:00
Matthew Brown
76b6bc9b3d Prevent Psalm from storing unnecessary checkers 2017-02-01 18:11:00 -05:00
Matt Brown
a7872472be Add stubbing tests and modify config initialisation 2017-01-31 19:22:05 -05:00
Matthew Brown
a14b03c057 Fix issue with array_merge, and then bugs revealed by that 2017-01-19 01:32:35 -05:00
Matthew Brown
27a018095b Fix invalid InvalidParamDefault error when comparing to false 2017-01-19 01:12:19 -05:00
Matthew Brown
b3726c9de5 Use getcwd() for the project’s base, not the config file parent directory 2017-01-16 18:33:04 -05:00
Matthew Brown
5315fd15ad Fix namespaced functions in regular use statements 2017-01-16 00:49:12 -05:00
Matthew Brown
8836f05027 Fix #56 - functions in root namespaces should not need slash 2017-01-15 12:34:23 -05:00
Matt Brown
6e6106c080 Add docblocks to tests 2017-01-13 14:07:23 -05:00
Matthew Brown
c20f31855c Fix namespaced function calls 2017-01-12 09:42:24 -05:00
Matthew Brown
17329015dc Discriminate between checking, visiting and analyzing in method names 2017-01-07 15:09:47 -05:00
Matthew Brown
7609ca02c0 Fix #32 by evaluating all class references in files lazily 2017-01-04 23:42:58 -05:00
Matthew Brown
4c3e714253 Add a check for duplicated params 2017-01-02 01:20:47 -05:00
Matthew Brown
93c1366bd8 Tighten up what array assignments can happen 2017-01-02 01:07:44 -05:00
Matthew Brown
8b5e066ba6 Add case-sensitive function names 2016-12-30 13:09:00 -05:00
Matthew Brown
685eaeb4fe Reimagine XML schema, fixes #21 2016-12-29 20:10:06 -05:00
Matthew Brown
749735a3ec Update config file API still further 2016-12-29 10:24:10 -05:00
Matthew Brown
ff466b7992 Change config API 2016-12-29 08:42:39 -05:00
Matthew Brown
52b3e1ba8c Simplify test config setup; 2016-12-18 19:00:32 -05:00
Matthew Brown
d88bb4e135 Finish adding tests for all issues 2016-12-16 22:16:29 -05:00
Matt Brown
6755c8724a Add tests for M* issues, fixing bugs along the way 2016-12-16 18:56:23 -05:00
Matt Brown
a44dd4f6b0 Add more tests 2016-12-14 19:43:44 -05:00
Matt Brown
c91e457c28 Add psalm.xml support for checking tests 2016-12-14 12:55:23 -05:00
Matt Brown
154d023a9d Add more robust config testing 2016-12-14 12:28:38 -05:00
Matthew Brown
4c21a5af7c Add so many new tests 2016-12-11 23:41:11 -05:00