Skip to content

Commit

Permalink
Merge pull request #124 from mtorromeo/fix-trim-null
Browse files Browse the repository at this point in the history
Fixed deprecated null parameter in trim
  • Loading branch information
Ocramius authored Dec 19, 2021
2 parents c99ef8e + cfa9524 commit 6fd96d4
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
dependencies:
- "locked"
php-version:
- "8.0"
- "8.1"
operating-system:
- "ubuntu-latest"

Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
convertDeprecationsToExceptions="true"
colors="true">
<testsuites>
<testsuite name="laminas-code Test Suite">
Expand Down
31 changes: 15 additions & 16 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@
<PossiblyNullOperand occurrences="1">
<code>$namespaceAlias</code>
</PossiblyNullOperand>
<RedundantCondition occurrences="1">
<code>method_exists($constReflection, 'isFinal')</code>
</RedundantCondition>
<RedundantConditionGivenDocblockType occurrences="1">
<code>is_array($constant)</code>
</RedundantConditionGivenDocblockType>
Expand Down Expand Up @@ -278,9 +281,6 @@
<code>getName</code>
<code>getName</code>
</MixedMethodCall>
<UndefinedClass occurrences="1">
<code>ReflectionEnumUnitCase</code>
</UndefinedClass>
<UndefinedMethod occurrences="3">
<code>getBackingType</code>
<code>getCases</code>
Expand Down Expand Up @@ -367,9 +367,10 @@
</UnsafeInstantiation>
</file>
<file src="src/Generator/MethodGenerator.php">
<MixedArgument occurrences="12">
<MixedArgument occurrences="13">
<code>$array['name']</code>
<code>$parameterOutput</code>
<code>$reflectionMethod-&gt;isStatic()</code>
<code>$value</code>
<code>$value</code>
<code>$value</code>
Expand Down Expand Up @@ -459,6 +460,9 @@
<PossiblyFalseArgument occurrences="1">
<code>$reflectionProperty-&gt;getDocBlock()</code>
</PossiblyFalseArgument>
<RedundantCondition occurrences="1">
<code>method_exists($reflectionProperty, 'isReadonly')</code>
</RedundantCondition>
<UnsafeInstantiation occurrences="2">
<code>new static($array['name'])</code>
<code>new static()</code>
Expand Down Expand Up @@ -592,18 +596,14 @@
</MissingReturnType>
</file>
<file src="src/Generator/TypeGenerator.php">
<ImpureMethodCall occurrences="4">
<ImpureMethodCall occurrences="5">
<code>allowsNull</code>
<code>getName</code>
<code>getName</code>
<code>getParentClass</code>
<code>getTypes</code>
</ImpureMethodCall>
<MixedArgument occurrences="2"/>
<TypeDoesNotContainType occurrences="1"/>
<UndefinedClass occurrences="2">
<code>ReflectionIntersectionType</code>
<code>ReflectionIntersectionType</code>
</UndefinedClass>
<MixedArgument occurrences="1"/>
</file>
<file src="src/Generator/ValueGenerator.php">
<DocblockTypeContradiction occurrences="1">
Expand Down Expand Up @@ -1086,9 +1086,6 @@
<MixedReturnStatement occurrences="1">
<code>$tokens</code>
</MixedReturnStatement>
<PropertyNotSetInConstructor occurrences="1">
<code>$shortDescription</code>
</PropertyNotSetInConstructor>
<RedundantCondition occurrences="2">
<code>$context === 0x00</code>
<code>$this-&gt;shortDescription != '' &amp;&amp; $tagIndex === null</code>
Expand Down Expand Up @@ -2304,14 +2301,16 @@
</UnusedVariable>
</file>
<file src="test/Scanner/DocBlockScannerTest.php">
<InternalMethod occurrences="3">
<InternalMethod occurrences="4">
<code>new DocBlockScanner($docComment)</code>
<code>new DocBlockScanner($docComment)</code>
<code>new DocBlockScanner($docComment)</code>
<code>new DocBlockScanner($docComment)</code>
</InternalMethod>
<MissingReturnType occurrences="2">
<MissingReturnType occurrences="3">
<code>testDocBlockScannerDescriptions</code>
<code>testDocBlockScannerParsesTagsWithNoValuesProperly</code>
<code>testInvalidDocBlock</code>
</MissingReturnType>
<MixedArgument occurrences="2">
<code>$tags[0]</code>
Expand Down
2 changes: 1 addition & 1 deletion src/Scanner/DocBlockScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DocBlockScanner
protected $docComment;

/** @var string */
protected $shortDescription;
protected $shortDescription = '';

/** @var string */
protected $longDescription = '';
Expand Down
7 changes: 7 additions & 0 deletions test/Scanner/DocBlockScannerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,11 @@ public function testDocBlockScannerDescriptions()
self::assertEquals('Short Description', $tokenScanner->getShortDescription());
self::assertEquals('Long Description continued in the second line', $tokenScanner->getLongDescription());
}

public function testInvalidDocBlock()
{
$docComment = '/**';
$tokenScanner = new DocBlockScanner($docComment);
self::assertEquals('', $tokenScanner->getShortDescription());
}
}

0 comments on commit 6fd96d4

Please sign in to comment.