Skip to content

Commit 7d8cf8b

Browse files
committed
minor #38931 Set constant visibility in tests to private where possible (derrabus)
This PR was merged into the 4.4 branch. Discussion ---------- Set constant visibility in tests to private where possible | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A As discussed on Slack, this PR prepares the introduction of a CS fixer rule to enforce explicit visibility declarations for constants. I've checked class constants in test and fixture classes and if I only found usages within the same class, I've declared them `private`. This way, I also found a few constants that weren't used at all anymore, so I've removed those. Commits ------- 43ce6dfe44 Set constant visibility in tests to private where possible.
2 parents a0bbc0c + a46669c commit 7d8cf8b

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

Tests/Mapping/ClassMetadataTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
class ClassMetadataTest extends TestCase
2626
{
27-
const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
28-
const PARENTCLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent';
29-
const PROVIDERCLASS = 'Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity';
30-
const PROVIDERCHILDCLASS = 'Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderChildEntity';
27+
private const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
28+
private const PARENTCLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent';
29+
private const PROVIDERCLASS = 'Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity';
30+
private const PROVIDERCHILDCLASS = 'Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderChildEntity';
3131

3232
protected $metadata;
3333

Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@
2626

2727
class LazyLoadingMetadataFactoryTest extends TestCase
2828
{
29-
const CLASS_NAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
30-
const PARENT_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent';
31-
const INTERFACE_A_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityInterfaceA';
32-
const INTERFACE_B_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityInterfaceB';
33-
const PARENT_INTERFACE_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParentInterface';
29+
private const CLASS_NAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
30+
private const PARENT_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent';
31+
private const INTERFACE_A_CLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityInterfaceA';
3432

3533
public function testLoadClassMetadataWithInterface()
3634
{

Tests/Mapping/GetterMetadataTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
class GetterMetadataTest extends TestCase
1919
{
20-
const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
20+
private const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
2121

2222
public function testInvalidPropertyName()
2323
{

Tests/Mapping/PropertyMetadataTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919

2020
class PropertyMetadataTest extends TestCase
2121
{
22-
const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
23-
const CLASSNAME_74 = 'Symfony\Component\Validator\Tests\Fixtures\Entity_74';
24-
const CLASSNAME_74_PROXY = 'Symfony\Component\Validator\Tests\Fixtures\Entity_74_Proxy';
25-
const PARENTCLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent';
22+
private const CLASSNAME = 'Symfony\Component\Validator\Tests\Fixtures\Entity';
23+
private const CLASSNAME_74 = 'Symfony\Component\Validator\Tests\Fixtures\Entity_74';
24+
private const CLASSNAME_74_PROXY = 'Symfony\Component\Validator\Tests\Fixtures\Entity_74_Proxy';
25+
private const PARENTCLASS = 'Symfony\Component\Validator\Tests\Fixtures\EntityParent';
2626

2727
public function testInvalidPropertyName()
2828
{

0 commit comments

Comments
 (0)