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

48 Commits

Author SHA1 Message Date
Bruce Weirdan
398f5f9970
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-29 11:47:29 +01:00
Matthew Brown
77975167a7
Fix #4951 - add Traversable interface to PDOStatement 2021-01-29 11:47:28 +01:00
orklah
31be6212b7
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-29 11:47:28 +01:00
orklah
c2c25ada84
add ArrayAccess to SimpleXmlElement (#4934)
* add ArrayAccess to SimpleXmlElement

* add test
2021-01-29 11:47:27 +01:00
Holger Woltersdorf
972da55d84
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
2021-01-29 11:47:24 +01:00
orklah
a475b23f0b
fix phpdoc (#4905) 2021-01-29 11:47:23 +01:00
Benjamin Morel
8908877aa0
Change ReflectionUnionType::getTypes() return type (#4903) 2021-01-29 11:47:22 +01:00
Benjamin Morel
44c79daf1a
GEOS stubs (#4902) 2021-01-29 11:47:22 +01:00
Matthew Brown
9405773882
Fix #4874 - remove strok stub 2021-01-29 11:47:22 +01:00
Matt Brown
91115d651f
Use better stubs for Serializable and SoapClient 2021-01-29 11:47:18 +01:00
Matt Brown
9f4c697109
Add more to SimpleXMLElement stub 2021-01-29 11:47:17 +01:00
Matt Brown
551a5d84ab
Add PHP8-compat stub for SimpleXMLElement::current 2021-01-29 11:47:16 +01:00
Alies Lapatsin
c60eada3f7
#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.
2021-01-29 11:47:14 +01:00
Jáchym Toušek
fcf2bc3831
Fix Ds\Sequence::toArray() return type (#4763) 2021-01-29 11:47:13 +01:00
Matt Brown
1c48258fe2
Fix range return type to always non-empty lists 2021-01-29 11:47:04 +01:00
Markus Staab
6474d7ee6c
Declare PdoStatement->fetchObject($class_name) a taint sink (#4701)
* Declare PdoStatement

* Change to a callable sink

Co-authored-by: Matthew Brown <github@muglug.com>
2021-01-29 11:46:26 +01:00
Markus Staab
4206a4f59e
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>
2021-01-29 11:46:25 +01:00
Matthew Brown
51fed99c5d
Fix core return types 2021-01-29 11:46:25 +01:00
orklah
30f1a498a3
restore str_split as a list (#4694) 2021-01-29 11:46:25 +01:00
Matt Brown
8a7a1124a4
Fix some stubs 2021-01-29 11:46:24 +01:00
Lukas Reschke
31c63a6c96
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
2021-01-29 11:46:21 +01:00
Lukas Reschke
4de2bf8f7f
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>
2021-01-29 11:46:19 +01:00
Lukas Reschke
ce05165384
Split LDAP into custom category (#4604)
- Adds ldap_escape as sanitizer
- Defines the right parameters to ldap_search as sink
- Wrote documentation
- Added tests
2021-01-29 11:46:14 +01:00
Michael Stilkerich
aa4372db9a
Stub for preg_filter (#4587) 2021-01-29 11:46:13 +01:00
Matt Brown
7a5ef10bfa
Fix #4578 - replace number type in ext-ds stubs 2021-01-29 11:46:12 +01:00
Matt Brown
e371685c3b
Allow PHP major version to determine substr return type 2021-01-29 11:46:12 +01:00
Lukas Reschke
a1fd92d9fd
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
2021-01-29 11:46:12 +01:00
Matt Brown
1ad65fb899
Fix #4517 - track type contradiction issues in match expressions 2021-01-29 11:46:07 +01:00
Matt Brown
0b32cb93a7
Add ReflectionUnionType stub 2021-01-29 11:46:06 +01:00
Matt Brown
e7a46452f5
Fix #4481 - ReflectionProperty implements Reflector 2021-01-29 11:46:03 +01:00
Matt Brown
b217916f37
Use better inference for getAttributes return type
Fixes #4367
2021-01-29 11:45:00 +01:00
Matt Brown
881068d5c0
Detect when targets are incorrectly targeted 2021-01-29 11:44:36 +01:00
Matt Brown
98b755fb6c
Add support for int-mask<...> and int-mask-of<...> 2021-01-29 11:44:35 +01:00
Jáchym Toušek
597b58d3a4
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>
2021-01-29 11:44:35 +01:00
Matt Brown
7c1c2f77f7
Use softer return 2021-01-29 11:44:35 +01:00
Matt Brown
97dc34bed3
Add polyfill for Stringable interface 2021-01-29 11:44:34 +01:00
Simon Podlipsky
35201697e9
Fix preg_match_all param name (#4416) 2021-01-29 11:44:32 +01:00
Benjamin Morel
36b7186712
Ds\Queue & Ds\Set implement ArrayAccess as well (#4415) 2021-01-29 11:44:32 +01:00
Matt Brown
d027bbf41b
Remove stubs with variadic middle params
Fixees #4377
2021-01-29 11:44:32 +01:00
Benjamin Morel
c4d1ee7cb1
Document ArrayAccess in PHP-DS (#4401) 2021-01-29 11:41:13 +01:00
orklah
c15fabbdcc
changing the templates order to match existing stub in PHPStan (#4332) 2021-01-29 11:39:55 +01:00
Marcus Bointon
fb505df807
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
2021-01-29 11:39:55 +01:00
Pol Dellaiera
9aaf61d220
CachingIterator - Add forgotten constructor parameter. (#4322)
Signed-off-by: Pol Dellaiera <pol.dellaiera@protonmail.com>
2021-01-29 11:39:54 +01:00
Pol Dellaiera
2b437ad672
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>
2021-01-29 11:39:54 +01:00
Matt Brown
278a306681
Do arithmetic for preg_split arguments 2021-01-29 11:39:53 +01:00
Matt Brown
e999728892
Improve preg_split return more 2021-01-29 11:39:53 +01:00
Matt Brown
68526c39ad
Add better return type for preg_split 2021-01-29 11:39:52 +01:00
Matt Brown
a531c2e450
Move static code out of src 2021-01-29 11:39:51 +01:00