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

130 Commits

Author SHA1 Message Date
ralila
fdaed941ad use return type hints instead of php doc "@return void" 2021-11-26 20:59:41 +01:00
orklah
e2bb9859e4 fix tests 2021-11-01 22:27:43 +01:00
Justin
780c0307e7
Test should fail on 8.0, but not on 7.4 2021-07-03 05:01:10 -04:00
Justin
f7a2aaef6e
Update DateTime and DateTimeImmutable signatures
`DateTime::format` and `DateTimeImmutable::format` will always
return a string starting in PHP 8.0.
2021-07-03 04:29:54 -04:00
Bruce Weirdan
6abce3525a
Enforce use sort (#5900) 2021-06-07 22:55:21 -04:00
Matt Brown
f3fc112bae Fix #4523 - fix short-circuiting for properties and method calls 2021-06-01 16:06:12 -04:00
Matt Brown
4b17cc9a4b Fix #5809 - remove unnecessary issue suppression 2021-05-21 07:35:01 -04:00
Matthew Brown
cc7ff94f7c Prevent crash when method being called does not exist in reflection
Crash seen when running this test in PHP 7.4 because the method does not exist, but the call map includes it in 8.0
2021-05-13 12:40:39 -04:00
Bruce Weirdan
0189420814
Inherit class-level suppressions when checking methods (#5708)
Fixes vimeo/psalm#5687
May fix vimeo/psalm#3357
2021-05-03 22:26:56 -04:00
Matt Brown
a469c82653 Fix #5587 - detect final class calls when routed through parent 2021-04-06 12:35:09 -04:00
AndrolGenhald
d4590711d6
Fix object-like array keys when combining string and automatic keys (fixes #5427). (#5428)
* Fix object-like array keys (fixes #5427).

* Fix incorrect return types for tests.

* Fix false positive list with literal int key.
2021-03-19 21:44:44 -04:00
Bruce Weirdan
3209ef76fe
Remove ReflectionType::getName(), move ReflectionType::isBuiltin() (#5090)
* Remove ReflectionType::getName(), move ReflectionType::isBuiltin()

* `ReflectionType::getName()` was never there: https://3v4l.org/1iZt4
* `ReflectionType::isBuiltin()` was moved to
`ReflectionNamedType::isBuiltin()` in PHP 8

Fixes vimeo/psalm#5089

* Fix test

* Mark test as php 8.0 only
2021-01-24 13:31:10 -05:00
2e3s
d8d6811ed4
Memoize private inferred mutation-free methods (#4832) 2020-12-12 10:26:14 -05:00
orklah
b6a3282589
Detect redundant cast (#4695)
* detect redundant cast

* fix redundant cast issues

* fix redundant cast in tests
2020-11-25 12:04:48 -05:00
Benjamin Morel
5748a4e25a
Fix PdoStatementReturnTypeProvider (#4683)
* Fix PdoStatementReturnTypeProvider

Methods returning scalars may return null as well.

* Fix tests
2020-11-23 18:41:12 -05:00
orklah
ead107fa9e
More return types (#4173)
* add native return types

* redundant phpdoc
2020-09-12 11:24:05 -04:00
Brown
f78fbbe4c9 Fix #4146 - allow null checks on Iterator::current output 2020-09-07 11:40:36 -04:00
Brown
92239add4d Add some backwards-incompatible changes for 4.x 2020-08-30 11:44:14 -04:00
Brown
346d475f55 Create empty params by default for SplObjectStorage
Fixes #4055
2020-08-25 11:52:21 -04:00
Brown
262bb9fd89 Invalidate memoized getter method results after property assignment 2020-07-16 12:59:49 -04:00
Brown
b361b44889 Rip out plain getter property logic cc @m0003r
It gets in the way of the other IMO more useful memoisation logic (e.g. when a getter is declared final)
2020-07-16 12:42:59 -04:00
Brown
96bfd144df Fix #3825 - ensure final getters are treated as mutation free 2020-07-16 11:58:27 -04:00
Brown
c95ebfeb21 Fix #3694 - allow two args for PDO::query 2020-06-26 18:26:06 -04:00
Brown
cf92361338 Fix #3522 - only use property pass-through when it’s visible 2020-06-04 16:15:07 -04:00
Brown
f6aa9cb11b Relocate tests 2020-06-04 16:07:00 -04:00
Brown
618a54ff41 Fix #3240 - check arguments when class cannot be found 2020-05-02 22:13:59 -04:00
Brown
aceaf6c356 Fix #3217 - don’t override abstract return type with parent one 2020-05-02 21:57:53 -04:00
Brown
5988149272 Prevent checking assertions on $this-> types, always accessible 2020-04-12 14:13:42 -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
Matthew Brown
3ebb5a1142 Fix #1843 - ignore intersection TooManyArguments issues 2020-03-15 14:01:33 -04:00
Matthew Brown
0022de1f13 Fix #946 - allow too many arguments when one of union agrees 2020-03-15 13:44:00 -04:00
Matthew Brown
8f28f41399 Improve magic checks 2020-03-11 18:42:41 -04:00
Matthew Brown
0d62fbdf98 Detect erroneous abstract static method calls 2020-03-11 10:18:40 -04:00
Brown
40a7a1156f Fix #2930 2020-03-09 09:45:35 -04:00
Matthew Brown
7ea06c7b1a Only emit PossiblyUndefinedVariable issue on variables 2020-03-05 23:40:47 -05:00
Matthew Brown
b2678d40aa Revert "Fix #2909 - don’t treat args of unknown calls as possible by-reference vars"
This reverts commit 105fe012c4.
2020-03-05 21:10:29 -05:00
Matthew Brown
105fe012c4 Fix #2909 - don’t treat args of unknown calls as possible by-reference vars 2020-03-04 23:49:06 -05:00
Matthew Brown
c1bcd3ce12 Add another test 2020-02-27 08:59:43 -05:00
Brown
89a0b101e4 Fix #2784 - no crash when get_class arg is mixed 2020-02-10 14:44:33 -05:00
Alexander Wühr
f9560009ca Allow false as \PDO::fetch return type (#2647) 2020-01-17 08:48:08 -05:00
Brown
df8e3845e5 Fix #2590 - allow null argument for DateTime when no second arg passed 2020-01-10 15:53:15 -05:00
Dusk
63dea52e76 Add support for most PDOStatement fetch modes (#2553)
Flags like PDO::FETCH_CLASSTYPE and PDO::FETCH_PROPS_LATE aren't
supported yet.

(in re. #2529)
2020-01-06 16:41:52 -05:00
Matthew Brown
53a2f77d00 Add better return type provider for PDO statement
Fixes #2529
2019-12-30 11:34:24 -05:00
Matthew Brown
050eb82f04 Fix #2290 - detect call on void type 2019-11-01 13:05:28 +00:00
lhchavez
216f991b0c Normalize stringified type names (#2239)
This change makes stringified types more normalized. Concretely it sorts
all union types, reconciled types, and sorts the keys within object-like
types.
2019-10-17 01:14:33 -04:00
Brown
9bd7f21a9d Fix #2083 - don’t bludgeon method_exists first type 2019-08-29 14:27:25 -04:00
Matthew Brown
738ba81185 Fix #2046 - trigger PossiblyNullArgument when in union with mixed 2019-08-22 23:26:04 -04:00
Matthew Brown
302ed4b21b Support existing concatenation more better 2019-08-20 00:33:59 -04:00
Matthew Brown
73f245f91d Allow compounding method_exists types with || 2019-08-20 00:00:20 -04:00
Brown
a3e9dec925 Allow multiple method_exists checks to inform type 2019-08-19 10:08:21 -04:00