Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[php] Try to follow Psalm tips #238

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions php/psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<psalm
errorLevel="1"
resolveFromConfigFile="true"
findUnusedBaselineEntry="false"
findUnusedCode="false"
findUnusedBaselineEntry="true"
findUnusedCode="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand Down
4 changes: 2 additions & 2 deletions php/src/AstNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public function add(RuleType $ruleType, object|array|string $entry): void
/**
* @template T of object
*
* @param class-string<T> $expectedType
* @param class-string<T> $_expectedType
*
* @psalm-return list<T>
*/
public function getItems(string $expectedType, RuleType $ruleType): array
public function getItems(string $_expectedType, RuleType $ruleType): array
mpkorstanje marked this conversation as resolved.
Show resolved Hide resolved
{
$items = $this->subItems[$ruleType->name] ?? [];

Expand Down
6 changes: 4 additions & 2 deletions php/src/GherkinParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

/**
* Parses a Gherkin document (or list of Source envelopes) and emits Cucumber Messages envelopes
*
* @psalm-api
*/
final class GherkinParser
{
Expand All @@ -28,13 +30,13 @@ final class GherkinParser
* @param bool $predictableIds Ignored if IdGenerator is provided
*/
public function __construct(
private readonly bool $predictableIds = false,
bool $predictableIds = false,
mpkorstanje marked this conversation as resolved.
Show resolved Hide resolved
private readonly bool $includeSource = true,
private readonly bool $includeGherkinDocument = true,
private readonly bool $includePickles = true,
?IdGenerator $idGenerator = null,
) {
$this->idGenerator = $idGenerator ?? ($this->predictableIds ? new IncrementingIdGenerator() : new UuidIdGenerator());
$this->idGenerator = $idGenerator ?? ($predictableIds ? new IncrementingIdGenerator() : new UuidIdGenerator());
$this->pickleCompiler = new PickleCompiler($this->idGenerator);
}

Expand Down
3 changes: 3 additions & 0 deletions php/src/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Cucumber\Gherkin;

/**
* @psalm-api
*/
final class Location
{
public function __construct(
Expand Down
6 changes: 2 additions & 4 deletions php/src/Parser/ParserTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,10 @@ private function addError(ParserContext $context, ParserException $error): void
/**
* @template U
* @param callable() : U $action
*
* @return U
*/
private function handleAstError(ParserContext $context, callable $action): mixed
private function handleAstError(ParserContext $context, callable $action): void
{
return $this->handleExternalError($context, $action, null);
$this->handleExternalError($context, $action, null);
mpkorstanje marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down
Loading