Marco Pivetta
b4b2bc66c7
Added better stubs for DateTimeImmutable
, highlighting how the constructor is **NOT** immutable
...
`DateTimeImmutable` is **almost** immutable: `DateTimeImmutable::__construct()` is in fact not a pure
method, since `new DateTimeImmutable('now')` produces a different value at each instantiation (by design).
This change makes sure that `DateTimeImmutable` loses its `@psalm-immutable` class-level marker,
preventing downstream misuse of the constructor inside otherwise referentially transparent code.
Note: only pure methods are stubbed here: all other methods declared by `DateTimeImmutable` (parent interface)
are NOT present here, and are either inferred from runtime reflection, or `CallMap*.php` definitions.
Methods are sorted in the order defined by reflection on PHP 8.1.8, at the time of writing this ( https://3v4l.org/3TGg8 ).
Following simplistic snippet was used to infer the current signature:
```php
<?php
$c = new \ReflectionClass(\DateTimeImmutable::class);
$methods = array_map(function ($m) {
return $m->getName()
. '(' . implode(',', array_map(function ($p) {
return $p->getType()
. ' $' . $p->getName()
. ($p->isOptional() ? ' = ' . var_export($p->getDefaultValue(), true) : '');
}, $m->getParameters())) . ')' . ($m->getReturnType() ? (': ' . $m->getReturnType()) : '');
}, $c->getMethods());
$properties = array_map(function ($m) {
return $m->getName();
}, $c->getProperties());
var_dump($methods, $properties);
```
2022-07-31 18:02:30 +02:00
Semyon
b1295d6894
Code style
2022-07-25 17:15:28 +03:00
Semyon
462ce7138a
Make DatePeriod implement Traversable oh PHP 7, rename constructor params
2022-07-25 17:11:36 +03:00
Semyon
9d3253482d
Add stub for DatePeriod
2022-07-25 17:11:36 +03:00
Corey Taylor
f28ac73777
Fix nullable return types for CallMap functions
2022-07-13 22:44:38 -05:00
Adrien Foulon
6c49dad38c
fix: ltrim may return class-string #8218
...
Fixes #8218
2022-07-06 02:36:20 +02:00
Benjamin Morel
df6fdb99d7
Fix return type of ReflectionNamedType::getName()
...
Fixes #8167
2022-06-29 18:22:46 +02:00
Kevin van Sonsbeek
23eff58a09
bugfix/#7912: Add Iterator implements to stub
2022-05-17 23:55:44 +02:00
Kevin van Sonsbeek
f86b599878
bugfix/#7912: Added stub for the APCu extension
2022-05-17 23:45:08 +02:00
hirokinoue
4fc34d998b
improve @return annotation of join()
2022-05-14 23:47:46 +09:00
hirokinoue
91640e7e90
improve @return annotation of implode()
2022-05-14 23:44:43 +09:00
Markus Staab
3c837e5d9a
fix missing is_a() parameter type
2022-05-12 15:37:29 +02:00
hirokinoue
2b34b1228b
handle the non-empty case for usort()
2022-04-29 00:36:28 +09:00
hirokinoue
8c64bddf29
handle the non-empty case for uksort()
2022-04-29 00:23:57 +09:00
hirokinoue
37bf36d475
handle the non-empty case for uasort()
2022-04-28 23:49:32 +09:00
hirokinoue
95b5e8cb56
handle the non-empty case for shuffle()
2022-04-28 23:07:43 +09:00
hirokinoue
1605b18678
handle the non-empty case for rsort()
2022-04-28 23:01:17 +09:00
hirokinoue
0770f0128c
improve syntax
2022-04-28 22:44:39 +09:00
hirokinoue
37c53ee783
handle the non-empty case for sort()
2022-04-23 22:51:50 +09:00
hirokinoue
c6d7bc0d19
Improve Throwable::getTrace() return type
2022-04-12 23:42:37 +09:00
Ciaran McNulty
ca185d7f28
Update Throwable::getTrace in stubs
2022-03-18 09:14:37 +00:00
orklah
7cfb601ab8
Merge pull request #7718 from niconoe-/fix-3036
...
Fix #3036 : make argument $read of internal PHP function stream_socket nullable.
2022-03-13 16:16:35 +01:00
Nicolas Giraud
0dc435409c
Replace changes in the CallMap for stream_select by a stub.
2022-03-11 08:52:36 +01:00
Fran Moreno
ff195e76c9
Allow null to ArrayAccess::offsetSet $offset param
2022-03-06 13:47:32 +01:00
kkmuffme
8fc41e6907
update phpredis stubs
...
* fixes feedback for setOption of https://github.com/vimeo/psalm/issues/7709
* latest WIP stubs with additional changes from upstream phpredis master and other additions
From https://raw.githubusercontent.com/phpredis/phpredis/77334ecbf2c06ea1ff18ea5e3ecc168cb1897a8b/redis.stub.php via https://github.com/phpredis/phpredis/pull/2015
2022-03-04 12:56:30 +01:00
AndrolGenhald
1387f94324
Attribute analysis improvements.
2022-02-23 22:12:32 -06:00
Bei Xiao
40cc346991
Update stub
2022-02-23 00:52:53 +02:00
orklah
c13a536386
Merge pull request #7614 from kkmuffme/add-phpredis-stubs
...
add phpredis stubs
2022-02-11 23:15:48 +01:00
orklah
0702a0b3e7
add ReflectionIntersectionType stub
2022-02-09 19:32:17 +01:00
Office
9d120896d5
add phpredis stubs
2022-02-09 08:14:58 +01:00
Andreas Hennings
9da6b3f094
Issue #6618 : All reflection classes should implement Reflector.
2022-01-06 01:55:55 +01:00
Markus Staab
3de9c68830
pdo: more precise generic type
2022-01-03 17:11:03 +01:00
Markus Staab
457dd2f1c9
typo
2021-12-29 16:56:09 +01:00
Markus Staab
5361cda062
typo
2021-12-29 16:53:47 +01:00
Markus Staab
dd245f0dc5
mysqli_fetch_object: added missing generic
2021-12-29 16:50:38 +01:00
Saif Eddin Gmati
40ab6551a4
fix(stubs): UnitEnum::cases() can return an empty list
2021-12-21 12:06:41 +01:00
Ricardo Boss
f0d7556200
Added pure annotations to enum functions
2021-12-20 23:20:50 +01:00
orklah
c8959bd02a
fix other occurences of getAttributes
2021-12-20 10:19:01 +01:00
orklah
639b1b94a3
fix stub and fix test
2021-12-20 09:57:06 +01:00
orklah
9583d6a7e7
invert stub, add test
2021-12-17 00:12:54 +01:00
orklah
e9073eb059
doesn't infer empty for ReflectionClass::getAttributes without params
2021-12-16 23:39:23 +01:00
orklah
646ba983a0
Merge pull request #7140 from yethee/soap
...
Fixed compatibility with SoapClient
2021-12-15 00:55:57 +01:00
orklah
b2de778fb8
Merge pull request #7156 from simPod/set-map
...
Add Set::map() to ext-ds stub
2021-12-15 00:48:23 +01:00
orklah
93689c2860
add isStatic in stubs to solve the issue
2021-12-14 20:04:33 +01:00
Simon Podlipsky
9f13b73a01
Add Set::map() to ext-ds stub
2021-12-14 10:19:08 +01:00
yethee
0897714964
Update signatures of methods of SoapClient
2021-12-12 19:43:06 +03:00
Bruce Weirdan
3cce69189f
array_count_values return type for uncertain arrays
...
Fixes vimeo/psalm#7114
2021-12-10 02:45:58 +02:00
AndrolGenhald
b29fc6ad3c
Allow operator overloading for Decimal extension ( fixes #3938 ).
2021-12-08 10:59:37 -06:00
marcosh
07224e7d31
abs should always return a positive integer
2021-12-07 11:52:13 +01:00
Bruce Weirdan
9c324a7d74
Refined strlen()
return type to not include negative ints
...
Fixes vimeo/psalm#7062
2021-12-05 21:35:58 +02:00