Skip to content

Commit

Permalink
Fix static analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Nov 29, 2024
1 parent c83e779 commit 000e12d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
1 change: 0 additions & 1 deletion generator/src/OperatorClassGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
use function interface_exists;
use function rtrim;
use function sprintf;
use function var_export;

/**
* Generates a value object class for stages and operators.
Expand Down
3 changes: 3 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,7 @@
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
<exclude-pattern>/tests/SpecTests/*/Prose*</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint.UselessDocComment">
<exclude-pattern>src/Builder/Type/OperatorInterface.php</exclude-pattern>
</rule>
</ruleset>
30 changes: 30 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
<code><![CDATA[$val]]></code>
<code><![CDATA[$val]]></code>
</MixedAssignment>
<MixedInferredReturnType>
<code><![CDATA[stdClass]]></code>
</MixedInferredReturnType>
<MixedReturnStatement>
<code><![CDATA[$result]]></code>
</MixedReturnStatement>
</file>
<file src="src/Builder/Encoder/OutputWindowEncoder.php">
<MixedArgument>
Expand Down Expand Up @@ -168,7 +174,26 @@
<code><![CDATA[stdClass]]></code>
</TooManyTemplateParams>
</file>
<file src="src/Builder/Type/CombinedFieldQuery.php">
<MixedArgument>
<code><![CDATA[$operator]]></code>
<code><![CDATA[$operator]]></code>
</MixedArgument>
<MixedArrayOffset>
<code><![CDATA[$seenOperators[$operator]]]></code>
</MixedArrayOffset>
<MixedAssignment>
<code><![CDATA[$operator]]></code>
</MixedAssignment>
</file>
<file src="src/Builder/Type/QueryObject.php">
<MixedArgument>
<code><![CDATA[$query::NAME]]></code>
</MixedArgument>
<MixedArrayOffset>
<code><![CDATA[$seenQueryOperators[$query::NAME]]]></code>
<code><![CDATA[$seenQueryOperators[$query::NAME]]]></code>
</MixedArrayOffset>
<MixedAssignment>
<code><![CDATA[$queries[$fieldPath]]]></code>
<code><![CDATA[$query]]></code>
Expand All @@ -179,6 +204,11 @@
is_array($queriesOrArrayOfQueries[0]) &&
count($queriesOrArrayOfQueries[0]) > 0]]></code>
</RedundantConditionGivenDocblockType>
<UndefinedConstant>
<code><![CDATA[$query::NAME]]></code>
<code><![CDATA[$query::NAME]]></code>
<code><![CDATA[$query::NAME]]></code>
</UndefinedConstant>
</file>
<file src="src/ChangeStream.php">
<DeprecatedConstant>
Expand Down
1 change: 1 addition & 0 deletions src/Builder/Type/CombinedFieldQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ static function (array $fieldQueries, QueryInterface|FieldQueryInterface|Type|st
);

// Validate FieldQuery types and non-duplicate operators
/** @var array<string, true> $seenOperators */
$seenOperators = [];
foreach ($this->fieldQueries as $fieldQuery) {
if ($fieldQuery instanceof stdClass) {
Expand Down

0 comments on commit 000e12d

Please sign in to comment.