Skip to content

Commit a890e0c

Browse files
committed
bump phpstan/psalm and fix token issues found
1 parent 1642bd5 commit a890e0c

File tree

4 files changed

+14
-75
lines changed

4 files changed

+14
-75
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"friendsofphp/php-cs-fixer": "^2.7",
1414
"psr/cache": "^1.0",
1515
"tedivm/stash": "^0.14",
16-
"vimeo/psalm": "^1.0",
17-
"phpstan/phpstan": "^0.9"
16+
"vimeo/psalm": "^2.0",
17+
"phpstan/phpstan": "^0.10"
1818
},
1919
"suggest": {
2020
"ext-redis": "^2.2",

psalm.xml

Lines changed: 6 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
xsi:schemaLocation="https://getpsalm.org/schema/config file:///home/david/src/RateLimit/vendor/vimeo/psalm/config.xsd"
77
>
88
<projectFiles>
9-
<directory name="src" />
9+
<directory name="src/" />
10+
<ignoreFiles>
11+
<directory name="vendor" />
12+
</ignoreFiles>
1013
</projectFiles>
1114

1215
<issueHandlers>
@@ -17,7 +20,9 @@
1720
<DeprecatedMethod errorLevel="info" />
1821
<DeprecatedProperty errorLevel="info" />
1922
<DeprecatedClass errorLevel="info" />
23+
<DeprecatedConstant errorLevel="info" />
2024
<DeprecatedInterface errorLevel="info" />
25+
<DeprecatedTrait errorLevel="info" />
2126

2227
<MissingClosureReturnType errorLevel="info" />
2328
<MissingReturnType errorLevel="info" />
@@ -38,71 +43,5 @@
3843
<UnresolvableInclude errorLevel="info" />
3944

4045
<RawObjectIteration errorLevel="info" />
41-
42-
<!-- level 4 issues - points to possible deficiencies in logic, higher false-positives -->
43-
44-
<MoreSpecificReturnType errorLevel="info" />
45-
<LessSpecificReturnStatement errorLevel="info" />
46-
<TypeCoercion errorLevel="info" />
47-
48-
<PossiblyFalseArgument errorLevel="info" />
49-
<PossiblyFalseIterator errorLevel="info" />
50-
<PossiblyFalseOperand errorLevel="info" />
51-
<PossiblyFalsePropertyAssignmentValue errorLevel="info" />
52-
<PossiblyFalseReference errorLevel="info" />
53-
<PossiblyInvalidArgument errorLevel="info" />
54-
<PossiblyInvalidArrayAccess errorLevel="info" />
55-
<PossiblyInvalidArrayAssignment errorLevel="info" />
56-
<PossiblyInvalidArrayOffset errorLevel="info" />
57-
<PossiblyInvalidFunctionCall errorLevel="info" />
58-
<PossiblyInvalidIterator errorLevel="info" />
59-
<PossiblyInvalidMethodCall errorLevel="info" />
60-
<PossiblyInvalidOperand errorLevel="info" />
61-
<PossiblyInvalidPropertyAssignment errorLevel="info" />
62-
<PossiblyInvalidPropertyAssignmentValue errorLevel="info" />
63-
<PossiblyInvalidPropertyFetch errorLevel="info" />
64-
<PossiblyNullArgument errorLevel="info" />
65-
<PossiblyNullArrayAccess errorLevel="info" />
66-
<PossiblyNullArrayAssignment errorLevel="info" />
67-
<PossiblyNullArrayOffset errorLevel="info" />
68-
<PossiblyNullFunctionCall errorLevel="info" />
69-
<PossiblyNullIterator errorLevel="info" />
70-
<PossiblyNullOperand errorLevel="info" />
71-
<PossiblyNullPropertyAssignment errorLevel="info" />
72-
<PossiblyNullPropertyAssignmentValue errorLevel="info" />
73-
<PossiblyNullPropertyFetch errorLevel="info" />
74-
<PossiblyNullReference errorLevel="info" />
75-
<PossiblyUndefinedGlobalVariable errorLevel="info" />
76-
<PossiblyUndefinedVariable errorLevel="info" />
77-
<PossiblyUndefinedMethod errorLevel="info" />
78-
79-
<!-- level 5 issues - should be avoided at mosts costs... -->
80-
81-
<ForbiddenCode errorLevel="info" />
82-
<ImplicitToStringCast errorLevel="info" />
83-
<InvalidScalarArgument errorLevel="info" />
84-
<InvalidToString errorLevel="info" />
85-
<InvalidOperand errorLevel="info" />
86-
<NoInterfaceProperties errorLevel="info" />
87-
<TooManyArguments errorLevel="info" />
88-
<TypeDoesNotContainType errorLevel="info" />
89-
<TypeDoesNotContainNull errorLevel="info" />
90-
<MissingDocblockType errorLevel="info" />
91-
<ImplementedReturnTypeMismatch errorLevel="info" />
92-
93-
<!-- level 6 issues - really bad things -->
94-
95-
<InvalidNullableReturnType errorLevel="info" />
96-
<NullableReturnStatement errorLevel="info" />
97-
<InvalidFalsableReturnType errorLevel="info" />
98-
<FalsableReturnStatement errorLevel="info" />
99-
100-
<MoreSpecificImplementedParamType errorLevel="info" />
101-
<MoreSpecificImplementedReturnType errorLevel="info" />
102-
103-
<InvalidReturnStatement errorLevel="info" />
104-
<InvalidReturnType errorLevel="info" />
105-
<UndefinedThisPropertyAssignment errorLevel="info" />
106-
10746
</issueHandlers>
10847
</psalm>

src/Adapter/Predis.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function __construct(\Predis\ClientInterface $client)
2121

2222
public function set($key, $value, $ttl)
2323
{
24-
return $this->redis->set($key, $value, "ex", $ttl);
24+
return $this->redis->set($key, (string) $value, "ex", $ttl);
2525
}
2626

2727
/**
@@ -39,6 +39,6 @@ public function exists($key)
3939

4040
public function del($key)
4141
{
42-
return (bool)$this->redis->del($key);
42+
return (bool)$this->redis->del([$key]);
4343
}
4444
}

src/Adapter/Redis.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,24 @@ public function __construct(\Redis $redis)
2525

2626
public function set($key, $value, $ttl)
2727
{
28-
return $this->redis->set($key, $value, $ttl);
28+
return $this->redis->set($key, (string)$value, $ttl);
2929
}
3030

3131
/**
3232
* @return float
3333
*/
3434
public function get($key)
3535
{
36-
return (float) $this->redis->get($key);
36+
return (float)$this->redis->get($key);
3737
}
3838

3939
public function exists($key)
4040
{
41-
return $this->redis->exists($key);
41+
return $this->redis->exists($key) == true;
4242
}
4343

4444
public function del($key)
4545
{
46-
return $this->redis->del($key);
46+
return $this->redis->del($key) > 0;
4747
}
4848
}

0 commit comments

Comments
 (0)