Skip to content

Commit

Permalink
Added PHPStan
Browse files Browse the repository at this point in the history
  • Loading branch information
Steveb-p committed Aug 14, 2023
1 parent 87920d7 commit 0e6f8e2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 87 deletions.
80 changes: 0 additions & 80 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,6 @@ parameters:
count: 1
path: src/contracts/Input/Handler.php

-
message: "#^Method Ibexa\\\\Contracts\\\\Rest\\\\Input\\\\Parser\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/contracts/Input/Parser.php

-
message: "#^Cannot access offset mixed on Ibexa\\\\Contracts\\\\Rest\\\\Input\\\\Parser\\.$#"
count: 2
Expand Down Expand Up @@ -2165,31 +2160,16 @@ parameters:
count: 1
path: src/lib/Server/Input/Parser/Aggregation/AbstractRangeAggregationParser.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Aggregation\\\\AbstractRangeAggregationParser\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Server/Input/Parser/Aggregation/AbstractRangeAggregationParser.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Aggregation\\\\AbstractRangeAggregationParser\\:\\:parseAggregation\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Server/Input/Parser/Aggregation/AbstractRangeAggregationParser.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Aggregation\\\\AbstractStatsAggregationParser\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Server/Input/Parser/Aggregation/AbstractStatsAggregationParser.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Aggregation\\\\AbstractStatsAggregationParser\\:\\:parseAggregation\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Server/Input/Parser/Aggregation/AbstractStatsAggregationParser.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Aggregation\\\\AbstractTermAggregationParser\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Server/Input/Parser/Aggregation/AbstractTermAggregationParser.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Aggregation\\\\AbstractTermAggregationParser\\:\\:parseAggregation\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -2290,11 +2270,6 @@ parameters:
count: 1
path: src/lib/Server/Input/Parser/Aggregation/ObjectStateTermAggregationParser.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Aggregation\\\\Range\\\\AbstractRangeParser\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Server/Input/Parser/Aggregation/Range/AbstractRangeParser.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Aggregation\\\\Range\\\\AbstractRangeParser\\:\\:visitRangeValue\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -2465,16 +2440,6 @@ parameters:
count: 1
path: src/lib/Server/Input/Parser/Criterion/FullText.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Criterion\\\\IsUserBased\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Server/Input/Parser/Criterion/IsUserBased.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Criterion\\\\IsUserEnabled\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Server/Input/Parser/Criterion/IsUserEnabled.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Criterion\\\\LanguageCode\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -2545,11 +2510,6 @@ parameters:
count: 1
path: src/lib/Server/Input/Parser/Criterion/ObjectStateId.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Criterion\\\\ObjectStateIdentifier\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Server/Input/Parser/Criterion/ObjectStateIdentifier.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Criterion\\\\Operator\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
Expand All @@ -2575,41 +2535,16 @@ parameters:
count: 1
path: src/lib/Server/Input/Parser/Criterion/SectionId.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Criterion\\\\SectionIdentifier\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Server/Input/Parser/Criterion/SectionIdentifier.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Criterion\\\\Sibling\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Server/Input/Parser/Criterion/Sibling.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Criterion\\\\Subtree\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Server/Input/Parser/Criterion/Subtree.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Criterion\\\\UserEmail\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Server/Input/Parser/Criterion/UserEmail.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Criterion\\\\UserId\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Server/Input/Parser/Criterion/UserId.php

-
message: "#^Parameter \\#1 \\$value of class Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\Values\\\\Content\\\\Query\\\\Criterion\\\\UserId constructor expects array\\<int\\>\\|int, array\\<int, string\\> given\\.$#"
count: 1
path: src/lib/Server/Input/Parser/Criterion/UserId.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Criterion\\\\UserLogin\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Server/Input/Parser/Criterion/UserLogin.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Criterion\\\\UserMetadata\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
Expand Down Expand Up @@ -2680,11 +2615,6 @@ parameters:
count: 1
path: src/lib/Server/Input/Parser/FieldDefinitionUpdate.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\JWTInput\\:\\:parse\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#"
count: 1
path: src/lib/Server/Input/Parser/JWTInput.php

-
message: "#^Method Ibexa\\\\Rest\\\\Server\\\\Input\\\\Parser\\\\Limitation\\\\PathStringRouteBasedLimitationParser\\:\\:parseIdFromHref\\(\\) has parameter \\$limitationValue with no type specified\\.$#"
count: 1
Expand Down Expand Up @@ -6675,16 +6605,6 @@ parameters:
count: 2
path: tests/bundle/Functional/UserTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Rest\\\\Functional\\\\ViewTest\\:\\:testViewRequestWithAndStatement\\(\\) has no return type specified\\.$#"
count: 1
path: tests/bundle/Functional/ViewTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Rest\\\\Functional\\\\ViewTest\\:\\:testViewRequestWithOrStatement\\(\\) has no return type specified\\.$#"
count: 1
path: tests/bundle/Functional/ViewTest.php

-
message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Rest\\\\RequestParser\\\\RouterTest\\:\\:getRouterMock\\(\\) should return PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&Symfony\\\\Component\\\\Routing\\\\RouterInterface but returns Symfony\\\\Component\\\\Routing\\\\RouterInterface\\.$#"
count: 1
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/Input/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ abstract class Parser
/**
* Parse input structure.
*
* @param array $data
* @param array<mixed> $data
* @param \Ibexa\Contracts\Rest\Input\ParsingDispatcher $parsingDispatcher
*
* @return \Ibexa\Contracts\Core\Repository\Values\ValueObject|object
Expand Down
27 changes: 21 additions & 6 deletions tests/bundle/Functional/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,36 +95,51 @@ public function provideForViewTest(): iterable
);

yield $template(self::CRITERION_LOCATION_DEPTH, self::OPERATOR_EQUALITY, self::FORMAT_XML) => [
file_get_contents(__DIR__ . '/_input/search/LocationDepth.eq.xml'),
$this->loadFile(__DIR__ . '/_input/search/LocationDepth.eq.xml'),
self::FORMAT_XML,
];

yield $template(self::CRITERION_LOCATION_DEPTH, self::OPERATOR_EQUALITY, self::FORMAT_JSON) => [
file_get_contents(__DIR__ . '/_input/search/LocationDepth.eq.json'),
$this->loadFile(__DIR__ . '/_input/search/LocationDepth.eq.json'),
self::FORMAT_JSON,
];

yield $template(self::CRITERION_LOCATION_DEPTH, self::OPERATOR_IN, self::FORMAT_XML) => [
file_get_contents(__DIR__ . '/_input/search/LocationDepth.in.xml'),
$this->loadFile(__DIR__ . '/_input/search/LocationDepth.in.xml'),
self::FORMAT_XML,
];

yield $template(self::CRITERION_LOCATION_DEPTH, self::OPERATOR_IN, self::FORMAT_JSON) => [
file_get_contents(__DIR__ . '/_input/search/LocationDepth.in.json'),
$this->loadFile(__DIR__ . '/_input/search/LocationDepth.in.json'),
self::FORMAT_JSON,
];

yield $template(self::CRITERION_IS_MAIN_LOCATION, self::OPERATOR_EQUALITY, self::FORMAT_XML) => [
file_get_contents(__DIR__ . '/_input/search/IsMainLocation.xml'),
$this->loadFile(__DIR__ . '/_input/search/IsMainLocation.xml'),
self::FORMAT_XML,
];

yield $template(self::CRITERION_IS_MAIN_LOCATION, self::OPERATOR_EQUALITY, self::FORMAT_JSON) => [
file_get_contents(__DIR__ . '/_input/search/IsMainLocation.json'),
$this->loadFile(__DIR__ . '/_input/search/IsMainLocation.json'),
self::FORMAT_JSON,
];
}

private function loadFile(string $filepath): string
{
$data = file_get_contents($filepath);

if ($data === false) {
throw new \RuntimeException(sprintf(
'Unable to get contents for file: "%s". Ensure it exists and is readable.',
$filepath,
));
}

return $data;
}


/**
* Covers POST /views.
*
Expand Down

0 comments on commit 0e6f8e2

Please sign in to comment.