Skip to content

Commit 069abf2

Browse files
authored
Merge pull request #2267 from antograssiot/phpstan
Bump PHPStan version
2 parents a18f7cf + e7774ff commit 069abf2

File tree

9 files changed

+11
-67
lines changed

9 files changed

+11
-67
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
- *update-project-dependencies
111111
- run:
112112
name: Install PHPStan
113-
command: composer global require phpstan/phpstan:0.10.1
113+
command: composer global require phpstan/phpstan:0.10.5
114114
- *save-composer-cache-by-revision
115115
- *save-composer-cache-by-branch
116116
- run:

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ install:
1919
- echo extension=php_pdo_sqlite.dll >> php.ini
2020
- echo memory_limit=3G >> php.ini
2121
- cd %APPVEYOR_BUILD_FOLDER%
22-
- composer install --no-interaction --no-progress
22+
- composer install --no-interaction --no-progress --no-suggest
2323

2424
test_script:
2525
- cd %APPVEYOR_BUILD_FOLDER%

features/security/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ one of the most popular framework validation in the world.
6060

6161
The sending of security headers is ensured by [our "send security headers" functional test suite](send_security_headers.feature)
6262
and the unit tests of the [`RespondListener`](../../tests/EventListener/RespondListenerTest.php), [`ExceptionAction`](../../tests/Action/ExceptionActionTest.php)
63-
and [`ValidationExceptionListener`](../../tests/Bridge/Symfony/Validation/EventListener/ValidationExceptionListenerTest.php).
63+
and [`ValidationExceptionListener`](../../tests/Bridge/Symfony/Validator/EventListener/ValidationExceptionListenerTest.php).
6464

6565
### JSON encoding
6666

src/Bridge/Doctrine/Orm/Util/QueryJoinParser.php

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -100,35 +100,15 @@ public static function getClassMetadataFromJoinAlias(string $alias, QueryBuilder
100100
*/
101101
public static function getJoinRelationship(Join $join): string
102102
{
103-
static $relationshipProperty = null;
104-
static $initialized = false;
105-
106-
if (!$initialized && !method_exists(Join::class, 'getJoin')) {
107-
$relationshipProperty = new \ReflectionProperty(Join::class, '_join');
108-
$relationshipProperty->setAccessible(true);
109-
110-
$initialized = true;
111-
}
112-
113-
return (null === $relationshipProperty) ? $join->getJoin() : $relationshipProperty->getValue($join);
103+
return $join->getJoin();
114104
}
115105

116106
/**
117107
* Gets the alias from a Join expression.
118108
*/
119109
public static function getJoinAlias(Join $join): string
120110
{
121-
static $aliasProperty = null;
122-
static $initialized = false;
123-
124-
if (!$initialized && !method_exists(Join::class, 'getAlias')) {
125-
$aliasProperty = new \ReflectionProperty(Join::class, '_alias');
126-
$aliasProperty->setAccessible(true);
127-
128-
$initialized = true;
129-
}
130-
131-
return (null === $aliasProperty) ? $join->getAlias() : $aliasProperty->getValue($join);
111+
return $join->getAlias();
132112
}
133113

134114
/**
@@ -139,16 +119,6 @@ public static function getJoinAlias(Join $join): string
139119
*/
140120
public static function getOrderByParts(OrderBy $orderBy): array
141121
{
142-
static $partsProperty = null;
143-
static $initialized = false;
144-
145-
if (!$initialized && !method_exists(OrderBy::class, 'getParts')) {
146-
$partsProperty = new \ReflectionProperty(OrderBy::class, '_parts');
147-
$partsProperty->setAccessible(true);
148-
149-
$initialized = true;
150-
}
151-
152-
return (null === $partsProperty) ? $orderBy->getParts() : $partsProperty->getValue($orderBy);
122+
return $orderBy->getParts();
153123
}
154124
}

src/DataProvider/SubresourceDataProviderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ interface SubresourceDataProviderInterface
3232
*
3333
* @throws ResourceClassNotSupportedException
3434
*
35-
* @return object|null
35+
* @return array|object|null
3636
*/
3737
public function getSubresource(string $resourceClass, array $identifiers, array $context, string $operationName = null);
3838
}

src/GraphQl/Type/Definition/IterableType.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use GraphQL\Language\AST\ListValueNode;
2121
use GraphQL\Language\AST\ObjectValueNode;
2222
use GraphQL\Language\AST\StringValueNode;
23+
use GraphQL\Language\AST\ValueNode;
2324
use GraphQL\Type\Definition\ScalarType;
2425
use GraphQL\Utils\Utils;
2526

@@ -80,7 +81,7 @@ public function parseLiteral($valueNode, array $variables = null)
8081
}
8182

8283
/**
83-
* @param StringValueNode|BooleanValueNode|IntValueNode|FloatValueNode|ObjectValueNode|ListValueNode $valueNode
84+
* @param StringValueNode|BooleanValueNode|IntValueNode|FloatValueNode|ObjectValueNode|ListValueNode|ValueNode $valueNode
8485
*/
8586
private function parseIterableLiteral($valueNode)
8687
{

src/Swagger/Serializer/DocumentationNormalizer.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,7 @@ private function updateGetOperation(\ArrayObject $pathOperation, array $mimeType
263263
],
264264
],
265265
];
266-
267-
if (!isset($pathOperation['parameters']) && $parameters = $this->getFiltersParameters($resourceClass, $operationName, $resourceMetadata, $definitions, $serializerContext)) {
268-
$pathOperation['parameters'] = $parameters;
269-
}
266+
$pathOperation['parameters'] ?? $pathOperation['parameters'] = $this->getFiltersParameters($resourceClass, $operationName, $resourceMetadata, $definitions, $serializerContext);
270267

271268
if ($this->paginationEnabled && $resourceMetadata->getCollectionOperationAttribute($operationName, 'pagination_enabled', true, true)) {
272269
$pathOperation['parameters'][] = $this->getPaginationParameters();

tests/Bridge/Doctrine/Orm/Util/QueryJoinParserTest.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ public function testGetJoinRelationshipWithClassJoin()
5555
$this->assertEquals(RelatedDummy::class, QueryJoinParser::getJoinRelationship($join));
5656
}
5757

58-
public function testGetJoinRelationshipWithReflection()
59-
{
60-
$methodExist = $this->getFunctionMock('ApiPlatform\Core\Bridge\Doctrine\Orm\Util', 'method_exists');
61-
$methodExist->expects($this->any())->with(Join::class, 'getJoin')->willReturn('false');
62-
$join = new Join('INNER_JOIN', 'a_1.relatedDummy', 'a_1', null, 'a_1.name = r.name');
63-
$this->assertEquals('a_1.relatedDummy', QueryJoinParser::getJoinRelationship($join));
64-
}
65-
6658
public function testGetJoinAliasWithJoin()
6759
{
6860
$join = new Join('INNER_JOIN', 'relatedDummy', 'a_1', null, 'a_1.name = r.name');
@@ -75,25 +67,9 @@ public function testGetJoinAliasWithClassJoin()
7567
$this->assertEquals('a_1', QueryJoinParser::getJoinAlias($join));
7668
}
7769

78-
public function testGetJoinAliasWithReflection()
79-
{
80-
$methodExist = $this->getFunctionMock('ApiPlatform\Core\Bridge\Doctrine\Orm\Util', 'method_exists');
81-
$methodExist->expects($this->any())->with(Join::class, 'getAlias')->willReturn('false');
82-
$join = new Join('INNER_JOIN', 'relatedDummy', 'a_1', null, 'a_1.name = r.name');
83-
$this->assertEquals('a_1', QueryJoinParser::getJoinAlias($join));
84-
}
85-
8670
public function testGetOrderByPartsWithOrderBy()
8771
{
8872
$orderBy = new OrderBy('name', 'asc');
8973
$this->assertEquals(['name asc'], QueryJoinParser::getOrderByParts($orderBy));
9074
}
91-
92-
public function testGetOrderByPartsWithReflection()
93-
{
94-
$methodExist = $this->getFunctionMock('ApiPlatform\Core\Bridge\Doctrine\Orm\Util', 'method_exists');
95-
$methodExist->expects($this->any())->with(OrderBy::class, 'getParts')->willReturn('false');
96-
$orderBy = new OrderBy('name', 'desc');
97-
$this->assertEquals(['name desc'], QueryJoinParser::getOrderByParts($orderBy));
98-
}
9975
}

tests/Metadata/Property/Factory/InheritedPropertyNameCollectionFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testCreate()
3434

3535
$propertyNameCollectionFactory = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
3636
$propertyNameCollectionFactory->create(DummyTableInheritance::class, [])->willReturn(new PropertyNameCollection(['name']))->shouldBeCalled();
37-
$propertyNameCollectionFactory->create(DummyTableInheritanceChild::class, [])->willReturn(new PropertyNameCollection(['nickname', 169]))->shouldBeCalled();
37+
$propertyNameCollectionFactory->create(DummyTableInheritanceChild::class, [])->willReturn(new PropertyNameCollection(['nickname', '169']))->shouldBeCalled();
3838

3939
$factory = new InheritedPropertyNameCollectionFactory($resourceNameCollectionFactory->reveal(), $propertyNameCollectionFactory->reveal());
4040
$metadata = $factory->create(DummyTableInheritance::class);

0 commit comments

Comments
 (0)