1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 12:55:26 +01:00
Commit Graph

211 Commits

Author SHA1 Message Date
orklah
1149050817
adapt bcdiv for PHP8 in stubs (#5401) 2021-03-16 13:45:54 -04:00
orklah
1a3ff5676a
fix stub for array_combine + remove false in PHP8 + improve tests (#5395) 2021-03-16 13:43:49 -04:00
orklah
dd4d970a37
makes array_combine return non-empty-array for most cases (#5393)
* makes array_combine return non-empty-array for most cases

* Add back newline

Co-authored-by: Matthew Brown <github@muglug.com>
2021-03-14 21:18:19 -04:00
Matt Brown
c97ee5ccdb Fix #5258 - allow ReflectionParameeter::hasType() to inform getType() return 2021-03-06 16:54:23 -05:00
Matt Brown
c05a3ea073 Break up CoreGenericClasses 2021-03-06 16:05:14 -05:00
Bruce Weirdan
841efbdfaf
Make WeakMap generic (#5313) 2021-03-02 22:25:19 -05:00
Matt Brown
e60c333f2d Fix completion of Foo:: before an if statement 2021-02-15 11:12:04 -05:00
Tarmo Leppänen
ede95105ac
Update CoreImmutableClasses.phpstub (#5218)
Fixes wrong parameter names - https://psalm.dev/r/8cfdb309d9
2021-02-14 12:07:39 -05:00
Vincent Langlet
a80d5b736b
Rename stub to avoid phpstorm conflict (#5213) 2021-02-13 18:42:34 -05:00
Matt Brown
98ff5b5f8a Fix #5099 - use class constant for default 2021-01-26 21:33:52 -05:00
Lukas Bestle
fdb181fe00
Stubs: Don't explicitly depend on \Stringable (#5037)
Fixes #5007.
2021-01-17 10:56:24 -05:00
orklah
7997766e8b
use coherent annotations (#5031) 2021-01-17 10:54:45 -05:00
orklah
26f756d244
remove signature return types in stubs (#5014)
* remove return types from signatures for some stubs

* fix duplicate type
2021-01-14 16:34:22 -05:00
Bruce Weirdan
7007000a68
Allow Attribute::IS_REPEATABLE (#4971)
This allows Attribute::IS_REPEATABLE to be specified as attribute flag.

Fixes vimeo/psalm#4892, vimeo/psalm#4970
2021-01-10 21:55:06 -05:00
Matthew Brown
ec4c7bde73
Fix #4951 - add Traversable interface to PDOStatement 2021-01-07 15:53:19 -05:00
orklah
0e17a3354f
add stubs for standard iterators (#4725)
* add stubs for standard iterators

* Apply suggestions from code review cc @weirdan

Co-authored-by: Bruce Weirdan <weirdan@gmail.com>

* complete stub + delete code made redundant by stubs + fix some syntax in stubs

* fix parse error

Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
2021-01-07 10:07:07 -05:00
orklah
665170eadb
add ArrayAccess to SimpleXmlElement (#4934)
* add ArrayAccess to SimpleXmlElement

* add test
2021-01-06 09:44:12 -05:00
Holger Woltersdorf
30696f9089
Add missing param for constructor arguments in PDOStatement#fetchObject (#4915)
* Add missing param for constructor arguments

PDOStatement#fetchObject allows a second, optional parameter for constructor arguments, which - if given - will be passed to the given class' constructor.
See: https://www.php.net/manual/de/pdostatement.fetchobject.php

Also see the PhpStorm stubs: https://github.com/JetBrains/phpstorm-stubs/blob/master/PDO/PDO.php#L1441

* Fix wrong nullability for 2nd argument in PDOStatement#fetchObject
2020-12-31 00:59:10 +00:00
orklah
1d9987e0ed
fix phpdoc (#4905) 2020-12-29 11:42:41 +00:00
Benjamin Morel
5341eec951
Change ReflectionUnionType::getTypes() return type (#4903) 2020-12-29 11:40:19 +00:00
Benjamin Morel
2be2f1eb1a
GEOS stubs (#4902) 2020-12-29 11:39:46 +00:00
Matthew Brown
3390097b35 Fix #4874 - remove strok stub 2020-12-21 17:14:25 +00:00
Matt Brown
387ab14bda Use better stubs for Serializable and SoapClient 2020-12-08 11:27:51 -05:00
Matt Brown
d8df622ab4 Add more to SimpleXMLElement stub 2020-12-07 01:30:41 -05:00
Matt Brown
b30842e981 Add PHP8-compat stub for SimpleXMLElement::current 2020-12-06 11:04:16 -05:00
Alies Lapatsin
c07cba8da4
#4772 Mark 3rd argument of get_headers nullable and optional (#4774)
There is no documentation that $context is nullable but it’s better to mark is nullable and use default value so psalm will not ask to use all 3 parameters.
2020-12-03 23:14:43 -05:00
Jáchym Toušek
0d977f7341
Fix Ds\Sequence::toArray() return type (#4763) 2020-12-03 09:28:26 -05:00
Matt Brown
0ea4a702ed Fix range return type to always non-empty lists 2020-11-27 20:09:53 -05:00
Markus Staab
8a0feaffa9
Declare PdoStatement->fetchObject($class_name) a taint sink (#4701)
* Declare PdoStatement

* Change to a callable sink

Co-authored-by: Matthew Brown <github@muglug.com>
2020-11-25 15:50:19 -05:00
Markus Staab
d393b4a69d
Added PDOStatement->fetchObject() stub (#4693)
* Added PDOStatement->fetchObject() stub

* fix stub param

* fix Xdebug spelling

* Use extension_loaded check instead

Co-authored-by: Matthew Brown <github@muglug.com>
2020-11-25 12:08:04 -05:00
Matthew Brown
1320081d27
Fix core return types 2020-11-25 11:49:51 -05:00
orklah
45c6189190
restore str_split as a list (#4694) 2020-11-24 15:01:46 -05:00
Matt Brown
27b7de285e Fix some stubs 2020-11-24 10:44:33 -05:00
Lukas Reschke
7ac42551de
Add some more flows (#4659)
* Add some more flows

- Adds all relevant JSON flows https://www.php.net/manual/en/ref.json.php
- Adds all relevant misc flows https://www.php.net/manual/en/ref.misc.php
- Adds a small subset of URL flows https://www.php.net/manual/en/ref.url.php

* Update CoreGenericFunctions.phpstub
2020-11-22 12:09:55 -05:00
Lukas Reschke
3943b55f8a
Add psalm-flow for string functions from sscanf to wordwrap (#4591)
* Add string functions from sscanf to wordwrap

This should conclude all string functions from https://www.php.net/manual/en/book.strings.php

Continuation of https://github.com/vimeo/psalm/pull/4576

Ref https://github.com/vimeo/psalm/issues/3636

* Add StrTrReturnTypeProvider

* Fix psalm error

* phpcs

* Line length

* Ignore false return on vsprintf

Co-authored-by: Matthew Brown <github@muglug.com>
2020-11-21 17:35:07 -05:00
Lukas Reschke
ddbfbb28e6
Split LDAP into custom category (#4604)
- Adds ldap_escape as sanitizer
- Defines the right parameters to ldap_search as sink
- Wrote documentation
- Added tests
2020-11-18 11:39:36 -05:00
Michael Stilkerich
fec51eac8d
Stub for preg_filter (#4587) 2020-11-17 15:15:29 -05:00
Matt Brown
fda2377812 Fix #4578 - replace number type in ext-ds stubs 2020-11-16 21:50:23 -05:00
Matt Brown
42802e11d1 Allow PHP major version to determine substr return type 2020-11-16 16:31:33 -05:00
Lukas Reschke
6780b01453
Add more Psalm flows for string functions (#4576)
This adds string functions from
https://www.php.net/manual/en/ref.strings.php

This commit adds the flows for functions from "addcslashes" to "sprintf".
More are to follow in later commits.

Ref #3636
2020-11-16 15:50:07 -05:00
Matt Brown
e97a9c86eb Fix #4517 - track type contradiction issues in match expressions 2020-11-09 10:00:53 -05:00
Matt Brown
114440cb81 Add ReflectionUnionType stub 2020-11-08 14:22:32 -05:00
Matt Brown
e9dd16f336 Fix #4481 - ReflectionProperty implements Reflector 2020-11-05 09:29:20 -05:00
Matt Brown
938cebc9f8 Use better inference for getAttributes return type
Fixes #4367
2020-10-30 17:37:16 -04:00
Matt Brown
579327a470 Detect when targets are incorrectly targeted 2020-10-30 13:28:45 -04:00
Matt Brown
4ea87b9054 Add support for int-mask<...> and int-mask-of<...> 2020-10-30 13:28:45 -04:00
Jáchym Toušek
8929bde535
Add psalm-mutation-free to ext-ds (#4425)
* Add psalm-mutation-free to ext-ds

* Update ext-ds.php

* Update stubs/ext-ds.php

Co-authored-by: Jáchym Toušek <enumag@gmail.com>

Co-authored-by: Matthew Brown <github@muglug.com>
2020-10-29 19:55:10 -04:00
Matt Brown
438bcc6ab7 Use softer return 2020-10-29 16:14:16 -04:00
Matt Brown
0344ff6858 Add polyfill for Stringable interface 2020-10-28 00:55:53 -04:00
Simon Podlipsky
6bbf06f7cc
Fix preg_match_all param name (#4416) 2020-10-26 11:53:03 -04:00
Benjamin Morel
b01c56f1ef
Ds\Queue & Ds\Set implement ArrayAccess as well (#4415) 2020-10-25 21:16:12 -04:00
Matt Brown
5cda754a9c Remove stubs with variadic middle params
Fixees #4377
2020-10-25 21:07:13 -04:00
Benjamin Morel
b4c7b66ccc
Document ArrayAccess in PHP-DS (#4401) 2020-10-22 20:28:39 -04:00
orklah
6aa4f17cb7
changing the templates order to match existing stub in PHPStan (#4332) 2020-10-14 20:01:25 -04:00
Marcus Bointon
e172e88274
Fix preg_match_all stub (#4325)
* preg_match_all can return false

* Test for preg_match_all returning false

* Fix test

* Add @psalm-ignore-falsable-return
2020-10-14 19:59:07 -04:00
Pol Dellaiera
446a833d18
CachingIterator - Add forgotten constructor parameter. (#4322)
Signed-off-by: Pol Dellaiera <pol.dellaiera@protonmail.com>
2020-10-13 11:48:37 -04:00
Pol Dellaiera
31c924c314
Add more standard iterators (#4320)
* Add CachingIterator, LimitIterator, InfiniteIterator, CallbackFilterIterator, NoRewindIterator.

Signed-off-by: Pol Dellaiera <pol.dellaiera@protonmail.com>

* Add related Iterator tests.

Signed-off-by: Pol Dellaiera <pol.dellaiera@protonmail.com>
2020-10-13 11:35:49 -04:00
Matt Brown
bb7d7132f7 Do arithmetic for preg_split arguments 2020-10-12 20:26:02 -04:00
Matt Brown
2ac2da6079 Improve preg_split return more 2020-10-12 19:16:48 -04:00
Matt Brown
f83b50460a Add better return type for preg_split 2020-10-12 13:04:28 -04:00
Matt Brown
f3b05f5ab5 Move static code out of src 2020-10-12 00:59:19 -04:00