Skip to content

Commit f7eb16f

Browse files
authored
Merge pull request #697 from PHPCSStandards/develop
Release 1.1.1
2 parents 6535567 + 9ace3d3 commit f7eb16f

File tree

13 files changed

+66
-27
lines changed

13 files changed

+66
-27
lines changed

.github/workflows/quicktest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ jobs:
5454
id: set_ini
5555
run: |
5656
if [ "${{ contains( matrix.phpcs_version, 'dev') }}" == "false" ]; then
57-
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> "$GITHUB_OUTPUT"
57+
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On, display_startup_errors=On' >> "$GITHUB_OUTPUT"
5858
else
59-
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
59+
echo 'PHP_INI=error_reporting=-1, display_errors=On, display_startup_errors=On' >> "$GITHUB_OUTPUT"
6060
fi
6161
6262
- name: Install PHP

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ jobs:
169169
id: set_ini
170170
run: |
171171
if [ "${{ contains( matrix.phpcs_version, 'dev') }}" == "false" ]; then
172-
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> "$GITHUB_OUTPUT"
172+
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On, display_startup_errors=On' >> "$GITHUB_OUTPUT"
173173
else
174-
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
174+
echo 'PHP_INI=error_reporting=-1, display_errors=On, display_startup_errors=On' >> "$GITHUB_OUTPUT"
175175
fi
176176
177177
- name: Install PHP
@@ -302,9 +302,9 @@ jobs:
302302
id: set_ini
303303
run: |
304304
if [ "${{ contains( matrix.phpcs_version, 'dev') }}" == "false" ]; then
305-
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On' >> "$GITHUB_OUTPUT"
305+
echo 'PHP_INI=error_reporting=E_ALL & ~E_DEPRECATED, display_errors=On, display_startup_errors=On' >> "$GITHUB_OUTPUT"
306306
else
307-
echo 'PHP_INI=error_reporting=-1, display_errors=On' >> "$GITHUB_OUTPUT"
307+
echo 'PHP_INI=error_reporting=-1, display_errors=On, display_startup_errors=On' >> "$GITHUB_OUTPUT"
308308
fi
309309
310310
- name: Install PHP

.github/workflows/update-phpcs-versionnr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
phpcs-version-check:
2222
name: "Check latest PHPCS version"
2323
# Don't run the cron job on forks.
24-
if: ${{ github.event_name != 'schedule' || github.repository == 'PHPCSStandards/PHPCSUtils' }}
24+
if: ${{ github.event_name != 'schedule' || github.event.repository.fork == false }}
2525

2626
runs-on: ubuntu-latest
2727
steps:

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,24 @@ This projects adheres to [Keep a CHANGELOG](https://keepachangelog.com/) and use
1010
_Nothing yet._
1111

1212

13+
## [1.1.1] - 2025-08-10
14+
15+
### Changed
16+
17+
#### TestUtils
18+
19+
* The [`PHPCSUtils\TestUtils\UtilityMethodTestCase`][`UtilityMethodTestCase`] now uses the PHP_CodeSniffer `LocalFile` instead of the `DummyFile` class under the hood. [#692]
20+
21+
### Fixed
22+
23+
#### TestUtils
24+
25+
* Prevent PHP 8.5 deprecation notices for `Reflection*::setAccessible()` in the [`PHPCSUtils\TestUtils\UtilityMethodTestCase`][`UtilityMethodTestCase`] and the [`PHPCSUtils\TestUtils\ConfigDouble`][`ConfigDouble`] classes. [#695]
26+
27+
[#692]: https://github.com/PHPCSStandards/PHPCSUtils/pull/692
28+
[#695]: https://github.com/PHPCSStandards/PHPCSUtils/pull/695
29+
30+
1331
## [1.1.0] - 2025-06-12
1432

1533
### Added
@@ -1221,6 +1239,7 @@ This initial alpha release contains the following utility classes:
12211239

12221240

12231241
[Unreleased]: https://github.com/PHPCSStandards/PHPCSUtils/compare/stable...HEAD
1242+
[1.1.1]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.1.0...1.1.1
12241243
[1.1.0]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.12...1.1.0
12251244
[1.0.12]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.11...1.0.12
12261245
[1.0.11]: https://github.com/PHPCSStandards/PHPCSUtils/compare/1.0.10...1.0.11

PHPCSUtils/TestUtils/ConfigDouble.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ private function preventAutoDiscoveryScreenWidth()
211211
public function getStaticConfigProperty($name)
212212
{
213213
$property = new ReflectionProperty('PHP_CodeSniffer\Config', $name);
214-
$property->setAccessible(true);
214+
(\PHP_VERSION_ID < 80100) && $property->setAccessible(true);
215215

216216
if ($name === 'overriddenDefaults' && \version_compare($this->phpcsVersion, '3.99.99', '>')) {
217217
return $property->getValue($this);
@@ -236,14 +236,14 @@ public function getStaticConfigProperty($name)
236236
public function setStaticConfigProperty($name, $value)
237237
{
238238
$property = new ReflectionProperty('PHP_CodeSniffer\Config', $name);
239-
$property->setAccessible(true);
239+
(\PHP_VERSION_ID < 80100) && $property->setAccessible(true);
240240

241241
if ($name === 'overriddenDefaults' && \version_compare($this->phpcsVersion, '3.99.99', '>')) {
242242
$property->setValue($this, $value);
243243
} else {
244244
$property->setValue(null, $value);
245245
}
246246

247-
$property->setAccessible(false);
247+
(\PHP_VERSION_ID < 80100) && $property->setAccessible(false);
248248
}
249249
}

PHPCSUtils/TestUtils/UtilityMethodTestCase.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
use PHP_CodeSniffer\Config;
1414
use PHP_CodeSniffer\Exceptions\TokenizerException;
15-
use PHP_CodeSniffer\Files\DummyFile;
1615
use PHP_CodeSniffer\Files\File;
16+
use PHP_CodeSniffer\Files\LocalFile;
1717
use PHP_CodeSniffer\Ruleset;
1818
use PHPCSUtils\BackCompat\Helper;
1919
use PHPCSUtils\Exceptions\TestFileNotFound;
@@ -253,11 +253,7 @@ protected static function parseFile($caseFile, Ruleset $ruleset, Config $config)
253253
parent::fail("Test case file missing. Expected case file location: $caseFile");
254254
}
255255

256-
// Make sure the file gets parsed correctly based on the file type.
257-
$contents = \file_get_contents($caseFile);
258-
$contents = 'phpcs_input_file: ' . $caseFile . \PHP_EOL . $contents;
259-
260-
$file = new DummyFile($contents, $ruleset, $config);
256+
$file = new LocalFile($caseFile, $ruleset, $config);
261257

262258
// Only tokenize the file, do not process it.
263259
try {
@@ -353,9 +349,9 @@ public static function resetTestFile()
353349
public static function setStaticConfigProperty($name, $value)
354350
{
355351
$property = new ReflectionProperty('PHP_CodeSniffer\Config', $name);
356-
$property->setAccessible(true);
352+
(\PHP_VERSION_ID < 80100) && $property->setAccessible(true);
357353
$property->setValue(null, $value);
358-
$property->setAccessible(false);
354+
(\PHP_VERSION_ID < 80100) && $property->setAccessible(false);
359355
}
360356

361357
/**

Tests/AssertPropertySame.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ public static function getObjectPropertyValue($objectUnderTest, $propertyName)
7878
return $objectUnderTest->$propertyName;
7979
}
8080

81-
$property->setAccessible(true);
81+
(\PHP_VERSION_ID < 80100) && $property->setAccessible(true);
8282
$value = $property->getValue($objectUnderTest);
83-
$property->setAccessible(false);
83+
(\PHP_VERSION_ID < 80100) && $property->setAccessible(false);
8484

8585
return $value;
8686
} catch (ReflectionException $e) {

Tests/BackCompat/Helper/GetVersionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ final class GetVersionTest extends TestCase
3030
*
3131
* @var string
3232
*/
33-
const LATEST_3X_VERSION = '3.13.0';
33+
const LATEST_3X_VERSION = '3.13.2';
3434

3535
/**
3636
* Version number of the last PHPCS 4.x release.

Tests/TestUtils/ConfigDouble/ConfigDoubleTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function testDestruct()
300300
private function getStaticConfigProperty($name, $config = null)
301301
{
302302
$property = new ReflectionProperty('PHP_CodeSniffer\Config', $name);
303-
$property->setAccessible(true);
303+
(\PHP_VERSION_ID < 80100) && $property->setAccessible(true);
304304

305305
if ($name === 'overriddenDefaults' && \version_compare(Helper::getVersion(), '3.99.99', '>')) {
306306
// The `overriddenDefaults` property is no longer static on PHPCS 4.0+.
@@ -330,8 +330,8 @@ public static function setStaticConfigProperty($name, $value)
330330
}
331331

332332
$property = new ReflectionProperty('PHP_CodeSniffer\Config', $name);
333-
$property->setAccessible(true);
333+
(\PHP_VERSION_ID < 80100) && $property->setAccessible(true);
334334
$property->setValue(null, $value);
335-
$property->setAccessible(false);
335+
(\PHP_VERSION_ID < 80100) && $property->setAccessible(false);
336336
}
337337
}

Tests/TestUtils/UtilityMethodTestCase/ResetTestFileTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public function testTearDownCleansUpStaticConfigProperties()
183183
private function getStaticConfigProperty($name, $config = null)
184184
{
185185
$property = new ReflectionProperty('PHP_CodeSniffer\Config', $name);
186-
$property->setAccessible(true);
186+
(\PHP_VERSION_ID < 80100) && $property->setAccessible(true);
187187

188188
if ($name === 'overriddenDefaults'
189189
&& (self::$phpcsVersion === '0' || \version_compare(self::$phpcsVersion, '3.99.99', '>'))

0 commit comments

Comments
 (0)