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

159 Commits

Author SHA1 Message Date
Matthew Brown
85966d8a21 Fix #2577 - fix list cast to array 2020-01-11 11:42:09 -05:00
Brown
bd9142f131 Fix #2574 - remove assertions after increment 2020-01-09 11:51:56 -05:00
SignpostMarv
fbf66ba7f6 Typecast bool to int (#2550)
* adding specific checks for typecasting booleans, re: vimeo/psalm#2548

* satisfying phpcs

* amend check to use psalm types rather than php-parser types

* implementing tests for typecasting bools to int

* satisfying phpcs
2020-01-04 16:36:19 -05:00
Matthew Brown
9fa2db1b6c Move Union::getTypes to Union::getAtomicTypes 2020-01-04 12:20:26 -05:00
Matthew Brown
55c2f7faa2 Fix #2508 - don’t replace templated types with generic ones inside own function 2019-12-28 18:38:02 -05:00
Matthew Brown
734ad02203 Fix #2476 - flesh out iterable params 2019-12-18 17:19:54 +00:00
Matthew Brown
bf67c036aa Fix #2474 - treat free-standing binaryops as ifs instead 2019-12-16 08:32:00 -05:00
Brown
6d02aa86e8 Reconcile string emptiness a bit better 2019-12-13 15:51:54 -05:00
Matthew Brown
f45014d403 Fix #2460 - allow assertions on immutable method calls 2019-12-12 09:32:33 -05:00
Brown
b3cf9d3958 Catch circular references in constants
Fixes #2453
2019-12-10 16:16:44 -05:00
Brown
b78acf796f Fix #2445 - only generalise param when it’s generic 2019-12-09 10:58:09 -05:00
Matthew Brown
2e00ad2240 Treat more things as assignments 2019-12-07 15:58:05 -05:00
Brown
e1dd22ef6c Allow static::class to be used in array assertions 2019-12-04 12:23:26 -05:00
Brown
821f3528d2 Fix #701 - indicate issues fixable with Psalter 2019-12-02 15:24:01 -05:00
Matthew Brown
2383945fb9 Support __METHOD__ and __FUNCTION__ magic constants better 2019-11-29 22:47:20 -05:00
Matthew Brown
d1fbd1fa26 Add working arrow-functions implementation 2019-11-26 23:52:26 -05:00
Brown
0bcb7863f3 Use better system for storing inferred types and assertions 2019-11-25 11:44:54 -05:00
Matthew Brown
7012bedf4e Fix #2326 - substitute static more responsibly in generic objects 2019-11-12 08:01:22 -05:00
Brown
96586f16c0 Fix phpcs issues 2019-11-11 10:11:42 -05:00
Joram Schrijver
c97ba8f713 Implement type-checking and forbidding for print (#2314)
* Add type-checking for print

* Allow print to be forbidden
2019-11-08 07:01:34 -05:00
Brown
06b64a4a01 Detect erroneous use of empty check on bools 2019-11-06 16:14:46 -05:00
Brown
818f0c0985 Flesh out list types
Fixes #2300
2019-11-05 13:08:12 -05:00
Brown
353cf2351e Fix #2259 - if error suppression is use, list destructuring values will be nullable 2019-10-22 10:40:37 -04:00
Brown
d225374d6d Fix #2156 - do better inference after isset 2019-10-01 19:31:08 -04:00
Brown
f8f8b633b1 Suppress a bunch of PossiblyUndefinedArrayOffset issues 2019-10-01 15:44:43 -04:00
Matthew Brown
a9d0296252 Fix #2182 - allow modification to cloned objects inside 2019-09-30 22:07:20 -04:00
Brown
4ec966d72a Fix variable 2019-09-26 15:53:41 -04:00
Brown
cf799d0926 Fix #2173 - remove @var annotations automatically 2019-09-26 15:08:05 -04:00
Brown
c5ef2516b5 Fix #2150 - add detection for unnecessary @var annotations
And also remove them from codebase
2019-09-19 11:59:43 -04:00
Brown
6423a5e68a Fix #2145 - complain make byref params passed to closures mixed afterwards 2019-09-16 18:42:44 -04:00
Matthew Brown
0b4981f01b Fix #1551 - do better at inferring class constant types 2019-09-14 14:26:31 -04:00
Matthew Brown
d941294a84 Move class const analysis 2019-09-14 13:12:54 -04:00
Brown
a6baa2d04c Allow callables to be understood as pure
Fixes #2112
2019-09-09 12:11:04 -04:00
Brown
b49444b8ad Allow immutable objects to be cloned
Fixes #2111
2019-09-09 11:14:40 -04:00
Matthew Brown
504ccdab8c $a++, $a-- etc should be treated as assignments 2019-08-30 18:06:45 -04:00
Brown
b7b4baff8f Add support for @immutable
Fixes #1272
2019-08-30 12:36:35 -04:00
Brown
9835943294 Fix #2041 - make sure property is always set 2019-08-21 11:25:08 -04:00
Matthew Brown
c5f62d261d Remove redundant @psalm-suppress in Psalm’s codebsae 2019-08-18 16:10:12 -04:00
Brown
b5614d03f8 Add detection for unused function calls 2019-08-13 13:15:23 -04:00
Matthew Brown
b2c0993cdc Add framework for taint analysis to Psalm
Ref #611
2019-08-04 10:37:36 -04:00
Matthew Brown
3df248eea2 Add concept of purity to functions and methods 2019-07-18 01:31:48 -04:00
Matthew Brown
1ae9ea5fed Use object instead of by-ref params 2019-07-10 01:35:57 -04:00
Matthew Brown
f5809ec24a Only add node references to explicit locations 2019-07-01 11:12:12 -04:00
Matthew Brown
ca53019d6b Simplify class completion lookup
Ref #1822
2019-06-29 21:32:26 -04:00
LeSuisse
f29826b958 Fully qualify constants and function calls (#1849)
This should give a small performance boost.
Part of #1837.

The change is enforced via phpcs and can be autofixed
with phpcbf.
2019-06-26 16:52:29 -04:00
Brown
4baa4d70d8 Allow templated static type in fleshOutType 2019-06-24 15:08:55 -04:00
Brown
edf3307f84 Fix Psalm errors 2019-06-14 15:55:23 -04:00
Brown
1bc1af140f Move method calls outside classes and __CLASS__ constants 2019-06-14 15:54:15 -04:00
Matthew Brown
20c66f693e Fix handling of class const types 2019-06-06 18:46:40 -04:00
Brown
f309c755f8 Add ability to move classes 2019-06-05 08:50:24 -04:00
Matthew Brown
909e02d441 Move var docblocks within function 2019-06-01 12:25:57 -04:00
Matthew Brown
dc5a5bcd9d Simplify var docblock parsing signature 2019-06-01 11:53:32 -04:00
Matthew Brown
cd969c51e5 Generate missing param types from callers
Fixes #1707
2019-05-31 01:47:35 -04:00
Brown
7df88197ef Fix #762 - support key-of and value-of types 2019-05-28 10:44:04 -04:00
Matthew Brown
518330dcf4 Fix class constant assertions on self/static 2019-05-27 13:33:14 -04:00
Matthew Brown
790bc53bfd Fix #1681 - interpret parent annotation properly 2019-05-25 11:51:09 -04:00
Brown
751253ddf0 Fix #1603 - prevent invalid covariant template classes from being passed 2019-05-06 16:38:08 -04:00
Brown
0e4c8ce482 Split apart TypeCoercion issues, allowing more granular issue filtering 2019-04-25 18:02:19 -04:00
Brown
ff14f671b1 Add hopefully-more-portable method for evaluating method/property usage 2019-04-16 16:07:48 -04:00
bugreportuser
8454c0db39 Support for bitwise not 2019-04-14 10:16:38 -04:00
Brown
be5a262deb Add better handling for non-edge-case function calls 2019-04-11 14:53:21 -04:00
Tyson Andre
fc83f1c3ea Fix typo: "Arithmentic" -> "Arithmetic" 2019-03-24 23:00:51 -04:00
Matthew Brown
6bcc3d0261 Don’t stop analysing on var_dump 2019-03-23 10:58:26 -04:00
Matthew Brown
472ab29d74 Add PossiblyInvalidCast for more refined checks 2019-03-17 17:10:51 -04:00
Matthew Brown
bf586bf93b Fix #1471 - report issue with string casting inside string 2019-03-17 16:31:56 -04:00
Matthew Brown
b82709897a Fix #1460 2019-03-15 21:50:16 -04:00
Matthew Brown
848b070946 Fix #1413 - don’t complain about byref use param 2019-03-10 16:36:35 -04:00
bugreportuser
57a4522ee7 Flesh out callable arg types 2019-03-07 23:24:50 -05:00
Brown
5beb26659e Add special type for SQL select strings for plugins to consume 2019-03-07 14:56:18 -05:00
Matthew Brown
48b39a15b9 Don’t change value of $this by reference 2019-03-03 20:16:11 -05:00
Matthew Brown
a31420be5b Fix checks for existing vars used in by-ref assignments 2019-03-03 18:21:12 -05:00
Matthew Brown
472cdf6bea Fix #1379 - allow @param-out to change type 2019-03-03 15:11:09 -05:00
Matthew Brown
4cc93644e5 Added more descriptive type for callables
Ref #1408
2019-03-01 09:06:37 -05:00
Matthew Brown
d1cf9d61ba Fix #1398 - improve casting rules for resource 2019-03-01 00:50:22 -05:00
Matthew Brown
8650f9eb1a Fix #1356 - improve assertion system to work better on function calls 2019-02-26 01:03:33 -05:00
Matthew Brown
3ad1abece4 Add generation of json artifacts 2019-02-24 01:33:25 -05:00
Matthew Brown
1c8a573b5f Change TGenericParam to TTemplateParam 2019-02-21 21:40:06 -05:00
Brown
079ac44263 Prevent pass by ref when type type is given 2019-02-20 17:43:12 -05:00
bugreportuser
f603449745 Infer literal string for __namespace__ 2019-02-20 10:55:36 -05:00
Matthew Brown
5777e008c0 Remove var_dump 2019-02-17 13:18:23 -05:00
Bruce Weirdan
8408effe57 Dropped unused uses 2019-02-17 13:17:45 -05:00
Matthew Brown
40a91eab6e Fix #1339 - no crash when using self/static/parent in closure 2019-02-17 13:14:59 -05:00
Matthew Brown
c765d0e969 Fix #1307 - improve generator array type 2019-02-09 15:48:15 -05:00
Matthew Brown
e6f3948f7b Fix #1297 - prevent false positive TypeDoesNotContainType for class const array offset 2019-02-07 16:24:31 -05:00
Matthew Brown
c758678022 Fix remaining issues 2019-02-06 16:08:41 -05:00
Matthew Brown
194bb31221 Fix #204 - allow missing param types to be added with Psalter 2019-02-02 14:16:49 -05:00
Matthew Brown
3a01afbe0a Refine inferred type when possible 2019-02-02 12:10:52 -05:00
Matthew Brown
db89b3cc3f Add initial support for fixing MissingParamType 2019-02-02 11:28:48 -05:00
Brown
661c7ee707 Fix #1256 - detect illegal closure use 2019-01-30 11:36:21 -05:00
Brown
f5a81249e0 Fix #1202 - don’t allow undefined constants in enums 2019-01-15 11:31:13 -05:00
Matthew Brown
0cca0d76cb Fix #813 - allow constant array to be refined with isset 2019-01-13 11:54:39 -05:00
Matthew Brown
9d8c2792e2 Add array-key type and improve general type handling
Fixes #1144
2019-01-05 00:15:53 -05:00
Matthew Brown
87052537cf Fix #1167 - don’t worry about AbstractInstantiation when it could be a descendant 2019-01-04 12:28:00 -05:00
Matthew Brown
10a36def96 Fix issue with by-ref args 2018-12-21 13:53:22 -05:00
Matthew Brown
ca6149ed17 Improve treatment of templated params within function analysis 2018-12-17 23:29:27 -05:00
Matthew Brown
8b5e8402a1 Add support for @param T:class $foo 2018-12-13 00:09:01 -05:00
Matthew Brown
f0969cb3bb Fix getId calls on callable return types
Ref #1119
2018-12-08 14:10:06 -05:00
Matthew Brown
fd0ab47b80 Fix #1118 - detect possible issues with unions of mixed 2018-12-08 13:18:55 -05:00
Matthew Brown
b32000fa05 Fix #689 - add checks for @internal annotations 2018-12-01 18:37:49 -05:00
Matthew Brown
1eb11a43b0 Fix #1102 by supporting class_alias properly 2018-11-29 00:46:34 -05:00