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

544 Commits

Author SHA1 Message Date
ADmad
a584314c62 Allow enabling mixed issues reporting for error levels > 2.
Refs #9619.
2023-04-08 06:17:00 +05:30
Daniel Beardsley
7b541ed74f
src/Psalm/Config.php: don't use annotations
Psalm was parsing this as a property annotation, derp.
2023-03-27 09:48:36 -07:00
Daniel Beardsley
5ff933f2a5
@property annotations: allow *not* implying @psalm-seal-properties
Add a setting that allows usage of `@property` to *augment* classes that
use __get() and __set(). Previously, using `@property` once would force
you to exhaustively list all possible properties. This didn't use to be
the case, but was changed in df33405635

This was really unexpected for our team and for a while we thought it
was a psalm bug until I found the above commit.

We are using `__get()` for ORM objects and we want to use `@property` to
explicitly document some of columns without being forced to document
every column.
2023-03-24 23:35:41 -07:00
Alies Lapatsin
fcb96f10c2 Fix default for ibm_db2 ext, add description 2023-02-28 23:05:47 +01:00
Alies Lapatsin
feb0cb8598 Merge branch 'master' into disableExtensions-hides-warnings
# Conflicts:
#	src/Psalm/Config.php
2023-02-28 22:51:43 +01:00
Javier Spagnoletti
ab13ddf286 [ibm_db2] Improve return type inference for db2_autocommit() 2023-02-24 19:53:42 -03:00
Alies Lapatsin
9e9629c474 Fix check for supported php-ext 2023-02-15 22:34:06 +01:00
Alies Lapatsin
cfa4450394 Do not display ext deprecation note when disableExtensions used
Fixes #8958
2023-02-14 12:34:49 +01:00
kkmuffme
78c3d6b436 fix lstat bug cache directory race condition 2023-02-09 09:27:51 +01:00
Alies Lapatsin
9d54de6a51 Use a new method to display warning 2023-01-24 06:50:09 +01:00
Alies Lapatsin
0cc770c947 Use a new method to display warning 2023-01-24 06:48:03 +01:00
Alies Lapatsin
b667db20e6 Merge branch 'master' into unify-deprecation-messages 2023-01-24 06:41:43 +01:00
Bruce Weirdan
2af7f51394
Suppress warnings when --no-output is specified 2023-01-22 20:40:21 -04:00
Alies Lapatsin
a1a2ecc957
Merge branch 'master' into unify-deprecation-messages 2023-01-18 21:14:02 +01:00
Alies Lapatsin
2f385a9057 Unify deprecation messages 2023-01-18 20:54:49 +01:00
Alies Lapatsin
d5e5dc0683 Fully support Psalm 5 behaviour
asked by orklah, see
https://github.com/vimeo/psalm/pull/9112#issuecomment-1383239821
2023-01-18 19:06:51 +01:00
Alies Lapatsin
7e157cfe9d Allow to specify a custom shepherd endpoint (instead of domain) 2023-01-18 19:06:32 +01:00
Jack Worman
56f6dfecc8 Report unused baseline entries 2023-01-17 22:02:21 -05:00
Alies Lapatsin
fc72214bfc Automatically load stubs for random ext on PHP 8.2 2023-01-12 12:52:45 +01:00
Alies Lapatsin
69b6409feb Fix coding-style issues 2023-01-10 19:24:33 +01:00
Alies Lapatsin
2626827876
Merge branch 'master' into cleaunup-unsupported-extentions-message 2023-01-09 17:39:56 +04:00
Alies Lapatsin
8b23919241 Extend a list of php ext, supported by CallMap files 2023-01-09 14:31:17 +01:00
Alies Lapatsin
ce8dcdfee7 Do not list core and bundled extensions as unsupported 2023-01-05 18:42:38 +04:00
kkmuffme
1a0c0fe5c5 relative path as absolute paths autoloader legacy issue 2023-01-03 15:35:57 +01:00
kkmuffme
76f90e62f2 code style 2023-01-03 15:21:15 +01:00
kkmuffme
8fe00cf609 fix autoloader not working with absolute path 2023-01-03 15:13:38 +01:00
orklah
dbcfe62c52
Merge pull request #8987 from jack-worman/Always_check_unused_methods_and_properties
Add @psalm-api annotation
2022-12-28 15:20:48 +01:00
Jack Worman
1bb9eb4cfc forbidden function bug and better get_defined_functions() signature 2022-12-24 12:34:40 -06:00
Jack Worman
703a1e1698 @psalm-api 2022-12-23 16:13:46 -06:00
Jack Worman
1c19260cdd Require trailing commas 2022-12-18 13:20:31 -06:00
Jack Worman
a52f35e5e1 Even more property typehints 2022-12-16 13:24:21 -06:00
orklah
f4d70384ee
Merge pull request #8885 from lptn/php-ext-with-deprecation
Deprecation message on loading php-ext stubs without explicitly declaring them as dependency or in a config
2022-12-15 21:17:38 +01:00
Jack Worman
69658e8315 SlevomatCodingStandard.Commenting.DocCommentSpacing 2022-12-14 13:34:41 -06:00
Jack Worman
36fa162d6d Use php-cs-fixer to clean up docblocks 2022-12-13 20:46:43 -06:00
orklah
794ca9362a
Merge pull request #8887 from jack-worman/Use_rector_to_add_property_typehints
Use rector to add property typehints
2022-12-13 19:58:43 +01:00
Alies Lapatsin
1115cfb980 Merge branch 'master' into php-ext-with-deprecation
# Conflicts:
#	src/Psalm/Config.php
2022-12-12 23:49:01 +01:00
Jack Worman
dd0d8300b1 Use rector to add property typehints 2022-12-11 17:25:23 -06:00
Alies Lapatsin
c8b6b0b504 Remove unused @psalm-suppress 2022-12-11 15:10:43 +01:00
Alies Lapatsin
a8046a8682 Simplify array type declaration 2022-12-11 15:01:34 +01:00
Alies Lapatsin
729eb59169 Remove an excessive array shape annotation 2022-12-11 14:55:42 +01:00
Alies Lapatsin
5e95d13157 Make Psalm about stub file for random (core) extension 2022-12-11 14:45:20 +01:00
Alies Lapatsin
74f65cba71 Make Psalm about stub file for redis extension 2022-12-11 14:39:29 +01:00
Alies Lapatsin
62c998b8cf Load ext stubs using extension_loaded but display a deprecation note 2022-12-11 14:39:29 +01:00
Alies Lapatsin
0fd4c520de Load ext stubs using extension_loaded but diaplay a deprecation note 2022-12-11 14:01:20 +01:00
Alies Lapatsin
16ab9f786b Unify a way how to load stubs for extentions 2022-12-10 17:02:47 +01:00
Marco Pivetta
68d88c546b Load PHP-version-specific stubs based on analysis PHP version, and only when visiting stub files
While `visitPreloadedStubFiles` seemed to work at first, it led to overriding symbols declared by
PHP itself too eagerly.

By only loading PHP-version-specific stubs in `visitStubFiles`, we ensure that the reflection-declared
symbols take priority, and that our stubs overlay on top of that, without actually replacing the
symbol entirely, but rather merging with its definition.

This fixes current test failures too, and works with the code examples
from https://github.com/vimeo/psalm/pull/8722#issuecomment-1339711882
2022-12-08 18:22:51 +01:00
Marco Pivetta
042305107e Always load preloaded stub files when the analysis version is compatible
Before this change, preloaded stubs would only be loaded when running on a PHP version lower than
the one that is in the stubs.

With this change, the analysis PHP version (defined via config, input parameter, or inferred from
the runtime) becomes authoritative.

Since the PHP-version-specific stubs are not just polyfills, but actually type refinements on top
of the PHP core symbols at hand, this change always loads them, so that it is possible to get more
precise type inference downstream.

This will likely lead to downstream breakages, because the stubs do indeed provide better type
resolution, but indeed formalizes the idea that these stubs will provide better value for finding
problems in analyzed code.
2022-12-07 15:48:59 +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
6b3dd56850
Defer cache directory creation until it's needed
Honestly, this is a bit of a hack, as we let `Config` to generate the
cache directory name and then reset it to null from the cli entrypoint.
Yet it's easier than passing a no-cache flag through so many layers of
static calls.

`$this->cache_directory_initialized` flag is used to make sure we
attempt to create the directory only once.

Fixes vimeo/psalm#4267
2022-11-29 04:16:59 -04:00
Bruce Weirdan
c417af7d44
CS fix 2022-11-25 03:35:47 -04:00