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

Enforced parameter and return value types in test classes #3575

Merged
merged 1 commit into from
May 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 9 additions & 2 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@

<rule ref="Doctrine">
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"/>
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint"/>
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/>
<exclude name="SlevomatCodingStandard.ControlStructures.ControlStructureSpacing.IncorrectLinesCountAfterLastControlStructure"/>
<exclude name="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants.DisallowedLateStaticBindingForConstant"/>
</rule>

<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint">
<exclude-pattern>*/lib/*</exclude-pattern>
</rule>

<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint">
<exclude-pattern>*/lib/*</exclude-pattern>
</rule>

<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
Expand All @@ -43,6 +49,7 @@
<rule ref="Squiz.Commenting.FunctionComment.InvalidNoReturn">
<exclude-pattern>lib/Doctrine/DBAL/Platforms/AbstractPlatform.php</exclude-pattern>
<exclude-pattern>lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php</exclude-pattern>
<exclude-pattern>tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php</exclude-pattern>
</rule>

<!-- some statement classes close cursor using an empty while-loop -->
Expand Down
10 changes: 5 additions & 5 deletions tests/Doctrine/Tests/DBAL/Cache/QueryCacheProfileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected function setUp() : void
$this->queryCacheProfile = new QueryCacheProfile(self::LIFETIME, self::CACHE_KEY);
}

public function testShouldUseTheGivenCacheKeyIfPresent()
public function testShouldUseTheGivenCacheKeyIfPresent() : void
{
[$cacheKey] = $this->queryCacheProfile->generateCacheKeys(
$this->query,
Expand All @@ -50,7 +50,7 @@ public function testShouldUseTheGivenCacheKeyIfPresent()
self::assertEquals(self::CACHE_KEY, $cacheKey, 'The returned cache key should match the given one');
}

public function testShouldGenerateAnAutomaticKeyIfNoKeyHasBeenGiven()
public function testShouldGenerateAnAutomaticKeyIfNoKeyHasBeenGiven() : void
{
$this->queryCacheProfile = $this->queryCacheProfile->setCacheKey(null);

Expand All @@ -70,7 +70,7 @@ public function testShouldGenerateAnAutomaticKeyIfNoKeyHasBeenGiven()
self::assertNotEmpty($cacheKey, 'The generated cache key should not be empty');
}

public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferentConnections()
public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferentConnections() : void
{
$this->queryCacheProfile = $this->queryCacheProfile->setCacheKey(null);

Expand All @@ -93,7 +93,7 @@ public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferent
self::assertNotEquals($firstCacheKey, $secondCacheKey, 'Cache keys should be different');
}

public function testConnectionParamsShouldBeHashed()
public function testConnectionParamsShouldBeHashed() : void
{
$this->queryCacheProfile = $this->queryCacheProfile->setCacheKey(null);

Expand All @@ -114,7 +114,7 @@ public function testConnectionParamsShouldBeHashed()
}
}

public function testShouldGenerateSameKeysIfNoneOfTheParamsChanges()
public function testShouldGenerateSameKeysIfNoneOfTheParamsChanges() : void
{
$this->queryCacheProfile = $this->queryCacheProfile->setCacheKey(null);

Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/Tests/DBAL/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected function setUp() : void
*
* @group DBAL-81
*/
public function testReturnsDefaultConnectionAutoCommitMode()
public function testReturnsDefaultConnectionAutoCommitMode() : void
{
self::assertTrue($this->config->getAutoCommit());
}
Expand All @@ -40,7 +40,7 @@ public function testReturnsDefaultConnectionAutoCommitMode()
*
* @group DBAL-81
*/
public function testSetsDefaultConnectionAutoCommitMode()
public function testSetsDefaultConnectionAutoCommitMode() : void
{
$this->config->setAutoCommit(false);

Expand Down
Loading