1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 09:37:59 +01:00
Commit Graph

5236 Commits

Author SHA1 Message Date
orklah
72e7386eb5
Merge pull request #8722 from Ocramius/feature/#8720-improve-types-and-purity-for-reflection-symbols
Declaring more precise types and purity boundaries on `ext-reflection` symbols in `.phpstub` files
2022-12-12 21:27:47 +01:00
Bruce Weirdan
9db0eb3e03
InvalidEnumMethod requires PHP8.1+ 2022-12-12 03:12:55 -04:00
Bruce Weirdan
19a1005bc3
Forbid most magic methods on enums
Fixes vimeo/psalm#8889

Additionally this fixes case-sensitivity of
MethodSignatureMustOmitReturnType issue

Fixes vimeo/psalm#8888
2022-12-12 03:03:20 -04:00
Bruce Weirdan
a4ff9eb204
Allow true in native types
Fixes vimeo/psalm#8872

For `null` and `false`, we already allowed them even as standalone
types, even though PHP before 8.2 only allowed them as part of a union.
2022-12-09 20:17:09 -04:00
orklah
e4b64af599
Merge pull request #8861 from VincentLanglet/count
Precise count range
2022-12-09 00:41:00 +01:00
Vincent Langlet
f6051bc417 Precise count range 2022-12-08 16:44:10 +01:00
Marco Pivetta
30a49633a5 Corrected AttributeTest expectation: ReflectionAttributes always come in a list 2022-12-07 15:44:38 +01:00
Mark McEver
9764803c55 Allowed taints to pass through urlencode() 2022-12-05 17:25:36 -06:00
orklah
cc9c67d7ee
Merge pull request #8834 from danog/fix_class_string_unions
Fix parsing of class string of unions
2022-12-04 20:44:41 +01:00
orklah
f3e1a2c0e4 impossible constructor 2022-12-04 20:33:05 +01:00
4c277052e3 Fix parsing of class string of unions 2022-12-04 20:28:53 +01:00
orklah
2490230f1f fix missing break handling in loop 2022-12-04 13:57:59 +01:00
Corey Taylor
d9b651a126 Fix return types for date functions in callmap 2022-12-03 17:55:29 -06:00
Bruce Weirdan
a157743140
Prevent crashes on conditional traits
Fixes vimeo/psalm#7863
2022-12-03 01:21:10 -04:00
Bruce Weirdan
4d8af74d92
Don't crash when accessing immutable static property
Fixes vimeo/psalm#8313
2022-12-03 00:51:22 -04:00
Bruce Weirdan
7364988934
Fix crash when using phantom methods as first-class callable
Fixes vimeo/psalm#8377
2022-12-02 23:28:22 -04:00
Barney Laurance
a29f65ecfe Fix too lax function visibility in test 2022-12-02 00:24:44 +00:00
Barney Laurance
6693421379 Code style fix 2022-12-02 00:24:05 +00:00
Barney Laurance
54239838fe Fix error in ByIssueLvelAndTypeReport heading 2022-12-02 00:17:27 +00:00
Barney Laurance
699ee344d4 Indent heredoc in test 2022-12-02 00:14:43 +00:00
Barney Laurance
3f5616672a Add test for ByIsueLevelAndTypeReport 2022-12-01 23:27:53 +00:00
orklah
433e272149
Merge pull request #8809 from danog/fix_8806
Fix #8806
2022-12-01 21:00:40 +01:00
7f15d47c19 Add tests 2022-12-01 20:14:37 +01:00
orklah
b4aa951caa
Merge pull request #8798 from orklah/min_count
fix sealed combination
2022-12-01 18:35:02 +01:00
kkmuffme
694b7d8975 check "never" return type more strictly
* require explicit "never" return type when function always exits, except if it only throws
* error if function does not exit, but return type explicitly contains "never"
* Fix: https://github.com/vimeo/psalm/issues/8175
* Fix: https://github.com/vimeo/psalm/issues/8178
2022-12-01 14:51:58 +01:00
orklah
2da4bf98d6 add test 2022-11-30 23:45:55 +01:00
Bruce Weirdan
8fa35c2228
Variables should outlive namespaces (#8779)
Variables in PHP are not namespaced. In other words, namespaces share
the context with the file they are located in.

See https://3v4l.org/2qvrC

Fixes vimeo/psalm#8778
2022-11-27 10:45:40 -05:00
Bruce Weirdan
05b8e0eea6
Replace all references to static variables when moving class (#8780)
Previously `psalter` would only replace the first occurence of the
property access. Now it replaces all properties (by keeping the old name
unknown in the context).
2022-11-27 10:44:53 -05:00
Matthew Brown
1819a2d880
Add diagnostic message when shape fields are missing (#8762)
* Add a simple diagnostic for missing array shape fields

* Fix dumb mistakes

* Allow nested shape extra keys to prompt warning too
2022-11-26 11:26:36 -05:00
Matthew Brown
a0e4468a9a
Simplify assertions generated by an array_key_exists check (#8763) 2022-11-25 12:16:37 -05:00
Bruce Weirdan
0b1af26011
Merge pull request #8755 from weirdan/switch-from-prophecy-to-mockery 2022-11-25 03:42:58 -04:00
Bruce Weirdan
6c77daf1f4
Upgrade mockery plugin
and other assorted fixes for PHP 8.2
2022-11-25 03:33:10 -04:00
Bruce Weirdan
1183476089
CS fix 2022-11-24 21:23:30 -04:00
Bruce Weirdan
42b71f5eae
Switch from phpspec/prophecy to mockery/mockery
It provides similar functionality, but is a bit more alive and does not
prevent installation with PHP 8.2
2022-11-24 21:20:21 -04:00
orklah
583dabee99
Merge pull request #8753 from orklah/8745
Fix #8745
2022-11-24 20:21:28 +01:00
orklah
b53a9c322c Fix test incompatible with PHP 7.4 2022-11-24 20:06:02 +01:00
orklah
ea4b099c66 Fix #8745 2022-11-24 20:02:04 +01:00
orklah
bca202bf5e
Merge pull request #8749 from Nicelocal/fix_8748
Fix #8748
2022-11-24 19:44:44 +01:00
5ac60ddea0 Add tests 2022-11-24 19:31:53 +01:00
54db59682d
Allow parameter types to be contained by a class template type (#8731)
* Allow parameter types to be contained by a class template type in function calls

* Specify PHP version of tests

* Fix tests
2022-11-23 00:14:30 -05:00
Bruce Weirdan
6554aa05a7
Emit MixedMethodCall when calling new on object 2022-11-19 17:29:35 -04:00
Bruce Weirdan
d7561919b2
Allow new on objects
Fixes vimeo/psalm#8355
2022-11-19 16:53:07 -04:00
orklah
48c0df6a8c
Merge pull request #8708 from annervisser/allow-using-imported-type-in-other-type
Allow using imported types in other types within the same file
2022-11-18 22:06:17 +01:00
orklah
ebc7599697
Merge pull request #8713 from weirdan/fix-8712
Reject `@psalm-consistent-constructor` in function docblocks
2022-11-18 22:05:22 +01:00
Fran Moreno
c3bd060f06
Fix DateTimeZone::listAbbreviations return type
Also fixes DateTimeZone::getOffset return type
2022-11-18 08:50:00 +01:00
Bruce Weirdan
8e1f129701
Reject @psalm-consistent-constructor in function docblocks
Fixes vimeo/psalm#8712
2022-11-16 19:14:13 -04:00
Anner Visser
d10b1f91bb
Allow using imported types in other types within the same file
In the test case (from issue #7116) both the type definition and the
import of the typed lived in the same file. This caused `OpeningTypes`
to be an `InlineTypeAlias` instead of a `LinkableTypeAlias`, in turn
causing an 'Invalid type alias' exception[^1].

By replacing the array union (+) with an array_merge, the import of the
type overrides the initial type declaration within the `Main` class.
This means type imports within one file act more like they would when in
separate files.

Fixes #7116

[^1]: [src/Psalm/Type/Atomic.php:407](1986c8b4a8/src/Psalm/Type/Atomic.php (L407))
2022-11-15 14:46:31 +01:00
Bruce Weirdan
dd253b755b
Conserve some vertical space 2022-11-14 14:54:55 -04:00
Anner Visser
5bafc9512c
Add support for type aliases in @psalm-assert(-*) annotations
Fixes #8263
2022-11-14 16:03:35 +01:00
Matthew Brown
8d36bdc3ed
Make array shapes strict by default (#8701)
* Make array shapes strict by default

* Fix PSL tests
2022-11-11 20:14:21 -05:00