1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00
Commit Graph

8447 Commits

Author SHA1 Message Date
Fran Moreno
e89f7e3960
Add mongodb Cursor and CursorInterface stubs and fix WriteConcern::__construct (#5813)
* Add mongodb Cursor and CursorInterface stubs

* Use proper variable name

* Update WriteConcern constructor

Based on https://www.php.net/manual/es/mongodb-driver-writeconcern.construct.php
2021-05-22 19:03:07 -04:00
orklah
c69cf9a849
Allow empty-string in first position of an type (#5814) 2021-05-22 12:36:02 -04:00
Matt Brown
6a61298074 Fix #5810 - detect properties that are never read 2021-05-21 09:25:57 -04:00
Matt Brown
4f9067f5c8 Fix unused properties in Psalm’s own codebase 2021-05-21 09:15:23 -04:00
orklah
4d6be66d98
Prioritize TCallableString handling to avoid simpler checks for TLowercaseString vs TString (#5811) 2021-05-21 07:44:26 -04:00
Matt Brown
4b17cc9a4b Fix #5809 - remove unnecessary issue suppression 2021-05-21 07:35:01 -04:00
yoshifp
110c9ef4e1
Fix typo in configuration.md (#5805) 2021-05-20 10:58:17 -04:00
Matt Brown
964c91c502 Fix skipped test 2021-05-20 10:57:25 -04:00
Matt Brown
3a811f1fb5 Fix/suppress failures 2021-05-19 15:30:36 -04:00
still-dreaming-1
ecb4ca8730
strlen can return positive-int (#5793) 2021-05-19 15:20:56 -04:00
Matt Brown
bbbde2ffa1 Fix empty line 2021-05-19 15:20:28 -04:00
Matt Brown
ccd50fdb34 Fix ##5795 - array casts should always be lists 2021-05-19 15:17:50 -04:00
orklah
f62b83a190
Assert intersection type when two variables are compared (#5774) 2021-05-18 16:14:58 -04:00
Matt Brown
3c43bc1522 Fix #5789 - prevent incorrect return type inference when all cases return 2021-05-18 08:52:41 -04:00
pawel-slowik
d82f02879c
Don't migrate virtual nodes (#5780)
* Add a failing test for issue #5002

* Don't try to migrate virtual nodes

Fixes #5002
2021-05-17 22:21:32 -04:00
Matt Brown
9eda9f9bbf Fix cs 2021-05-17 19:44:55 -04:00
still-dreaming-1
a62ee22adb
htmlspecialchars can return non-empty-string (#5785) 2021-05-17 19:43:08 -04:00
Matt Brown
21456f51e6 Only call ScopeAnalyzer once on whole function body 2021-05-17 18:52:25 -04:00
Matt Brown
787c0f30d6 Fix #5784 - only real-asserted variables from context knowledge
Any assertions added in the addNestedAssertions method should not illegitimise current knowledge
2021-05-17 15:11:27 -05:00
Matt Brown
836587ec1d Fix combination of end states with never 2021-05-17 12:35:27 -05:00
orklah
ff0c1ce567
update hardcoded Psalm version (#5783)
* change hardcoded Psalm version to something more recent

* change hardcoded Psalm version to something more recent
2021-05-17 08:27:08 -05:00
Matt Brown
9635ca620c Correctly interpret continue 2 in nested loops 2021-05-17 08:26:38 -05:00
orklah
4c4d574bed
better inference of string increment (#5777)
* better inference of string increment

* fix combination
2021-05-17 07:44:53 -05:00
Matt Brown
f6bdeb6234 Fix switch-with-continue bug 2021-05-17 07:27:58 -05:00
olsavmic
2f6d2e8ef7
Fix CS (#5781) 2021-05-17 07:27:46 -05:00
orklah
6501ca7b95
Redundant cast to Int preserve type (#5773)
* Redundant cast to Int preserve type

* add test
2021-05-15 07:19:18 -04:00
Matt Brown
1195335078 Fix #5768 - call methods with proper params 2021-05-14 22:50:11 -04:00
Samuel Parkinson
264c454ad0
Add issue link to GitHub Actions report (#5759)
If an issue link is available, include it in the annotations on GitHub.
2021-05-14 20:24:19 -04:00
orklah
55079e92fe
Mixed contains everything (#5763) 2021-05-14 20:23:54 -04:00
olsavmic
4fb2b65164
Fix ArrayFillReturnTypeProvider - consider second param (#5770)
Add test

Fix
2021-05-14 20:12:39 -04:00
Matt Brown
5f780e7ef7 Improve count inference 2021-05-14 20:12:28 -04:00
Matt Brown
c4aea7c82c Fix #5434 - prevent crash with class-string-map 2021-05-14 19:44:11 -04:00
orklah
1bb4a05725
NullsafeMethodCall makes the variable not null for the rest of the scope (#5771) 2021-05-14 19:21:01 -04:00
orklah
0b96f40198
quote offset value (#5760) 2021-05-14 17:19:23 -04:00
Matthew Brown
5e8219b613 Fix #5327 - add check to prevent OOMing on very large conditionals 2021-05-14 14:53:53 -04:00
Marco Pivetta
641587635d
Fix #5761 by marking all opcache_ functions as impure, as they are affected by runtime/engine (#5762)
Quoting original issue (fixes #5761):

> Given this snippet ( https://psalm.dev/r/4d51eeab35 ):
>
> ```php
> <?php
>
> function invalidate_cache_for(string $path): void {
>     opcache_invalidate($path);
> }
>
> invalidate_cache_for('foo');
> ```
>
> Psalm reports the `opcache_invalidate()` call as `UnusedFunctionCall`. I'm wondering if `opcache_invalidate()` is perhaps inferred as a pure function? The only reference to it that I could find is in 1a59e81808/dictionaries/CallMap.php, but no purity markers are there.
>
> I'd gladly fix these, if I could get a pointer to where purity is determined.
2021-05-13 21:18:00 -04:00
Matthew Brown
3797d7920f Add slashes 2021-05-13 21:14:54 -04:00
Matthew Brown
bb8ce8817d Simplify a bit of logic in switch analysis 2021-05-13 17:31:17 -04:00
Matthew Brown
18931295c4 Fix #5073 — don’t crash when templates cannot be resolved 2021-05-13 16:55:22 -04:00
Matthew Brown
2ebf97b4cb Fix #4910 - don’t allow array_merge to create massive keyed arrays 2021-05-13 16:27:05 -04:00
Matthew Brown
78ed9404cb Fix #4107 - resolve reference to static in class constant 2021-05-13 12:49:33 -04:00
Matthew Brown
cc7ff94f7c Prevent crash when method being called does not exist in reflection
Crash seen when running this test in PHP 7.4 because the method does not exist, but the call map includes it in 8.0
2021-05-13 12:40:39 -04:00
Matthew Brown
4873f53f69 Fix issue when two continue/break statements write same variable 2021-05-13 09:39:25 -04:00
Matthew Brown
f6e4fb1263
Analyse real projects with PHP 8.0 2021-05-13 09:34:32 -04:00
orklah
1a59e81808
allow scalar values in return to be accepted, even when the branch has no inferred types (#5749) 2021-05-12 18:47:05 -04:00
orklah
ab1732de66
combining never/empty twice gives never (#5756) 2021-05-12 18:46:37 -04:00
40bc7cf294
callable-string is always a non-empty-string (#5741) 2021-05-10 11:47:32 -04:00
orklah
72022139fa
improve array_splice inference (#5738) 2021-05-10 11:45:52 -04:00
Matthew Brown
859b4a2caa Fix #5725 – don’t transform non-docblock types unnecessarily 2021-05-09 12:03:42 -04:00
Vincent Langlet
587b144f0e
Check for ParamName even for method with only one param (#5732)
* Check for ParamName even for method with only one param

* Fix tests
2021-05-08 19:33:48 -04:00