1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-03 10:07:52 +01:00
Commit Graph

6574 Commits

Author SHA1 Message Date
Brown
b0455adced Fix #3177 - prevent crash by using inherited templates 2020-04-18 11:48:22 -04:00
Brown
5180ce1f54 Improve template assertion reconciliation
Fixes #3144
2020-04-18 11:22:06 -04:00
Grégoire Paris
b47306ad3b
Account for PDOException (#3175)
Probably for legacy reasons, PDOException::getCode() can return string (it's an
SQLSTATE code). Note that if you instantiate it yourself, you will get
an integer though.

I changed the signature of the Exception stub accordingly, and then
there were errors about incompatible signatures, so I had to change the
signature of Throwable too, which makes sense since a Throwable could be
a PDOException. The signature at
https://www.php.net/manual/en/throwable.getcode.php seems plain wrong,
and that same page of the docs warns about PDOException. Not sure what
are the plans for future versions of PHP.
2020-04-18 10:39:23 -04:00
Brown
e699004dab Improve names a little 2020-04-18 00:59:16 -04:00
Valentin Udaltsov
9b8e8ab964 Support non-empty-arrays in array_keys (#3168)
Closes #3160
2020-04-18 00:56:54 -04:00
Brown
d54f9bca17 Allow nested template resolution 2020-04-18 00:56:24 -04:00
Grégoire Paris
bc91de015e
Mark throwable methods as pure (#3171)
* Write stub as valid PHP

This works probably because it is not parsed by PHP but by something
more tolerant, but let's make it more valid (the final access type in
the signature is not valid) PHP anyway, that will raise fewer eyebrows.

* Document actual return type

See ca006e54e3/Zend/zend_exceptions.stub.php (L8)

* Mark all methods from Throwable as mutation free

Exception is the only possible class implementation of Throwable, and
all of its methods except __toString() are final.
See ca006e54e3/Zend/zend_exceptions.stub.php (L3-L25)

Closes #3170
2020-04-17 22:08:26 -04:00
Matthew Brown
aa29c7fc9e
Revert "Support non-empty-arrays in array_keys (#3168)" (#3172)
This reverts commit a280e57ecf.
2020-04-17 16:52:08 -04:00
Valentin Udaltsov
a280e57ecf
Support non-empty-arrays in array_keys (#3168)
Closes #3160
2020-04-17 15:07:41 -04:00
Jáchym Toušek
4aac3767f5
Update ext-ds.php (#3165) 2020-04-17 15:07:16 -04:00
Brown
7a759915ee Add arg 2020-04-17 14:40:42 -04:00
Brown
b6fd821172 Fix broken build 2020-04-17 14:39:33 -04:00
Brown
aa3846758e Fix #3153 - narrow template types in conditional branches 2020-04-17 09:53:58 -04:00
Brown
e53c79b66e Break out SimpleNegatedAssertionReconciler 2020-04-17 09:28:42 -04:00
Brown
edc164c549 Simplify conditionals a little 2020-04-17 09:10:33 -04:00
Brown
239234e803 Migrate simple assertions to self-enclosed method 2020-04-17 08:59:15 -04:00
Brown
5ef82b53f6 Fix #3137 - support nested templates in class definitions 2020-04-17 01:16:15 -04:00
Brown
1309eece2e At the very least interpret nested templates as templates 2020-04-17 00:56:11 -04:00
Anthony Rainer
6f36f33630
Added new language server options and functionality. (#3161)
* Added new language server options and functionality.

Added new extended diagnostic code information to the language server.
 -- It must be enabled via a command line switch.
Added telemetry data for language server initialization and operation.
Added verbose log messages for language server.
 -- It must be enabled via a command line switch.

* fixed phpcs issues

* fixed failing tests

* changed the language server reported error code to be the help link

Co-authored-by: Anthony Rainer <0@0ze.ro>
2020-04-17 00:47:18 -04:00
Brown
35d376cbe7 Fix #3164 - allow nested templates in conditional classes 2020-04-17 00:46:27 -04:00
Matthew Brown
6f28ee684a Fix #3156 - only override existing property types with @property suggestions 2020-04-16 00:22:00 -04:00
Jáchym Toušek
7841581122
Update ext-ds.php (#3146) 2020-04-15 07:31:17 -04:00
Brown
2e4aaac5bb Add better inference for date calls 2020-04-14 21:07:44 -04:00
Brown
fbe0669921 Change evaluation order of conditionals 2020-04-14 21:07:16 -04:00
Matthew Brown
e4bfe9e6be Fix #3142 - array_unique should remove count info 2020-04-14 11:08:45 -04:00
Brown
d470903722 Make Algebra::negateFormula a little more safe 2020-04-13 08:47:11 -04:00
Brown
a25610cefd Fix #3133 - prevent crash when analysing isset 2020-04-13 08:34:38 -04:00
Brown
8533b866ab Simplify template bounds message
Ref #3126
2020-04-12 22:19:49 -04:00
Brown
e17cfd8dba Fix #3125 - only apply clauses where applicable 2020-04-12 21:50:10 -04:00
Brown
633b210a32 Fix test 2020-04-12 21:47:50 -04:00
Brown
73f8f963fa Expand out class constants as early as possible
Fixes #3128
2020-04-12 20:38:36 -04:00
Brown
15df39f72f Fix #3127 - allow templated param to be accepted where static is expected 2020-04-12 20:09:49 -04:00
Valentin Udaltsov
29394552a2
Update MixedArgumentTypeCoercion.md (#3129) 2020-04-12 19:52:50 -04:00
Brown
5bc9b095d1 Allow memoisation of ArrayAccess::offsetGet 2020-04-12 14:43:12 -04:00
Brown
5988149272 Prevent checking assertions on $this-> types, always accessible 2020-04-12 14:13:42 -04:00
Brown
9c129f3bac Suppress issue for now 2020-04-12 14:01:17 -04:00
Brown
547efcc022 Prevent ArrayAccess on object from being memoised 2020-04-12 14:00:12 -04:00
Brown
c733d6d373 Only perform assertions where the property type is known
cc @m0003r
2020-04-12 12:56:33 -04:00
Brown
110df3e4f1 Fix ProjectAnalyzer test 2020-04-12 12:02:19 -04:00
Brown
95ec189e0b Remove Amp stubs 2020-04-12 11:47:10 -04:00
Brown
370ffa28e4 Fix #3117 - invalidate all caches when composer lockfile changes 2020-04-12 11:41:37 -04:00
m0003r
77270dc9b7
Getters automagic (#3122)
* When method is a plain getter: (1) correct method return type if property type is known (2) auto assert-if-true that corresponding property is not falsy

* do not use getter automagic if getter is overridden somewhere
2020-04-12 08:40:24 -04:00
Brown
ee50542b8f Allow users to disable caching full files 2020-04-12 08:34:57 -04:00
Brown
9d2957d339 Fix a few more edge-cases 2020-04-12 01:26:11 -04:00
Brown
7dfa37beb2 Improve ergonomics of array assignment 2020-04-11 17:50:24 -04:00
Jose Maria Valera Reales
2fe8717639
Add missing output-format "text" to available formats examples (#3120) 2020-04-11 11:18:44 -04:00
Brown
d530fce4b3 Fall through with PossiblyInvalidIterator issue 2020-04-11 11:17:54 -04:00
Brown
739f2c7faf Fix array key type 2020-04-11 08:12:28 -04:00
Brown
308248e8b3 Ignore referencedMethod issues created by newest php-parser 2020-04-10 18:27:07 -04:00
Brown
db7447abd7 Make array coercion-to--mixed rules a little more lenient 2020-04-10 16:21:48 -04:00