Skip to content

Commit 6fd96d4

Browse files
authored
Merge pull request #124 from mtorromeo/fix-trim-null
Fixed deprecated null parameter in trim
2 parents c99ef8e + cfa9524 commit 6fd96d4

File tree

5 files changed

+25
-18
lines changed

5 files changed

+25
-18
lines changed

.github/workflows/psalm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
dependencies:
1616
- "locked"
1717
php-version:
18-
- "8.0"
18+
- "8.1"
1919
operating-system:
2020
- "ubuntu-latest"
2121

phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
5+
convertDeprecationsToExceptions="true"
56
colors="true">
67
<testsuites>
78
<testsuite name="laminas-code Test Suite">

psalm-baseline.xml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@
103103
<PossiblyNullOperand occurrences="1">
104104
<code>$namespaceAlias</code>
105105
</PossiblyNullOperand>
106+
<RedundantCondition occurrences="1">
107+
<code>method_exists($constReflection, 'isFinal')</code>
108+
</RedundantCondition>
106109
<RedundantConditionGivenDocblockType occurrences="1">
107110
<code>is_array($constant)</code>
108111
</RedundantConditionGivenDocblockType>
@@ -278,9 +281,6 @@
278281
<code>getName</code>
279282
<code>getName</code>
280283
</MixedMethodCall>
281-
<UndefinedClass occurrences="1">
282-
<code>ReflectionEnumUnitCase</code>
283-
</UndefinedClass>
284284
<UndefinedMethod occurrences="3">
285285
<code>getBackingType</code>
286286
<code>getCases</code>
@@ -367,9 +367,10 @@
367367
</UnsafeInstantiation>
368368
</file>
369369
<file src="src/Generator/MethodGenerator.php">
370-
<MixedArgument occurrences="12">
370+
<MixedArgument occurrences="13">
371371
<code>$array['name']</code>
372372
<code>$parameterOutput</code>
373+
<code>$reflectionMethod-&gt;isStatic()</code>
373374
<code>$value</code>
374375
<code>$value</code>
375376
<code>$value</code>
@@ -459,6 +460,9 @@
459460
<PossiblyFalseArgument occurrences="1">
460461
<code>$reflectionProperty-&gt;getDocBlock()</code>
461462
</PossiblyFalseArgument>
463+
<RedundantCondition occurrences="1">
464+
<code>method_exists($reflectionProperty, 'isReadonly')</code>
465+
</RedundantCondition>
462466
<UnsafeInstantiation occurrences="2">
463467
<code>new static($array['name'])</code>
464468
<code>new static()</code>
@@ -592,18 +596,14 @@
592596
</MissingReturnType>
593597
</file>
594598
<file src="src/Generator/TypeGenerator.php">
595-
<ImpureMethodCall occurrences="4">
599+
<ImpureMethodCall occurrences="5">
596600
<code>allowsNull</code>
597601
<code>getName</code>
598602
<code>getName</code>
599603
<code>getParentClass</code>
604+
<code>getTypes</code>
600605
</ImpureMethodCall>
601-
<MixedArgument occurrences="2"/>
602-
<TypeDoesNotContainType occurrences="1"/>
603-
<UndefinedClass occurrences="2">
604-
<code>ReflectionIntersectionType</code>
605-
<code>ReflectionIntersectionType</code>
606-
</UndefinedClass>
606+
<MixedArgument occurrences="1"/>
607607
</file>
608608
<file src="src/Generator/ValueGenerator.php">
609609
<DocblockTypeContradiction occurrences="1">
@@ -1086,9 +1086,6 @@
10861086
<MixedReturnStatement occurrences="1">
10871087
<code>$tokens</code>
10881088
</MixedReturnStatement>
1089-
<PropertyNotSetInConstructor occurrences="1">
1090-
<code>$shortDescription</code>
1091-
</PropertyNotSetInConstructor>
10921089
<RedundantCondition occurrences="2">
10931090
<code>$context === 0x00</code>
10941091
<code>$this-&gt;shortDescription != '' &amp;&amp; $tagIndex === null</code>
@@ -2304,14 +2301,16 @@
23042301
</UnusedVariable>
23052302
</file>
23062303
<file src="test/Scanner/DocBlockScannerTest.php">
2307-
<InternalMethod occurrences="3">
2304+
<InternalMethod occurrences="4">
2305+
<code>new DocBlockScanner($docComment)</code>
23082306
<code>new DocBlockScanner($docComment)</code>
23092307
<code>new DocBlockScanner($docComment)</code>
23102308
<code>new DocBlockScanner($docComment)</code>
23112309
</InternalMethod>
2312-
<MissingReturnType occurrences="2">
2310+
<MissingReturnType occurrences="3">
23132311
<code>testDocBlockScannerDescriptions</code>
23142312
<code>testDocBlockScannerParsesTagsWithNoValuesProperly</code>
2313+
<code>testInvalidDocBlock</code>
23152314
</MissingReturnType>
23162315
<MixedArgument occurrences="2">
23172316
<code>$tags[0]</code>

src/Scanner/DocBlockScanner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DocBlockScanner
2525
protected $docComment;
2626

2727
/** @var string */
28-
protected $shortDescription;
28+
protected $shortDescription = '';
2929

3030
/** @var string */
3131
protected $longDescription = '';

test/Scanner/DocBlockScannerTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,11 @@ public function testDocBlockScannerDescriptions()
5151
self::assertEquals('Short Description', $tokenScanner->getShortDescription());
5252
self::assertEquals('Long Description continued in the second line', $tokenScanner->getLongDescription());
5353
}
54+
55+
public function testInvalidDocBlock()
56+
{
57+
$docComment = '/**';
58+
$tokenScanner = new DocBlockScanner($docComment);
59+
self::assertEquals('', $tokenScanner->getShortDescription());
60+
}
5461
}

0 commit comments

Comments
 (0)