1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-14 18:36:58 +01:00
Commit Graph

71 Commits

Author SHA1 Message Date
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
Matthew Brown
86f2a9981c Fix #190 by updating callmap 2017-07-19 08:54:01 -04:00
Matt Brown
592194e9f2 Fix #187 by splitting abs into int and float versions 2017-07-14 18:09:25 -04:00
Matthew Brown
95de80b7f1 Make signature nullable 2017-06-30 14:16:27 -04:00
Matt Brown
d39aeb9c3d Fix casing in dom* classes 2017-06-29 12:10:07 -04:00
Matthew Brown
7532e32b9d Fixed spacing and use statement formatting 2017-05-19 00:48:26 -04:00
Matt Brown
967e372e25 Update function signatures from Phan 2017-05-05 19:43:35 -04:00
Jon Ursenbach
ecee8df753 SimpleXMLElement::asXML returns a string|boolean. #145 2017-04-22 18:13:18 -04:00
Matt Brown
1c6934bfa8 Fix a couple more return types 2017-04-06 16:41:44 -04:00
Matt Brown
20b148d2d5 Fix preg_match return types 2017-04-06 15:48:52 -04:00
Matt Brown
fe54318432 Fix #119 - strtotime can return false 2017-03-30 11:02:59 -04:00
Matt Brown
8c9cba5e75 Fix #117 - update filesystem callmap functions 2017-03-16 17:34:40 -04:00
Scott
d1b0cdecd7 Add argument to apcu_add() definition 2017-03-01 19:39:19 -05:00
Matthew Brown
54026fc8f9 Touch up a couple of spots 2017-02-28 00:54:59 -05:00
Matthew Brown
2acfede1d2 Improve call map signatures from phan 2017-02-28 00:50:08 -05:00
Matthew Brown
9ffb9b64f1 Fix #106 - fix a few method signatures 2017-02-28 00:33:49 -05:00
Matthew Brown
59d1e63b5c Add possibly-false values to getFileName 2017-02-21 02:13:40 -05:00
Matthew Brown
870a4486a8 Fix socket return types 2017-02-17 19:52:37 -05:00
Matthew Brown
b1f7cfb08e Make file return type more specific 2017-02-12 12:22:10 -05:00
Matthew Brown
2a3c4ee63a Fix msg_receive byref params 2017-02-12 11:34:38 -05:00
Matthew Brown
66d98a023f Allow false return value 2017-02-08 22:45:18 -05:00
Matthew Brown
fe803129cf Fix #77 with correct range param 2017-01-29 00:24:55 -05:00
Matt Brown
86201e71b2 Make arguments of SplFileObject::fputcsv optional 2017-01-19 17:58:34 -05:00
Matthew Brown
3510757d89 Prevent potentially confusing output calculating array_keys 2017-01-19 00:52:02 -05:00
Matthew Brown
6b95b84577 Add DateTimeInterface methods 2017-01-15 20:08:13 -05:00
Matthew Brown
9746c8972f Fix MixedAssignment errors 2016-12-17 00:48:31 -05:00
Matt Brown
ee2a60499e Fix LimitIterator issue 2016-12-09 18:53:18 -05:00