1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-05 21:19:03 +01:00
Commit Graph

287 Commits

Author SHA1 Message Date
Matthew Brown
195cb289ed Add float-checking plugin, and support for custom plugin issues 2019-01-07 08:38:56 -05:00
Matthew Brown
214fd7d461 Add DuplicateFunction issue
Fixes #49
2019-01-06 16:40:44 -05:00
Brown
2b4b55fd33 Add support for @return no-return
Fixes #1155
2019-01-02 17:05:39 -05:00
Brown
1d300ec342 Fix #1150 2019-01-02 11:18:22 -05:00
Brown
4e183abdc6 Add better message when reconciling fails with bad result
Ref #1114
2018-12-05 10:36:42 -05:00
Matthew Brown
b32000fa05 Fix #689 - add checks for @internal annotations 2018-12-01 18:37:49 -05:00
Matthew Brown
21f29e7385 Fix #1108 - add support for referencedFunction to UndefinedFunction 2018-11-29 23:19:33 -05:00
Matthew Brown
890412b557 Add support back for parser errors 2018-09-30 11:34:51 -04:00
Matt Brown
db3ddaa42c Allow InvalidCatch and InvalidThrow to be suppressed per-class
Ref #411
2018-09-21 11:35:51 -04:00
Matt Brown
4d4e84e6e9 Add specific ForbiddenEcho issue if a config flag is set 2018-09-18 17:08:32 -04:00
Matt Brown
070e7903df Allow suppression of TooManyArguments by function/method id 2018-08-16 16:49:33 -04:00
Matt Brown
cb63f4f70f Add support for checking DeprecatedTrait and DeprecatedConstant 2018-08-10 13:25:25 -04:00
Matthew Brown
e3ae1bf26f Fix #15 - check for uncaught throws if config flag is set 2018-06-22 01:13:49 -04:00
Matthew Brown
a33d52d935 Add support for referencedProperty error restrictions 2018-05-11 00:07:41 -04:00
rightfold
5c908da55a Check that __clone, __construct, __destruct signatures omit return types
PHP complains when you have a return type declared for these three methods.
2018-04-21 16:04:03 -04:00
Matt Brown
5a2f6ff0e0 Fix #624 - change some innaccurate issue names 2018-04-17 14:07:02 -04:00
Matthew Brown
452fd2e7c9 Make UndefinedClass an explicit class-related issue 2018-03-21 10:17:57 -04:00
Matthew Brown
b634e1a1b7 Add more refined treatment of InvalidIterator 2018-03-20 22:59:22 -04:00
Matthew Brown
5384f193d1 Allow class and method issues to be suppressed by their identifiers
Ref #603
2018-03-20 22:36:03 -04:00
Matthew Brown
d7a585160f Add more granular error messages for invalid operands 2018-03-18 16:39:34 -04:00
Matt Brown
b664c85642 Add new issue conditional on config flag 2018-03-06 12:19:50 -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
a99e89495b Add end line/column data for LSP support 2018-02-19 18:16:09 -05:00
Matthew Brown
ec5c9c862c Add missing file 2018-02-17 20:45:09 -05:00
Matthew Brown
09f86ceee7 Introduce MissingDependency issue, separate from UndefinedClass
Ref #511
2018-02-17 11:36:20 -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
3482ee3b39 Split UntypedParam into MissingParamType and MissingClosureParamType 2018-01-28 20:03:47 -05:00
Matthew Brown
507007a2bf Add DeprecatedInterface and emit DeprecatedClass in more places
Fixes #463
2018-01-23 09:09:43 -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
Matthew Brown
fb9f20f4b8 Find unused properties with dead code checks
Fixes #424
2018-01-10 23:29:18 -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
fe96868e27 Add documentation 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
5bae869dc6 Break file manipulation out into Psalter 2018-01-07 17:25:23 -05:00
Matt Brown
796a3c5066 Fix style issues 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
a76fde5b98 Break out mismatching param/return type issues from InvalidDocblock 2018-01-05 12:11:12 -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
81cfe09fae Improve reporting of classlike locations in docblocks 2018-01-01 20:04:03 -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
875bb8c072 Improve dead code detection, reducing false positives for params 2017-12-29 17:27:16 -05: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
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
3b7c84f484 Detect instances where loop invariants are invalidated
Fixes #389
2017-12-17 10:58:03 -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
0eedad4f6a Add UndefinedGlobalVariable issue and asssociated Possibly... one 2017-12-06 00:56:00 -05:00
Matt Brown
1f57881310 Break out PossiblyNullArrayOffset and NullArrayOffset from InvalidArrayOffset 2017-12-04 11:20:31 -05:00
Matthew Brown
52f9225356 Add separate issues for implemented return type mismatch 2017-11-30 00:01:41 -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
Matt Brown
0c2ea418e3 Fix #327 - prevent null array value from killing assignment 2017-11-20 16:19:40 -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
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
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
b2ae9a2892 Fix #291, #292 and #297 by improving docblock parsing 2017-11-14 21:43:31 -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
Matt Brown
81493a639e Add more robust property assignment when property not defined 2017-11-03 12:27:01 -04:00
Matthew Brown
35e6cf8108 Change MissingInclude to MissingFile 2017-10-29 17:36:02 -04:00
Matthew Brown
b618bd798d Add new issues for missing required files 2017-10-29 14:39:23 -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
6ab693ceeb Add missing class 2017-10-07 11:31:18 -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
Matthew Brown
91bdd65588 Fix #179 - check for abstract method instantiations 2017-06-30 10:24:47 -04:00
Matthew Brown
8fd671bdc4 Fix #167 - prevent Empty type in assignment 2017-06-28 23:37:02 -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
688a72c794 Fix #36 - emit issues on deprecated properties 2017-05-25 01:32:34 -04:00
Matthew Brown
0fdf281896 Add support for @deprecated classes 2017-05-25 00:34:39 -04:00
muglug
65d86d35ad Separate iterator issues 2017-05-22 11:59:58 -04:00
Matthew Brown
92e184086f Fix #158 - prevent using resource in return type 2017-05-21 13:48:17 -04:00
Matthew Brown
32efdfd0f7 Fix #129 - emit PossiblyNullFuntionCall when encountering such a thing 2017-04-08 11:38:06 -04:00
Matthew Brown
c663062816 Add PossiblyUndefinedArgument issue to cope with #126 2017-04-08 09:28:02 -04:00
Matthew Brown
b3a454cf5b Create new InvalidMethodCall issue for calling methods on non-objects 2017-04-08 09:20:32 -04:00
Matt Brown
da19b55db1 Add special TypeDoesNotContainNull issue as distinct from TypeDoesNotContainType 2017-04-06 15:36:22 -04:00
Matthew Brown
dcedd65215 Add check for paradoxical statements 2017-04-02 15:26:10 -04:00
Matthew Brown
e687887ba3 Emit an InvalidReturnType when it should contain null, and introduct LessSpecificReturnType 2017-03-18 12:18:17 -04:00
Matt Brown
182f715b62 Add dead code detection for possibly unused public methods 2017-02-23 19:52:23 -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
e0e92785f8 Complain about unevaluated code in more concrete fashion 2017-02-12 16:49:32 -05:00
Matthew Brown
8ff6634e7b Add issue for possibly unused variables in public/private methods
also changed a lot of access
2017-02-11 18:56:38 -05:00
Matthew Brown
35e4b380cc Add collection of PossiblyNull* issues 2017-02-11 17:55:08 -05:00
Matthew Brown
cdcacc395d Rename DeadCode to UnusedVariable, UnusedMethod and UnusedClass 2017-02-08 00:28:26 -05:00
Matt Brown
f4857eb0dd Make dead code check emit an issue 2017-02-07 18:18:33 -05:00
Matthew Brown
1ece3071f9 Add reference counting for methods and remove dead code 2017-01-29 23:44:05 -05:00
Matthew Brown
6bcc763414 Fix #3 by checking inside __constructor calls for initialisations 2017-01-26 23:23:12 -07:00
Matthew Brown
894b25487f Fix #71 - prevent instantiation of abstract classes 2017-01-20 00:10:10 -05:00
Matthew Brown
9d1b382820 Fix #48 by recording class definition line number & file path 2017-01-19 23:45:21 -05:00
Matt Brown
dae7718ae8 Support array_combine types and introduce a MoreSpecificReturnType issue 2017-01-17 11:17:49 -05:00
Matthew Brown
e3a9cb98c3 Add extra issue for invalid clone and fix issue reporting; 2017-01-16 12:59:09 -05:00
Matthew Brown
2e2f2f4ffb Add new suppressable error for missing closure return types 2017-01-16 01:22:36 -05:00
Matt Brown
fbbef2c320 Fix #45 - add issue when optional param used before required 2017-01-13 13:40:20 -05:00
Matt Brown
c181f47364 Fix #35 and #40 by improving method signature checks 2017-01-13 12:03:22 -05:00
Matthew Brown
4c3e714253 Add a check for duplicated params 2017-01-02 01:20:47 -05:00
Matthew Brown
846cc59d5f Add support for checking closure return types 2016-12-31 10:51:42 -05:00
Matthew Brown
49f7817a2a Emit specific issue when calling instance method with self:: 2016-12-31 09:20:10 -05:00
Matthew Brown
ee4a3882a7 Check method defaults to see whether they match 2016-12-30 23:40:32 -05:00
Matthew Brown
641ffc09c9 Add NullOperand issue for easy ignoring 2016-12-29 00:32:12 -05:00
Matthew Brown
18e7c65430 Emit more InvalidOperand issues 2016-12-29 00:14:06 -05:00
Matthew Brown
c51d8f5220 Implement MixedOperand and InvalidOperand issues 2016-12-24 18:29:11 +00:00
Matt Brown
1b8abc8f17 Change NullReference issue to NullArgument when in method call 2016-12-14 12:54:34 -05:00
Matthew Brown
592ee98efc Fix bugs discovered by adding more tests 2016-12-11 23:40:46 -05:00
Matthew Brown
562f71b21f Add TypeDoesNotContainType issue and fix those issues in Psalm code 2016-12-11 13:48:11 -05:00
Matt Brown
b3106c68bb Fix #6 - raise error with erroneous __toString 2016-12-09 12:48:02 -05:00
Matthew Brown
a5195b2571 Add JSON output format 2016-12-07 22:38:57 -05:00
Matt Brown
48e19fc7e5 Add support for closure docblocks 2016-12-06 19:41:52 -05:00
Matthew Brown
ef1049224d Add selection of return types in code preview 2016-12-06 16:33:47 -05:00
Matthew Brown
7cb6891a0b Add support for class constant visibility 2016-12-04 01:44:33 -05:00
Matthew Brown
a1acbfec07 Show code snippets when reporting errors
This also introduces a new method of identifying specific code locations when creating issues
2016-12-03 19:11:30 -05:00
Matthew Brown
134bc950fb Add specific NullArrayAccess error 2016-11-22 11:11:47 -05:00
Matthew Brown
4f95c67e1c Emit issues for null/mixed array access 2016-11-21 19:07:56 -05:00
Matthew Brown
12a12e15c2 Emit issue if return type is missing 2016-11-07 17:07:59 -05:00
Matthew Brown
721e0d01e2 Get rid of var_dumps 2016-11-05 20:53:39 -04:00
Matthew Brown
c5591adf10 Add support for global in functions and mixed inferred return errors 2016-11-05 17:54:34 -04:00
Jon Ursenbach
27c2db1d1d PSR-2 2016-11-02 17:50:54 -04:00
Matthew Brown
34af24a2b4 Add all the properties 2016-11-01 00:39:41 -04:00
Matthew Brown
c2f63c392e Emit issue if property type is missing 2016-10-31 15:17:54 -04:00
Matthew Brown
604c875d0c Fix more errors caught by Psalm 2016-10-30 12:46:18 -04:00
Matthew Brown
e6cc026d20 Add check for continue when not in loop context 2016-10-17 16:42:23 -04:00
Matthew Brown
b2a5081163 Add checks for method signature mismatch 2016-10-15 18:01:04 -04:00
Matthew Brown
64b4adfb22 Make UndefinedProperty issues more specific 2016-10-10 19:29:38 -04:00
Matthew Brown
5292467db0 Add @todo issues and fix errors in StatementsChecker 2016-10-09 17:54:58 -04:00
Matthew Brown
daf49bdf0b Add separate undefined this property to demarcate those errors 2016-08-08 16:06:28 -04:00
Matthew Brown
4d26b9b3af Add more issues to solve 2016-08-07 11:35:27 -04:00
Matthew Brown
d254bc0aa2 Improve type checking of properties 2016-08-06 20:27:13 -04:00
Matthew Brown
9cb7a5feeb Fix #14 - add support for checking too many and too few arguments 2016-07-29 14:48:04 -04:00
Matthew Brown
df28d24803 Change name to Psalm 2016-07-25 18:37:44 -04:00