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

3743 Commits

Author SHA1 Message Date
Matt Brown
14040ed1fa
Add failing testcase for #4705 2021-01-29 11:47:10 +01:00
Matt Brown
024bbef5cd
Fix #4743 - simplify assertions generated from array_key_exists check 2021-01-29 11:47:09 +01:00
orklah
5f9aff5734
support shift and bitwise operations in constants (#4740) 2021-01-29 11:47:07 +01:00
orklah
08d9246b9a
improve Atomic Types documentation (#4735)
* improve Atomic Types documentation

* add doc

* add doc
2021-01-29 11:47:07 +01:00
orklah
4ded1080e3
Check from_docblock property to emit the right issue (#4736) 2021-01-29 11:47:06 +01:00
Matt Brown
9789b53617
Fix #4731 - expand out class-bound generic types when evaluating instance method 2021-01-29 11:47:06 +01:00
Matt Brown
8c33bedfca
Fix #4733 - don’t replace template types when they’re defined on the same class 2021-01-29 11:47:06 +01:00
Matt Brown
fb474c2e07
Expand out constants in param types earlier 2021-01-29 11:47:06 +01:00
Matt Brown
ad5ec9501d
Ensure class template types are mapped to static methods where necessary
Ref #4733
2021-01-29 11:47:06 +01:00
Matt Brown
e9ec1b28a2
Simplify storage and retrieval of extended template params 2021-01-29 11:47:05 +01:00
Matthew Brown
cbd8150fde
Add RedundantPropertyInitializationCheck (#4732)
* Add RedundantPropertyInitializationCheck

* add documentation for RedundantPropertyInitializationCheck (#4734)

Co-authored-by: orklah <orklah@users.noreply.github.com>
2021-01-29 11:47:05 +01:00
Matt Brown
a3cf052314
Remove unset thing 2021-01-29 11:47:05 +01:00
Matt Brown
27c303ee39
Detect some erroneous issets 2021-01-29 11:47:05 +01:00
Matt Brown
9fdc56ff75
Fix template type selection 2021-01-29 11:47:04 +01:00
Bruce Weirdan
d13f0b6a7c
Added test to enforce that all supported annotations are documented (#4723)
* Added test to enforce that all supported annotations are documented

Well, at least mentioned.

Refs vimeo/psalm#3816

* Type things

* Make things pretty

* Only check @psalm- annotations, group

* Add documentation for `@psalm-require-extends` and `@psalm-require-implements`

* Dropped logicalOr that has become redundant

* Add explicit tag

* Document @psalm-template

* Add @psalm-template-covariant

* Document `@psalm-method`

* Add list of undocumented docblock annotations

Co-authored-by: Matthew Brown <github@muglug.com>
2021-01-29 11:47:04 +01:00
Matt Brown
5cf5aecb2f
Fix #3017 - use correct keys when converting list to array 2021-01-29 11:47:04 +01:00
orklah
0df867cdff
fix array_column with possibly_undefined keys (#4719) 2021-01-29 11:47:03 +01:00
orklah
b084e2c4bd
add annotation @psalm-param-out (#4717)
* add annotation @psalm-param-out

* add tag in documentation
2021-01-29 11:47:02 +01:00
Matt Brown
3be31563d6
Add complex issue error 2021-01-29 11:46:28 +01:00
Matt Brown
9089f77176
Turn template bound tuples into object
Ref #4714
2021-01-29 11:46:27 +01:00
orklah
45d058c2dd
better fix for reconciling iterable and object (#4712) 2021-01-29 11:46:27 +01:00
Matt Brown
9539c0f27f
Fix generic ArrayAccess creation cc @orklah 2021-01-29 11:46:27 +01:00
orklah
1966766a79
Allow reconciling between object and iterable (#4706)
* Allow reconciling between object and iterable

* add tests
2021-01-29 11:46:27 +01:00
orklah
1511989521
Fix PHPMAXINT offset (#4707) 2021-01-29 11:46:27 +01:00
Matt Brown
ecbb5c77b2
Fix test failures 2021-01-29 11:46:26 +01:00
Matt Brown
033a209950
Treat $a ?? $b identically to isset($a) ? $a : $b 2021-01-29 11:46:26 +01:00
Matt Brown
5228ff6369
Fix #4699 - treat isset like !== null when variable is defined 2021-01-29 11:46:26 +01:00
orklah
005373bbc2
Detect redundant cast (#4695)
* detect redundant cast

* fix redundant cast issues

* fix redundant cast in tests
2021-01-29 11:46:25 +01:00
Matt Brown
e5f25c7780
Add support for some dependent types 2021-01-29 11:46:25 +01:00
Benjamin Morel
e9c608e7cb
Fix PdoStatementReturnTypeProvider (#4683)
* Fix PdoStatementReturnTypeProvider

Methods returning scalars may return null as well.

* Fix tests
2021-01-29 11:46:24 +01:00
Matt Brown
8155a5c7aa
Fix tests 2021-01-29 11:46:24 +01:00
orklah
597b7aa064
Prevent illegal array keys (#4660)
* Emit an issue when an array-key is not legal

* tests
2021-01-29 11:46:23 +01:00
Matt Brown
401573c696
Fix test 2021-01-29 11:46:23 +01:00
erikjwaxx
62ca9f42bc
Narrow inference of $a <=> $b from "int" to "-1|0|1" (#4680)
* A <=> operator has a literal type of -1|0|1 and not simply int

* Test to verify inferred type of $a <=> $b is -1|0|1
2021-01-29 11:46:23 +01:00
Matt Brown
a0fee98962
Move param taint sink addition after arguuments have been analysed 2021-01-29 11:46:22 +01:00
Matt Brown
aa4be209fc
Make sure conditional escaping works for static methods too 2021-01-29 11:46:22 +01:00
Matt Brown
30ee5334a1
Fix #4661 - support conditional escaping for functions 2021-01-29 11:46:22 +01:00
Matt Brown
676a0ed2d1
Fix #4609 - add more attribute rules 2021-01-29 11:46:21 +01:00
Matt Brown
14807326fe
Fix #4475 - verify that used attributes actual use the Attribute attribute 2021-01-29 11:46:21 +01:00
Matt Brown
763eff2e8b
Fix #4611 - flag invalid attribute arguments correctly 2021-01-29 11:46:21 +01:00
Matt Brown
2fff4eb5c1
Fix #4653 - prevent crash with recursive type in root namespace 2021-01-29 11:46:20 +01:00
Matt Brown
56918001a8
Fix #4643 - use PHP8 union types when possible 2021-01-29 11:46:20 +01:00
Matt Brown
48a58c56e3
Don’t erase already-known literal ints
Fixes #4644
2021-01-29 11:46:20 +01:00
Matt Brown
48fba8a6b9
Only run unused code analysis where necessary 2021-01-29 11:46:20 +01:00
Matt Brown
d43bb3923b
Break aparat type combiner 2021-01-29 11:46:20 +01:00
Lukas Reschke
b2143f1da5
Implement variadic taint propagation (#4649)
* Implement variadic taint propagation

* Lint code
2021-01-29 11:46:19 +01:00
orklah
58ddeaafdf
use int|string in phpdoc format for array-key (#4645) 2021-01-29 11:46:19 +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
Matt Brown
38d1dded4e
Fix test 2021-01-29 11:46:19 +01:00
Matt Brown
b539fdf70e
Allow Psalm to run in taint analysis mode without a config 2021-01-29 11:46:18 +01:00