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

4793 Commits

Author SHA1 Message Date
Matthew Brown
ce0298acc4 Fix #2704 - array_merge should ignore possibly-false issues where applicable 2020-01-29 21:09:33 -05:00
Matthew Brown
4489b7169d Allow possibly-false return for DOMDocument::saveXML
Fixes #2714
2020-01-29 21:03:34 -05:00
Matthew Brown
c2f1b3b700 Use slightly cleaner way of sorting file issues 2020-01-29 09:00:13 -05:00
Philip Hofstetter
8f8672dd6b
do not corrupt internal state when a baseline is present (#2710)
this fixes #2709
2020-01-29 08:53:58 -05:00
Pavel Batečko
ecf85aef12
Add generic definition of DOMNamedNodeMap (#2703)
* Fix #2638 - propagate phantom classes to recursive calls to Scanner::queueClassLikeForScanning()

* Add generic definition of DOMNamedNodeMap
2020-01-29 08:39:07 -05:00
Matthew Brown
1dc1ebe23a Remove unused variable 2020-01-27 23:19:03 -05:00
Matthew Brown
ff01f41b44 Allow strings in assert annotation 2020-01-27 23:15:50 -05:00
Matthew Brown
5c3ec7a531 Fix #2696 - make sure static property references are prevented in pure functions 2020-01-27 22:55:20 -05:00
Matthew Brown
5f7730c12e
Add slash 2020-01-27 12:26:06 -05:00
Brown
15808458cc Better understand nesting loops and switches
Fixes #2700
2020-01-27 12:17:12 -05:00
orklah
563032c5f2 List notation in callmap (#2693)
* improve multiple return types with list<> + Exception::getTrace details

* fix broken syntax

* seems like changing libxml_get_errors return type angered the CI God

* revert array_count_values
2020-01-27 09:13:15 -05:00
Matthew Brown
dec274a1fe Fix list scanning 2020-01-27 09:07:22 -05:00
Philip Hofstetter
5774cfed7d mark additional impure functions (#2699)
both `fflush` and `vprintf` have very similar cousins already declared
as having side-effects.

This fixes #2687
2020-01-27 08:12:40 -05:00
Barney Laurance
4a4c0f1362 Clarify documentation of --diff and --diff-methods (#2680)
* Clarify documentation of --diff and --diff-methods

* Save Psalm cache in CircleCI
2020-01-25 10:50:11 -05:00
Matthew Brown
8c89760ff3 Use more accurate type for large arraya
Fixes #2690
2020-01-25 10:38:23 -05:00
Brown
c3a989f6a8 Fix bad var 2020-01-24 15:44:18 -05:00
Brown
c09f97ed6e Fix #2691 - allow list to be a callable maybe 2020-01-24 15:09:06 -05:00
Brown
38e9e8ba87 Register methods as used 2020-01-24 14:53:32 -05:00
Brown
548c9f7e65 Remove unused var 2020-01-24 14:09:25 -05:00
Brown
9f077f5aec Fix formatting 2020-01-24 14:08:01 -05:00
Brown
53b0650c6c Fix #2688 - foreach loop evaluation should allow changing loop var 2020-01-24 13:55:30 -05:00
Brown
faf6afdce8 Support call_user_func evaluation
Fixes #726
2020-01-24 13:34:50 -05:00
orklah
ef07e55deb add list<> notation in stubs (#2675)
* add list<> notation in stubs

* change phpdoc to be compatible with expected list<>

* change interface phpdoc to be compatible with expected list<>

* revert array_chunk => special case to handle with preserve keys.

* change array_chunk return to match both behaviour

* revert list<> notation in parameters where not required
2020-01-24 13:17:36 -05:00
Brown
dbdf7473f4 Fix abstract trait method implementation errors when using self 2020-01-24 11:15:35 -05:00
Brown
34d73e7243 Fix #2685 - always evaluate $a++ in unknown call 2020-01-24 10:32:28 -05:00
Matthew Brown
3af48347a9 Bind template params for IteratorIterator 2020-01-24 09:18:31 -05:00
Matthew Brown
efd46b35c5 Fix signatures 2020-01-24 09:10:42 -05:00
Matthew Brown
c893bd6a6b Add IteratorIterator generics 2020-01-24 08:58:52 -05:00
Matthew Brown
c87b19eeb0 Fix #2681 - no error after empty check on literal value 2020-01-23 22:26:49 -05:00
Brown
0ffb833bf3 Fix #2677 - use better assertion for null coalesce 2020-01-23 14:52:35 -05:00
Brown
da43b8188f Fix #2632 - detect invalid by-ref assignments in pure functions 2020-01-23 14:21:34 -05:00
Brown
0ac20e76c4 Fix #2631 - evaluate purity of uasort closure 2020-01-23 13:49:15 -05:00
Brown
311164f5ee Fix #2679 - session_start is impure 2020-01-23 10:26:11 -05:00
Matthew Brown
fa65ab8168 Add support for Github Actions output
Fixes #2678
2020-01-23 07:14:48 -05:00
SignpostMarv
dc80880a80 check if phpstorm meta path is a file or directory (#2643)
* check if phpstorm meta path is a file or directory, making a note if it was a directory, re: #2640

* import is_file()

* overcautiously glob into meta directory
2020-01-22 11:06:06 -05:00
Brown
e68ca6a20b Fix #2661 - catch invalid array_push on property 2020-01-22 09:57:59 -05:00
Matthew Brown
947765c1c6 Improve count checks slightly 2020-01-22 07:51:24 -05:00
Ben Davies
5139d61171 remove unnecessary loops (#2671) 2020-01-22 07:42:00 -05:00
Matthew Brown
8202af957d Index issues by file to reduce some lookups 2020-01-21 21:07:44 -05:00
Brown
0132b3789b Fix #2665 - warn about abstract class interface inheritance issues 2020-01-21 11:46:51 -05:00
Brown
a2e1dfd64e Fix #2667 - don’t check inherited signature return types for accuracy 2020-01-21 11:07:44 -05:00
Brown
36f5c51f01 Allow unpacking of list args with known elements 2020-01-21 10:13:37 -05:00
Matthew Brown
504de0a9ce Catch more UnanalyzedFileExceptions to prevent LSP crash
Fixes #2633
2020-01-20 23:27:56 -05:00
orklah
f2802b6862 fix typo (#2663) 2020-01-20 23:19:48 -05:00
Matthew Brown
db7b537bd1 Fix missing class 2020-01-17 13:19:57 -05:00
Matthew Brown
8ccd4860e3 fclose should treat resource as passed-by-reference 2020-01-17 13:12:00 -05:00
Matthew Brown
1c8af2fdc7 Fix #2658 - catch exceptions thrown inside catch 2020-01-17 12:05:37 -05:00
Matthew Brown
7f093ca8ed Fix #2626 - allow assertions on resource types
Also fixes #2266
2020-01-17 11:55:16 -05:00
Matthew Brown
1697115861 Only set from docblock if not mixed 2020-01-17 10:34:13 -05:00
Matthew Brown
a840743015 Fix #2625 - set template as type from docblock 2020-01-17 10:27:00 -05:00
Matthew Brown
b582c49f51 Fix #2645 - add workarounds for some edgecases 2020-01-17 10:25:05 -05:00
Matthew Brown
2c48d42904 Allow destructuring of callable array
Fixes #2653
2020-01-17 10:02:58 -05:00
Matthew Brown
471d7610f0 Fix #2644 - improve type inference of autoloaded constants 2020-01-17 09:52:43 -05:00
Matthew Brown
24e1d5446c Fix #2642 - merging two explicit lists is still a list 2020-01-17 09:31:08 -05:00
Matthew Brown
adf230e873 Fix #2636 - allow non-empty-list in assert annotation 2020-01-17 09:06:34 -05:00
Alexander Wühr
f9560009ca Allow false as \PDO::fetch return type (#2647) 2020-01-17 08:48:08 -05:00
Matthew Brown
c50fa27025 Identify trait method access level violations as less serious 2020-01-17 00:28:08 -05:00
Matthew Brown
be6cd0f8c6 Fix generation of files in non-psr directory 2020-01-16 23:24:53 -05:00
Matthew Brown
257ebfd205 Improve trait method mismatch failure rules 2020-01-16 22:36:30 -05:00
Bruce Weirdan
17857163fc Modular config files (#2635)
This change introduces an option to have the configuration split across
several files using standard XInclude tags. This may be useful for more
complex configs, or to include auto-generated parts into a manually
written config file.
2020-01-16 15:57:52 -05:00
Tyson Andre
6612bb74a1 Use floor() instead of round() for long progress percentage (#2634)
PHPUnit and many other applications use floor.
Otherwise, the second-last lines would show 100% despite not being
complete.

```
\sprintf(
    ' %' . $this->numTestsWidth . 'd / %' .
    $this->numTestsWidth . 'd (%3s%%)',
    $this->numTestsRun,
    $this->numTests,
    \floor(($this->numTestsRun / $this->numTests) * 100)
)
```
2020-01-16 15:57:09 -05:00
Alfred Bez
619ced135b fixed RarArchive signatures (#2641) 2020-01-16 11:01:14 -05:00
Pavel Batečko
1b0eba74fd Allow NULL $contextnode in DOMXPath::query() (again) (#2637) 2020-01-16 08:35:36 -05:00
Brown
d434f7fb9d Add list identification for late-resolved constants
Fixes #2624
2020-01-15 11:54:01 -05:00
Brown
1b551b805b Fix #2627 - infer arrow function effects for array_filter 2020-01-15 11:40:49 -05:00
Brown
c07fd13f2b Fix #2623 - prevent crash when combining class strings in constants 2020-01-15 11:26:58 -05:00
Matthew Brown
389af1bfc7 Fix #2618 setting list param from docblock 2020-01-14 22:46:19 -05:00
Matthew Brown
4a03c4aedd Fix impossible isset checks 2020-01-14 21:54:02 -05:00
Matthew Brown
c3edbdbc19 Allow checking $_SESSION for null without altering type 2020-01-14 21:51:04 -05:00
Matthew Brown
1202ba45ef
Fix blank line 2020-01-14 18:51:46 -05:00
Brown
df8f2085f0 Change constant type to be more forgiving 2020-01-14 18:39:15 -05:00
Brown
de7a870509 Add better mixed check 2020-01-14 18:38:02 -05:00
Brown
0f6b61d62d Clone isset type before contradicting 2020-01-14 18:28:32 -05:00
Brown
3fd70a9c88 Only set if non-null 2020-01-14 17:03:58 -05:00
Brown
adc658901a Improve inference of constant() calls 2020-01-14 16:56:09 -05:00
orklah
b09869b7c6 callmap changes (#2612)
* set_error_handler return the same type as its param

* a constant can only have scalars, array of scalars or null

* a constant can only have scalars, array of scalars or null
2020-01-14 16:55:25 -05:00
Brown
1ccababcb7 Track list-ness of constant arrays
Fixes #2621
2020-01-14 12:13:41 -05:00
Brown
c79a8ecbc2 Fix dumb 2020-01-14 10:55:07 -05:00
Brown
fcc7d896a0 Commit actual fix 2020-01-14 10:53:54 -05:00
Matthew Brown
42073a800a Remove unevaluated code 2020-01-14 00:55:56 -05:00
Matthew Brown
e1daf26202 Improve support for null coalesce checks 2020-01-14 00:53:38 -05:00
Matthew Brown
b0073d4558 Fix #2614 - prevent isset($string) 2020-01-13 21:27:09 -05:00
Matthew Brown
ef3c2d30c9 Fix #2613 - allow docblock-defined object-like as non-empty-array 2020-01-13 21:05:30 -05:00
Brown
5d15ef062e Fix phpcs 2020-01-13 17:28:00 -05:00
Brown
6c771e5dd3 Prevent crashes under PHP 7.3 on macs in Language server mode 2020-01-13 16:50:09 -05:00
Brown
eb7c3dcc11 Fix #2611 - fix combination of inferred closure return types 2020-01-13 10:23:58 -05:00
Tyson Andre
7a65eb1da9 Fix required parameter after optional in Psalm (#2609)
Psalm supports php 7.1 at minimum, so this is no longer necessary.
2020-01-12 12:46:08 -05:00
Тальгат Хайруллов
39a822759d #2579 TooManyArguments was triggered if the variadic function declared at the autoloader file. Fixed. (#2580) 2020-01-12 11:33:38 -05:00
Mark A. Hershberger
fbc2c21c9b bug: #2103 -- throw error if directories are given instead of file (#2605)
* bug: #2103 -- throw error if directories are given instead of file

* use global is_dir
2020-01-12 10:53:12 -05:00
Pavel Batečko
87debfe954 Support suppressing all issues with @psalm-suppress all (#2584)
* Support suppressing all issues using @psalm-suppress all

* Document @psalm-suppress all
2020-01-12 10:38:32 -05:00
SignpostMarv
9b2ceba2db removing trailing comma in function call, not detectable by php-cs-fixer re: FriendsOfPHP/PHP-CS-Fixer#4135 (#2597) 2020-01-11 16:00:38 -05:00
Matthew Brown
39f0def7bf Add null check 2020-01-11 15:59:28 -05:00
Matthew Brown
131fb97663 Fix #2594 - forbid isset check on null 2020-01-11 15:58:40 -05:00
Matthew Brown
7b887efc2c Fix #2547 - use better conditional check 2020-01-11 12:33:58 -05:00
Matthew Brown
bd846123ce Fix #2560 - handle special case of array_filter on single-element array 2020-01-11 11:54:29 -05:00
Matthew Brown
40406c7ff0 Fix #2576 - remove literal key values if array_filter has no args 2020-01-11 11:48:22 -05:00
Matthew Brown
85966d8a21 Fix #2577 - fix list cast to array 2020-01-11 11:42:09 -05:00
Matthew Brown
2ae85f7c8b Fix #2593 - don’t crash with bad @param-out annotation 2020-01-11 10:47:31 -05:00
Matthew Brown
1b7b71f2ca Fix #2591 - always remove changed var from parent clauses
Even when there are no child clauses due to an assertion
2020-01-10 23:46:45 -05:00
Brown
5ddcab1003 Fix subtraction of string from numeric 2020-01-10 18:05:45 -05:00