1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-14 10:17:33 +01:00
Commit Graph

97 Commits

Author SHA1 Message Date
Matthew Brown
1288915aba Change number return type to numeric
cc @TysonAndre
2018-02-06 22:22:50 -05:00
Tyson Andre
0bc7ac11f1 Improve callmap with information from docs.php.net (#494)
* Update CallMap.php with information from docs.php.net

* Undo possibly inaccurate information from docs.php.net

* Fix bug in ReflectionMethod::invoke*() signature

http://php.net/manual/en/reflectionmethod.invoke.php had a misleading
method signature description section
2018-02-06 20:50:32 -05:00
Tyson Andre
5ac01abbe5 Fix a few signatures of Iterator classes for void
This was done automatically via sed.
Other types can be added in separate PRs
2018-02-05 17:16:49 -05:00
Matthew Brown
c05baf47ce Fix more Reflection return types 2018-02-02 16:35:40 -05:00
Matthew Brown
b771658821 Fix Reflector::export return types in callmap 2018-02-02 15:28:39 -05:00
Matt Brown
1a2d13ae32 Ignore falsable issues from core functions 2018-01-25 13:07:36 -05:00
Matt Brown
f46cf729bb Allow null checks against preg_replace and related 2018-01-24 17:07:03 -05:00
Matthew Brown
2b122cb80e Fix compact call back 2018-01-15 21:01:29 -05:00
Matthew Brown
1d16f1e352 Update the callmap from Phan 2018-01-15 20:21:08 -05:00
Matthew Brown
14e7b75dbb Fix bad formatting for ibase_query 2018-01-15 15:27:46 -05:00
Matthew Brown
db7b80d391 Fix ArrayIterator::setOffset param type 2018-01-12 23:46:11 -05:00
Matt Brown
9d63faf544 Fix SplFixedArray::toArray return type 2018-01-09 17:14:13 -05:00
Matthew Brown
8e4f8fabe3 Fix getenv calls
Fixes #386
2018-01-08 00:09:22 -05:00
Matthew Brown
3de584cbc1 Add more specific argument for ReflectionObject 2018-01-05 00:54:48 -05:00
Matthew Brown
51edeead84 Fix invalid Reflection methods 2018-01-05 00:26:51 -05:00
Matthew Brown
eefa4f925f Improve Reflection class method return types 2018-01-04 20:13:09 -05:00
Matthew Brown
6e7bab58c4 Be better about inherited core method arg types 2018-01-04 18:58:03 -05:00
Matt Brown
24c69a9a7c Allow all DateTime/DateTimeImmutable methods to return static 2018-01-03 10:53:45 -05:00
Matt Brown
ff5b2ce799 DateTimeImmutable::add/sub return static
Fixes #419
2018-01-03 10:35:22 -05:00
Matthew Brown
c0e923acb9 Update get_defined_functions to more recent signature 2017-12-29 22:57:02 -05:00
Matthew Brown
8efc939a5f Move Psalm execution code into PHP file that Psalm can analyse 2017-12-29 17:02:56 -05:00
Tim van Dijen
4d0e775346 openssl_encrypt and _decrypt can return false (#414) 2017-12-29 04:26:53 +01:00
Matthew Brown
68a4f30e96 Fix realpath return type
Fixes #405
2017-12-19 12:55:43 -05:00
Matthew Brown
5f22203bd1 Fix #385, fix return type of sodium function 2017-12-12 02:10:17 -05:00
Matt Brown
83c65d4b2d Add DOMNodeList::item to callmap 2017-12-04 11:59:16 -05:00
Matthew Brown
7d003c5bc1 Fix erroneous treatment of or clauses in if statements 2017-12-03 16:25:52 -05:00
Matthew Brown
681da41f0f Allow fsockopen to return false, fixes #353 2017-11-28 22:56:28 -05:00
Matthew Brown
4312ef380b Fix issues found by improved Psalm checks
cc @TysonAndre, found with RedundantCondition checks
2017-11-24 12:10:30 -05:00
Matt Brown
6db3758b81 Fix #275 with bad sig 2017-11-09 15:36:21 -05:00
Matt Brown
6d14bf65d7 Loosen restrictions on compact(), fix #267 2017-11-08 09:37:58 -05:00
Matthew Brown
02dde911ce Allow DateTimeImmutable::__construct arg to be nullable 2017-10-28 14:53:25 -04:00
Matthew Brown
323da5ce13 Add callmap updates from Phan 2017-10-28 14:02:33 -04:00
Matthew Brown
3f9bd530fd Fix #262 - allow return type of simplexml functions to be false 2017-10-27 20:15:00 -04:00
Steffen Weber
30465518f7 Fix signature of "gmp_import"
According to the PHP manual, the second and third argument of "gmp_import" have default values and are therefore optional.

https://php.net/gmp_import
2017-10-25 09:12:20 -04:00
Matt Brown
0c33db0a3e Fix #258 - tempnam can return false 2017-10-23 13:13:07 -04:00
Matthew Brown
2e00fb19ee Fix #246 - amend return type for DateTime::createFromFormat 2017-10-16 00:47:48 -04:00
Bruce Weirdan
ed3e429d2c s/'mixed'/''/g 2017-10-12 09:21:49 -04:00
Bruce Weirdan
52962db24c Adjusted Closure methods signatures
This fixes the following false-positive:
```php
function a(): bool {
  $a = function(): bool { return true; }
  return $a->call(new stdClass);
}
```
where psalm previously complained about (wrongly) inferred type to be
Closure
2017-10-12 09:21:49 -04:00
Bruce Weirdan
f080e32ef0 Corrected case of Traversable typehints
Affected functions/methods:
* `iterator_apply()`
* `iterator_count()`
* `IteratorIterator::__construct()`
* `iterator_to_array()`

This fixes the following false-positive:
```php
class Iter extends IteratorIterator {
    public function __construct(Traversable $a) {
	parent::__construct($a);
    }
}
```
where psalm previously wanted `parent::__construct()` argument to be
`traversable` (all-lowercase).
2017-10-12 08:49:24 -04:00
Matt Brown
ee655e6f33 Fix #218 - strings passed to format always return string 2017-09-22 10:18:44 -04:00
Bruce Weirdan
ed0e9702ae Adjusted signatures of DateTime and friends
* __wakeup is void -> void, see http://php.net/manual/en/language.oop5.magic.php#object.wakeup
* DateTime::__construct() does not accept null as time
* DateTimeZone::getLocation() has no last $object parameter
* ditto for DateTimeZone::getName()
* ditto for DateTimeZone::getTransitions()
2017-09-22 10:06:24 -04:00
Matt Brown
d949165eb6 Fix #217 - bad param count for DateTimeImmutable::getTimezone 2017-09-21 15:37:05 -04:00
Matt Brown
3bc497b18e Fix #217 - bad param count for DateTimeImmutable::getTimezone 2017-09-21 15:36:26 -04:00
François Kooman
8e35a72cc3 fix json_encode return values
`json_encode` can also return `false`
2017-09-18 16:14:01 -04:00
François Kooman
8a28ab4b26 Fix some cURL function return values (#208)
At least the functions referenced here can also return boolean
`false` according to the PHP manual. Add this information to the
CallMap file.
2017-09-10 21:49:51 -04:00
Matthew Brown
73694ab04e Suggest types when complaining of untype params
Ref #204
2017-09-02 18:15:52 -04:00
Matthew Brown
fb656f3575 Fix #203 and detect invalid countable count calls 2017-08-19 13:30:33 -04:00
Matt Brown
9a036cb4ab Fix resource signatures 2017-08-18 16:51:34 -04:00
Matthew Brown
e29dd140e3 Refactor scanning and analysis, introducing multithreading (#191)
* Add failing test

* Add visitor to soup up classlike references

* Move a whole bunch of code into the visitor

* Move some methods back, move onto analysis stage

* Use the getAliases method everywhere

* Fix refs

* Fix more refs

* Fix some tests

* Fix more tests

* Fix include tests

* Shift config class finding to project checker and fix bugs

* Fix a few more tests

* transition test to new syntax

* Remove var_dump

* Delete a bunch of code and fix mutation test

* Remove unnecessary visitation

* Transition to better mocked out file provider, breaking some cached statement loading

* Use different scheme for naming anonymous classes

* Fix anonymous class issues

* Refactor file/statement loading

* Add specific property types

* Fix mapped property assignment

* Improve how we deal with traits

* Fix trait checking

* Pass Psalm checks

* Add multi-process support

* Delay console output until the end

* Remove PHP 7 syntax

* Update file storage with classes

* Fix scanning individual files and add reflection return types

* Always turn XDebug off

* Add quicker method of getting method mutations

* Queue return types for crawling

* Interpret all strings as possible classes once we see a `get_class` call

* Check invalid return types again

* Fix template namespacing issues

* Default to class-insensitive file names for includes

* Don’t overwrite existing issues data

* Add var docblocks for scanning

* Add null check

* Fix loading of external classes in templates

* Only try to populate class when we haven’t yet seen it’s not a class

* Fix trait property accessibility

* Only ever improve docblock param type

* Make param replacement more robust

* Fix static const missing inferred type

* Fix a few more tests

* Register constant definitions

* Fix trait aliasing

* Skip constant type tests for now

* Fix linting issues

* Make sure caching is off for tests

* Remove unnecessary return

* Use emulative parser if on PHP 5.6

* Cache parser for faster first-time parse

* Fix constant resolution when scanning classes

* Remove test that’s beyond a practical scope

* Add back --diff support

* Add --help for --threads

* Remove unused vars
2017-07-25 16:11:02 -04:00
Matt Brown
e83ea3a5fe Fix #192 - correct SessionHandlerInterface::gc signature 2017-07-24 17:58:38 -04:00