1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-11 16:59:45 +01:00
Commit Graph

55 Commits

Author SHA1 Message Date
ralila
8fb2e0f885 Handle some partials 2021-12-04 21:55:53 +01:00
orklah
1f02795e42 fix missing implicit __toString 2021-10-20 19:54:32 +02:00
Matt Brown
d8f4eb2d6d Restrict type of implode to prevent Array-to-string conversion; 2021-06-21 19:55:27 -04:00
Bruce Weirdan
9e19653a72
Infer never return type (#5710)
* Allow __toString to return never

Fixes vimeo/psalm#5653

* Push $return_is_exit down

* Produce unique control actions

* Test suggesting `@return never`
2021-05-05 01:22:29 -04:00
AndrolGenhald
d4590711d6
Fix object-like array keys when combining string and automatic keys (fixes #5427). (#5428)
* Fix object-like array keys (fixes #5427).

* Fix incorrect return types for tests.

* Fix false positive list with literal int key.
2021-03-19 21:44:44 -04:00
Bruce Weirdan
71a0457284
Emit ImplicitToStringCast in more places (#5344)
* Emit ImplicitToStringCast in more places

Fixes vimeo/psalm#5320

`to_string_cast` is set on successful comparison, thus it needs to
always bubble up (it will be ignored in UnionTypeComparator if some part
does not match).

* Fix implicit casts

* Fix handling of string method references in self-out context
2021-03-11 00:07:39 -05:00
Matt Brown
82f35c1454 Ensure Stringable is always available to tests that need it 2020-10-29 19:41:10 -04:00
Matt Brown
a3755a1d1f Fix tests 2020-10-27 22:29:49 -04:00
Matt Brown
aeeb1e6b90 Fix test type 2020-10-27 18:10:53 -04:00
Matt Brown
d00a02a06b Fix #4429 - any class with a __toString method in PHP8 assumed to implement Stringable 2020-10-27 15:41:04 -04:00
Matt Brown
7cf6495461 4.x - skip Stringable test if not in PHP 8.0 2020-10-12 11:35:14 -04:00
Matt Brown
d532133325 Add support for Stringable 2020-10-04 00:17:16 -04:00
orklah
ead107fa9e
More return types (#4173)
* add native return types

* redundant phpdoc
2020-09-12 11:24:05 -04:00
Brown
ab29ac0e51 Only cast in echo when tracking taints 2020-06-29 15:06:11 -04:00
Brown
1a582fa636 Change InvalidArgument to InvalidCast in test 2020-06-29 12:55:12 -04:00
Brown
9bfe50b20a Always analyse cast expressions
Fixes #3577
2020-06-12 17:25:46 -04:00
Nobu Funaki
abef8008bc
Fix InvalidCast after is_callable([$val, '__toString']) check (#3372)
Support is_callable() with an array argument similar to method_exists()
2020-05-16 08:50:43 -04:00
Brown
e65bffc94f Support intersections with __toString
Fixes #3149
2020-04-26 20:04:41 -04:00
Matthew Brown
933dff9e20 Fix #2712 - allow __toString to have more specific type 2020-01-29 22:28:40 -05:00
Brown
43041836dd Fix #2026 - add support for calling __toString implicitly after method_exists 2019-08-16 11:33:58 -04:00
Brown
e85794038f Fix #1704 - improve type coercion complaints 2019-05-29 14:22:15 -04:00
Brown
57a585240c Allow is_subclass_of/is_a to inform shape of mixed arg 2019-05-06 10:06:05 -04:00
Matthew Brown
c772914910 Add some formatting 2019-03-23 14:27:54 -04:00
Matthew Brown
472ab29d74 Add PossiblyInvalidCast for more refined checks 2019-03-17 17:10:51 -04:00
Matthew Brown
e3d8ebf612 Add test for #1451 2019-03-17 16:41:34 -04:00
Matthew Brown
bf586bf93b Fix #1471 - report issue with string casting inside string 2019-03-17 16:31:56 -04:00
Bruce Weirdan
9bdc9f774f More provider typing 2019-03-02 08:43:19 -05:00
Matthew Brown
d1cf9d61ba Fix #1398 - improve casting rules for resource 2019-03-01 00:50:22 -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
4688b25fd9 Move internal classes to own namespace 2018-11-12 11:20:59 -05:00
Brown
0352babece Fix buggy handling of class with __toString being passed to string|object 2018-10-04 15:29:01 -04:00
Matt Brown
dce8d14e1b Fix syntax errors in tests 2018-09-17 12:15:45 -04:00
Matt Brown
f844f86a6c Improve type coercion checks in strict mode 2018-08-28 17:42:39 -04:00
Matthew Brown
1946bc0085 Allow resource to be cast to string 2018-04-30 00:19:35 -04:00
Matthew Brown
33be97b1f8 Check for to-string casts in strict operands mode 2018-03-18 14:42:23 -04:00
Matthew Brown
e862e4ddb1 Make all plugin methods static
cc @TysonAndre
2018-02-11 20:56:34 -05:00
Matt Brown
2120d258a4 Fix formatting of return type adder 2018-01-11 15:50:58 -05:00
Matthew Brown
52fc81e4ab Remove need for a __toString return type
Fixes #364
2017-12-05 23:47:50 -05:00
Matthew Brown
9774131876 Fix #224 - explicit string casts fail when no __toString present 2017-10-07 11:27:54 -04:00
Matt Brown
10b511284a Improve null coalesce test and improve linting 2017-06-20 14:38:13 -04:00
Matthew Brown
72e1221a2f Fix #168 and add test case 2017-06-11 19:20:07 -04:00
Matthew Brown
d6909193ea Add additional formatting changes 2017-05-26 20:05:57 -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
dc26d2df04 Fix #144 - prevent innaccurate __toString warning 2017-04-21 14:23:09 -04:00
Matt Brown
a7872472be Add stubbing tests and modify config initialisation 2017-01-31 19:22:05 -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
Matt Brown
6e6106c080 Add docblocks to tests 2017-01-13 14:07:23 -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
8b5e066ba6 Add case-sensitive function names 2016-12-30 13:09:00 -05:00