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

12245 Commits

Author SHA1 Message Date
Marco Pivetta
d9a0cc5311 Prevent usage of callable objects in ReflectionFunction::__construct()
As per @weirdan's feedback, we can prevent
the usage of `object` instances that
implement `__invoke()`, as well as `array`
callables, by declaring the ctor argument of
`ReflectionFunction` to be either a real `Closure`,
or a `callable-string`.

While this may not be 100% of scenarios, it is a
healthy way to identify errors in userland.

Ref: https://github.com/vimeo/psalm/pull/8722#discussion_r1027151421
2022-12-06 11:19:16 +01:00
Marco Pivetta
d5cccbade2 Marking ReflectionProperty#$name as string rather than non-empty-string
Because @weirdan is a party pooper (they poop at the parties)

Ref: https://www.youtube.com/watch?v=gjwofYhUJEM
Ref: https://github.com/vimeo/psalm/pull/8722#discussion_r1027151708
2022-12-06 11:12:01 +01:00
Marco Pivetta
322cff6f43 Declaring more precise types and purity boundaries on ext-reflection symbols in .phpstub files
Also:

 * added PHP 8.2 stubs
 * refined types to make impossible scenarios more clear (like `ReflectionIntersectionType#allowsNull()`)

This is a first attempt at refining these types: the structure of these stubs is quite confusing to me,
so I don't know if this approach is correct, and if the stubs are merged together, or if entire symbols
need to be completely re-declared for each PHP version.
2022-12-06 11:08:30 +01:00
Bruce Weirdan
4dc969b887
Merge pull request #8848 from mmcev106/urlencode 2022-12-05 21:17:34 -04:00
Mark McEver
9764803c55 Allowed taints to pass through urlencode() 2022-12-05 17:25:36 -06:00
orklah
1cd10c3344
Merge pull request #8837 from vimeo/dependabot/github_actions/fkirc/skip-duplicate-actions-5.3.0
Bump fkirc/skip-duplicate-actions from 4.0.0 to 5.3.0
2022-12-05 10:06:17 +01:00
dependabot[bot]
a30622bfb5
Bump fkirc/skip-duplicate-actions from 4.0.0 to 5.3.0
Bumps [fkirc/skip-duplicate-actions](https://github.com/fkirc/skip-duplicate-actions) from 4.0.0 to 5.3.0.
- [Release notes](https://github.com/fkirc/skip-duplicate-actions/releases)
- [Commits](https://github.com/fkirc/skip-duplicate-actions/compare/v4.0.0...v5.3.0)

---
updated-dependencies:
- dependency-name: fkirc/skip-duplicate-actions
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 07:05:39 +00:00
orklah
d2f7d86aee
Merge pull request #8835 from lptn/8818-extend-impure_functions-by-socket-functions
Extend impure_functions list by socket functions
2022-12-05 00:34:53 +01:00
Alies Lapatsin
4b4b36df7d Extend impure_functions list by socket functions
all of them returns boolean and can be ignored.
This prevents UnusedFunctionCall.
Note, socket errors can be fetched by:
 - socket_strerror
 - socket_last_error
2022-12-05 00:25:19 +01: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
Théo FIDRY
a444f286bb
Integrate FidryCpuCoreCounter 2022-12-04 20:24:18 +01:00
orklah
83ba661135
Merge pull request #8832 from kamil-tekiela/mysqli_execute_query
mysqli_execute_query accepts any type of param
2022-12-04 18:39:25 +01:00
Kamil Tekiela
ace5743c99 mysqli_execute_query accepts any type of param 2022-12-04 17:29:50 +00:00
orklah
16d81aadd1
Merge pull request #8831 from orklah/propertymap
capitalize properties
2022-12-04 17:26:14 +01:00
orklah
5c46c45057 capitalize properties 2022-12-04 17:18:24 +01:00
orklah
929723a133 capitalize properties 2022-12-04 17:10:40 +01:00
orklah
df4d3692ab
Merge pull request #8828 from orklah/generator
fix missing break handling in loop
2022-12-04 16:38:37 +01:00
orklah
496b71d6d8
Merge pull request #8827 from weirdan/improve-source-autodiscovery-failure-message
Improve source autodiscovery failure message
2022-12-04 14:18:33 +01:00
orklah
2490230f1f fix missing break handling in loop 2022-12-04 13:57:59 +01:00
Bruce Weirdan
45bf0d961c
Improve source autodiscovery failure message
The message we emitted previously did not provide any instructions on
how to resolve the issue, leaving users to guess what they need to do.
2022-12-04 04:34:08 -04:00
orklah
4a77f24869
Merge pull request #8825 from othercorey/fix-returns
Fix return types for date functions in callmap
2022-12-04 01:07:33 +01:00
orklah
d409da2be0
Merge pull request #8823 from lptn/more-specific-return-types
Update dictionaries: use more specific boolean types
2022-12-04 01:05:34 +01:00
Corey Taylor
d9b651a126 Fix return types for date functions in callmap 2022-12-03 17:55:29 -06:00
Alies Lapatsin
e0a7df4bad Update dictionaties: use more specific boolean types 2022-12-03 21:28:03 +01:00
Bruce Weirdan
14d48a0dde
Merge pull request #8817 from weirdan/fix-7863
Fixes https://github.com/vimeo/psalm/issues/7863
2022-12-03 01:29:01 -04:00
Bruce Weirdan
a157743140
Prevent crashes on conditional traits
Fixes vimeo/psalm#7863
2022-12-03 01:21:10 -04:00
Bruce Weirdan
e64913c377
Merge pull request #8816 from weirdan/fix-8313
Fixes https://github.com/vimeo/psalm/issues/8313
2022-12-03 01:00:23 -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
35822f14d9
Merge pull request #8814 from weirdan/fix-8377
Fixes https://github.com/vimeo/psalm/issues/8377
2022-12-02 23:38:57 -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
Bruce Weirdan
4defa177c8
Merge pull request #8774 from bdsl/report-by-issue-type-severity 2022-12-01 21:23:35 -04:00
Barney Laurance
1dbdf7882c Code style fix 2022-12-02 00:40:01 +00:00
Barney Laurance
ad57727593 Sort issue by position in codebase in ByIssueLevelAndTypeReport if level & type equal
PHP sorting only became stable in 8.0. For previous versions we would
still like duplicate issues to be sorted into a logical order.
2022-12-02 00:27:51 +00: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
d6c7c86362 Remove unecassary subheadings in error levels documentation 2022-12-02 00:07:37 +00:00
Barney Laurance
cd18cdc554 Re-order list of errors in docs
I think it makes more sense to have the errors that almost always appear
(level 7 errors) next to the errors that always appear, instead of
the level 1, least likely to appear errors being next to the ones that
always appear.

This also makes the order more similar to that output by the new
--by-issue-level format report.

Some time it might be nice to see if there's a way to auto generate most
of this docs page from the actual issue class definitions, or have
a test that checks the list of issues for each level is accurate and
complete.
2022-12-02 00:04:43 +00:00
Barney Laurance
9e63bf6a4d Minor code edits in ByIssueLevelAndType 2022-12-02 00:04:43 +00:00
Bruce Weirdan
c1d2e5618a
Set vimeo/psalm version explicitly 2022-12-01 19:59:51 -04:00
Barney Laurance
3f5616672a Add test for ByIsueLevelAndTypeReport 2022-12-01 23:27:53 +00:00
Barney Laurance
386aa27f4c Improve issue level and type report 2022-12-01 23:00:48 +00:00
Barney Laurance
3bc3f1c273 Fix report name: Issue level, not issue severity 2022-12-01 22:11:29 +00:00
Barney Laurance
4fde49313e Fix implicit constant visibility 2022-12-01 22:05:27 +00:00
Barney Laurance
aea1c5603d Reduce function visibility
Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
2022-12-01 22:03:19 +00:00
Barney Laurance
32881a3c65 Add comments 2022-12-01 22:02:09 +00:00
Barney Laurance
6bde0d3a68 Delete unused code 2022-12-01 22:02:08 +00:00