Skip to content

Commit 9bc7bfb

Browse files
committed
Psalm and PHPUnit Issue Fixes
Signed-off-by: Raj Mohan <[email protected]>
1 parent 20029a5 commit 9bc7bfb

File tree

6 files changed

+9
-14
lines changed

6 files changed

+9
-14
lines changed

src/Cache.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
/**
2828
* \Laminas\Server\Cache: cache server definitions
29+
*
2930
* @psalm-suppress DeprecatedInterface
3031
*/
3132
class Cache
@@ -41,13 +42,10 @@ class Cache
4142
*
4243
* Returns false on any error (typically, inability to write to file), true
4344
* on success.
44-
*
45-
* @param string $filename
46-
* @return bool
4745
*/
4846
public static function save(string $filename, Server $server): bool
4947
{
50-
if ((! file_exists($filename) && ! is_writable(dirname($filename)))) {
48+
if (! file_exists($filename) && ! is_writable(dirname($filename))) {
5149
return false;
5250
}
5351

@@ -155,7 +153,7 @@ private static function createDefinitionFromMethodsDefinition(Definition $method
155153
$definition = new Definition();
156154
/** @psalm-suppress MixedAssignment */
157155
foreach ($methods as $method) {
158-
/** @psalm-suppress MixedMethodCall */
156+
/** @psalm-suppress MixedMethodCall, InvalidMethodCall */
159157
if (in_array($method->getName(), static::$skipMethods, true)) {
160158
continue;
161159
}

src/Definition.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
/**
2525
* Server methods metadata
26+
*
2627
* @psalm-suppress MissingTemplateParam
2728
*/
2829
class Definition implements Countable, Iterator
@@ -134,7 +135,6 @@ public function hasMethod($method)
134135
* Get a given method definition
135136
*
136137
* @param string $method
137-
* @return mixed
138138
*/
139139
public function getMethod($method): mixed
140140
{
@@ -209,7 +209,8 @@ public function count()
209209
/**
210210
* Iterator: current item
211211
*
212-
* @return
212+
* @psalm-suppress MixedInferredReturnType
213+
* @return array
213214
*/
214215
#[ReturnTypeWillChange]
215216
public function current()

src/Reflection/AbstractFunction.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ protected function reflect()
322322
foreach ($paramTags as $paramTag) {
323323
$paramTypesTmp[] = $paramTag->getTypes();
324324
/** @psalm-suppress RiskyTruthyFalsyComparison*/
325-
$paramDesc[] = $paramTag->getDescription() ? : '';
325+
$paramDesc[] = $paramTag->getDescription() ? : '';
326326
}
327327
}
328328

src/Reflection/Node.php

-4
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ public function attachChild(Node $node)
101101

102102
/**
103103
* Return an array of all child nodes
104-
*
105-
* @return array
106104
*/
107105
public function getChildren(): array
108106
{
@@ -156,8 +154,6 @@ public function setValue($value)
156154
* Retrieves the bottommost nodes of the tree by recursively calling
157155
* getEndPoints() on all children. If a child is null, it returns the parent
158156
* as an end point.
159-
*
160-
* @return array
161157
*/
162158
public function getEndPoints(): array
163159
{

src/Reflection/ReflectionMethod.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function __wakeup()
9898
$this->getInvokeArguments()
9999
);
100100
/** @psalm-suppress MixedArgument */
101-
$this->reflection = new \ReflectionMethod($this->classReflection->getName(), $this->name);
101+
$this->reflection = new \ReflectionMethod($this->classReflection->getName(), $this->name);
102102
}
103103

104104
/**

src/Reflection/ReflectionParameter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function __construct(\ReflectionParameter $r, $type = 'mixed', $descripti
6666
$this->reflection = $r;
6767

6868
// Store parameters needed for (un)serialization
69-
$this->name = $r->getName();
69+
$this->name = $r->getName();
7070
/** @psalm-suppress PossiblyInvalidPropertyAssignmentValue */
7171
$this->functionName = $r->getDeclaringClass()
7272
? [$r->getDeclaringClass()->getName(), $r->getDeclaringFunction()->getName()]

0 commit comments

Comments
 (0)