1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-03 18:17:55 +01:00
Commit Graph

98 Commits

Author SHA1 Message Date
Tomasz Mlynski
1da6893451
Add resolveSymlinks condition for project directories 2021-12-14 20:25:27 +01:00
rarila
39402c233d
Return type hints (#7065)
Co-authored-by: ralila <>
2021-12-05 19:51:26 +02:00
ralila
8fb2e0f885 Handle some partials 2021-12-04 21:55:53 +01:00
ralila
f833085a15 Fix fqn usage in php-doc 2021-12-04 03:37:19 +01:00
ralila
30a65685a2 Import instead of using fqn classes 2021-12-03 21:40:18 +01:00
ralila
711be643c6 Import instead of using fqn exceptions 2021-12-03 20:29:06 +01:00
ralila
245920e53c Import instead of using fqn 2021-12-03 20:11:20 +01:00
Bruce Weirdan
7660dc2f3e
Merge pull request #7009 from rarila/fix-symlink-test-error 2021-11-28 01:47:33 +02:00
ralila
2e56fcac93 Fix test on Windows 2021-11-28 00:18:13 +01:00
Bruce Weirdan
d19aad7db1
Display target PHP version
Historically it was often not quite clear to users what PHP version
Psalm assumes, and why. This PR addresses this issue by printing the
version and where we got it from right before scanning the files.
2021-11-27 02:18:09 +02:00
ralila
7279f00e05 fix failing test 2021-11-26 21:55:30 +01:00
ralila
fdaed941ad use return type hints instead of php doc "@return void" 2021-11-26 20:59:41 +01:00
Bruce Weirdan
58f60b4be0
Use correct constant in tests 2021-11-14 05:23:12 +02:00
orklah
96ae8e7600
Merge pull request #6793 from orklah/unevaluatedCode
emit UnevaluatedCode after exit or never returning functionlike
2021-11-01 23:41:36 +01:00
orklah
e2bb9859e4 fix tests 2021-11-01 22:27:43 +01:00
Bruce Weirdan
f660ff4f83
Move ForbiddenCode-related tests to the corresponding test file 2021-10-31 02:43:17 +03:00
Guillaume Messier
666367fbd5 Add unit test 2021-09-23 15:30:30 +00:00
Roland Franssen :)
9a6ae5a27a test 2021-09-02 20:53:23 +02:00
Bruce Weirdan
76be96ce53
Drop FakeFileProvider from tests folder
And use Psalm\Internal\Provider\FakeFileProvider
2021-07-02 03:57:57 +03:00
Bruce Weirdan
f24f361a95
Add documentation and schema entry for inferPropertyTypesFromConstructor
Fixes vimeo/psalm#5974
2021-06-22 21:20:10 +03:00
Bruce Weirdan
6abce3525a
Enforce use sort (#5900) 2021-06-07 22:55:21 -04:00
Oliver Hader
e457a7d5af
[FEATURE] Allow plugins to declare their custom scanner or analyzer (#5883)
* [FEATURE] Allow plugins to declare their custom scanner or analyzer

Related: #5882

* [TEST] Check plugin declaring own scanner/analyzer

* [TASK] Document plugins declaring scanner or analyzer

* [TEST] Clean up code

* [!!!][TASK] Extend Psalm\Plugin\RegistrationInterface

* add method `addFileTypeScanner(string $fileExtension, string $className): void`
* add method `addFileTypeAnalyzer(string $fileExtension, string $className): void`

* [TASK] Ignore IntelliJ/PhpStorm workspace folder in VCS

* [TASK] Remove superfluous class import
2021-06-04 15:32:53 -04:00
orklah
ff0c1ce567
update hardcoded Psalm version (#5783)
* change hardcoded Psalm version to something more recent

* change hardcoded Psalm version to something more recent
2021-05-17 08:27:08 -05:00
Bruce Weirdan
105c6f3a1c
Remove (and prevent) unused uses (#5704)
* Updates `slevomat/coding-standard`
* Removes unused uses
* Prevents unused uses
* Fixes a number of symbol case mismatches
2021-05-03 17:22:15 -04:00
Samuel Mortenson
e07337650b
Make taint source keys unique to the added taints. (#5444) 2021-03-20 15:42:24 -04:00
Samuel Mortenson
4aabb411a8
Added event to prevent tainting. (#5398)
* Added event to prevent tainting.

* Remove optional codebase parameter.

* Removed falsy check for codebase.

* Use two separate hooks for adding and removing taints

* Add slashes

* Update add/remove taint test name.

* Cleaned up SafeArrayKeyChecker example plugin.

* Added more AddRemoveTaintsEvent calls to codebase.

* Fix type check error with $added_taints param.

* Added AddRemoveTaintsEvent to remaining classes.

* Fix post-merge error.

* Add comma

* Remove $int_offset that never existed

Co-authored-by: Matt Brown <github@muglug.com>
2021-03-19 22:41:41 -04:00
Bruce Weirdan
97fe86c4e1
Fix BC break introduced in 4.6.3 (#5410)
Fixes vimeo/psalm#5405

Requires new patch release.

This PR reverts changes to the signature of `IssueBuffer::finish()` and
introduces separate method to be used to capture `$_SERVER`
2021-03-16 19:28:18 -04:00
Bruce Weirdan
205fdd197e
Wrap entrypoints into IIFE to protect their variables (#5366)
* Wrap entrypoints into IIFE to protect their variables

Fixes vimeo/psalm#5359

* Add tests for Psalm variable isolation

* Capture environment before registering autoloader
2021-03-11 00:14:22 -05:00
Vincent Langlet
a80d5b736b
Rename stub to avoid phpstorm conflict (#5213) 2021-02-13 18:42:34 -05:00
Barney Laurance
509aadc08a
Remove all (but one) properity declarations that needed NonInvariantDocblockPropertyType suppressed (#5174)
The remaining property
\Psalm\Internal\Analyzer\NamespaceAnalyzer::$source seems a bit harder
to fix
2021-02-08 09:36:42 -05:00
Bruce Weirdan
e3d73a3166
Allow suppressing thrown interfaces and their descendants (#5178)
Fixes vimeo/psalm#5177
2021-02-07 21:08:29 -05:00
Matt Brown
f2d202e2bb Add less severe issue for docblock property type invariance cc @bdsl
This is less likely to break everything
2021-02-07 00:52:29 -05:00
Barney Laurance
0cd5442c47
Enforce property type invariance (#5131)
* Implement NonInvariantChildProperty detection

See https://github.com/vimeo/psalm/issues/4184

* Delete test cases with 'parentSetsWiderTypeInConstructor'

As I understand it these are not valid test cases. They
emit NonInvariantPropertyType issues which seems correct - the property
type variation is I think a latent bug in the sample code.

* Reduce shortcode for NonInvariantPropertyType to 1+max used shortcode on master
2021-01-31 11:32:24 -05:00
Adrien LUCAS
493c57eedf
Trigger dispatch even when only legacy hooks (#4962) 2021-01-08 19:51:26 -05:00
orklah
f9fccb2b2d
implement DTO for plugins (#4881)
* implement DTO for plugins

* introduce EventHandler + reintroduce legacy API for plugins
2021-01-06 09:05:53 -05:00
orklah
1d9987e0ed
fix phpdoc (#4905) 2020-12-29 11:42:41 +00:00
orklah
09fb141e49
Document lowercase-string when possible (#4904)
* document lowercase-string

* fix missing strtolower
2020-12-29 11:42:12 +00:00
orklah
b60c42adca
improve Atomic Types documentation (#4735)
* improve Atomic Types documentation

* add doc

* add doc
2020-11-29 21:41:36 -05:00
orklah
6b72599ec5
allow static return type in PHP8 (#4641) 2020-11-20 18:46:35 -05:00
Dalibor Karlović
da632ca73a
feature: allow plugin manager to work without config file (#4639) 2020-11-20 09:54:14 -05:00
feek
cc684eeccd
feature: ensure universal object crate class exists (#4375) 2020-10-20 17:17:49 -04:00
orklah
ceaaa39ec3
improve phpdoc (#4352) 2020-10-17 12:36:44 -04:00
orklah
10f2966dcb
return types (#4311)
* return types

* remove willReturn for void methods
2020-10-12 15:02:52 -04:00
feek
8d2db4e673
feature: universal object crates (#3948)
* feature: universal object crates

* docs: document universal object crate config option

Co-authored-by: Matthew Brown <github@muglug.com>
2020-10-07 09:56:21 -04:00
Matt Brown
db4d5bca95 Fix tests 2020-10-05 10:14:39 -04:00
orklah
37a2f8a33d
unused use statements (#4228) 2020-09-22 01:10:46 -04:00
orklah
b19f0a7034
Remove empty() and use strict comparison when safe (#4211)
* replace empty usage with stricter checks

* use strict comparison when safe

* replace is_null with === null for consistency
2020-09-19 18:26:51 -04:00
orklah
da47588f91
replace return; by return null; in every non-void method, add return null; when mising, add return types, remove redundant phpdoc (#4176) 2020-09-13 16:39:06 -04:00
orklah
ead107fa9e
More return types (#4173)
* add native return types

* redundant phpdoc
2020-09-12 11:24:05 -04:00
Brown
4ffdbe0a21 Fix some signatures 2020-09-07 16:00:27 -04:00