Skip to content

Commit

Permalink
Modernize: add visibility for class constants
Browse files Browse the repository at this point in the history
... as supported by PHP since PHP 7.1.

Note: the `AssertFileEqualsSpecializationsTest::PATH_TO_EXPECTED` constant is declared as `public` as it is also used by tests in the `TestCaseTestTrait`.
  • Loading branch information
jrfnl committed Jan 14, 2025
1 parent d6cf070 commit 98f8443
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
4 changes: 0 additions & 4 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@
<exclude name="WordPressVIPMinimum.Security.EscapingVoidReturnFunctions"/>
<exclude name="WordPressVIPMinimum.Security.ProperEscapingFunction"/>

<!-- Exclude select "modern PHP" sniffs, which conflict with the minimum supported PHP version of this package. -->
<exclude name="PSR12.Properties.ConstantVisibility"/><!-- PHP 7.1+. -->
<exclude name="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/><!-- PHP 7.1+. -->

<!-- As this repo is about providing assertions, "mixed" is a perfectly valid type. -->
<exclude name="SlevomatCodingStandard.TypeHints.DisallowMixedTypeHint"/>
</rule>
Expand Down
2 changes: 1 addition & 1 deletion phpunitpolyfills-autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class Autoload {
*
* @var string
*/
const VERSION = '4.0.0-dev';
public const VERSION = '4.0.0-dev';

/**
* Loads a class.
Expand Down
10 changes: 5 additions & 5 deletions tests/Polyfills/AssertFileEqualsSpecializationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ final class AssertFileEqualsSpecializationsTest extends TestCase {

use AssertFileEqualsSpecializations;

const PATH_TO_EXPECTED = __DIR__ . '/Fixtures/AssertFileEqualsSpecialization_Expected.txt';
public const PATH_TO_EXPECTED = __DIR__ . '/Fixtures/AssertFileEqualsSpecialization_Expected.txt';

const PATH_TO_EQUALS = __DIR__ . '/Fixtures/AssertFileEqualsSpecialization_Equals.txt';
private const PATH_TO_EQUALS = __DIR__ . '/Fixtures/AssertFileEqualsSpecialization_Equals.txt';

const PATH_TO_NOT_EQUALS = __DIR__ . '/Fixtures/AssertFileEqualsSpecialization_NotEquals.txt';
private const PATH_TO_NOT_EQUALS = __DIR__ . '/Fixtures/AssertFileEqualsSpecialization_NotEquals.txt';

const PATH_TO_EQUALS_CI = __DIR__ . '/Fixtures/AssertFileEqualsSpecialization_EqualsCI.txt';
private const PATH_TO_EQUALS_CI = __DIR__ . '/Fixtures/AssertFileEqualsSpecialization_EqualsCI.txt';

const PATH_TO_NOT_EQUALS_CI = __DIR__ . '/Fixtures/AssertFileEqualsSpecialization_NotEqualsCI.txt';
private const PATH_TO_NOT_EQUALS_CI = __DIR__ . '/Fixtures/AssertFileEqualsSpecialization_NotEqualsCI.txt';

/**
* Verify availability of the assertFileEqualsCanonicalizing() method.
Expand Down
2 changes: 1 addition & 1 deletion tests/Polyfills/AssertObjectEqualsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final class AssertObjectEqualsTest extends TestCase {
*
* @var string
*/
const COMPARATOR_EXCEPTION = InvalidComparisonMethodException::class;
private const COMPARATOR_EXCEPTION = InvalidComparisonMethodException::class;

/**
* Verify availability of the assertObjectEquals() method.
Expand Down
2 changes: 1 addition & 1 deletion tests/Polyfills/AssertObjectNotEqualsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final class AssertObjectNotEqualsTest extends TestCase {
*
* @var string
*/
const COMPARATOR_EXCEPTION = InvalidComparisonMethodException::class;
private const COMPARATOR_EXCEPTION = InvalidComparisonMethodException::class;

/**
* Verify availability of the assertObjectNotEquals() method.
Expand Down
4 changes: 2 additions & 2 deletions tests/Polyfills/AssertionRenamesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ final class AssertionRenamesTest extends TestCase {

use AssertionRenames;

const NOT_EXISTENT_FILE = __DIR__ . \DIRECTORY_SEPARATOR . 'NotExisting.php';
private const NOT_EXISTENT_FILE = __DIR__ . \DIRECTORY_SEPARATOR . 'NotExisting.php';

const NOT_EXISTENT_DIR = __DIR__ . \DIRECTORY_SEPARATOR . 'NotExisting' . \DIRECTORY_SEPARATOR;
private const NOT_EXISTENT_DIR = __DIR__ . \DIRECTORY_SEPARATOR . 'NotExisting' . \DIRECTORY_SEPARATOR;

/**
* Verify availability of the assertIsNotReadable() method.
Expand Down

0 comments on commit 98f8443

Please sign in to comment.