Skip to content
Snippets Groups Projects
Commit c81c45fc authored by David Prévot's avatar David Prévot
Browse files

New upstream version 4.0.2

parents 115f36ab 5647d654
Branches
Tags upstream/4.0.2
No related merge requests found
...@@ -25,7 +25,7 @@ jobs: ...@@ -25,7 +25,7 @@ jobs:
- name: Install PHP - name: Install PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: 8.1 php-version: 8.2
coverage: none coverage: none
- name: Run PHP-CS-Fixer - name: Run PHP-CS-Fixer
...@@ -43,7 +43,7 @@ jobs: ...@@ -43,7 +43,7 @@ jobs:
- name: Install PHP - name: Install PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: 8.1 php-version: 8.2
coverage: none coverage: none
- name: Install dependencies with Composer - name: Install dependencies with Composer
...@@ -75,13 +75,6 @@ jobs: ...@@ -75,13 +75,6 @@ jobs:
php-version: "${{ matrix.php-version }}" php-version: "${{ matrix.php-version }}"
coverage: "pcov" coverage: "pcov"
- name: "Cache dependencies installed with Composer"
uses: "actions/cache@v2"
with:
path: "~/.composer/cache"
key: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}"
restore-keys: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"
- name: "Install dependencies with Composer" - name: "Install dependencies with Composer"
run: "./tools/composer update --no-ansi --no-interaction --no-progress" run: "./tools/composer update --no-ansi --no-interaction --no-progress"
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive"> <phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^3.0" installed="3.14.3" location="./tools/php-cs-fixer" copy="true"/> <phar name="php-cs-fixer" version="^3.0" installed="3.16.0" location="./tools/php-cs-fixer" copy="true"/>
<phar name="psalm" version="^5.0" installed="5.6.0" location="./tools/psalm" copy="true"/> <phar name="psalm" version="^5.0" installed="5.11.0" location="./tools/psalm" copy="true"/>
<phar name="composer" version="^2.0.3" installed="2.5.2" location="./tools/composer" copy="true"/> <phar name="composer" version="^2.0.3" installed="2.5.5" location="./tools/composer" copy="true"/>
</phive> </phive>
...@@ -33,6 +33,7 @@ $config->setFinder($finder) ...@@ -33,6 +33,7 @@ $config->setFinder($finder)
'blank_line_before_statement' => [ 'blank_line_before_statement' => [
'statements' => [ 'statements' => [
'break', 'break',
'case',
'continue', 'continue',
'declare', 'declare',
'default', 'default',
...@@ -44,6 +45,7 @@ $config->setFinder($finder) ...@@ -44,6 +45,7 @@ $config->setFinder($finder)
'if', 'if',
'include', 'include',
'include_once', 'include_once',
'phpdoc',
'require', 'require',
'require_once', 'require_once',
'return', 'return',
...@@ -52,15 +54,13 @@ $config->setFinder($finder) ...@@ -52,15 +54,13 @@ $config->setFinder($finder)
'try', 'try',
'while', 'while',
'yield', 'yield',
'yield_from',
], ],
], ],
'braces' => [
'position_after_anonymous_constructs' => 'next',
],
'cast_spaces' => true, 'cast_spaces' => true,
'class_attributes_separation' => [ 'class_attributes_separation' => [
'elements' => [ 'elements' => [
'const' => 'one', 'const' => 'none',
'method' => 'one', 'method' => 'one',
'property' => 'only_if_meta' 'property' => 'only_if_meta'
] ]
...@@ -73,7 +73,14 @@ $config->setFinder($finder) ...@@ -73,7 +73,14 @@ $config->setFinder($finder)
'compact_nullable_typehint' => true, 'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'], 'concat_space' => ['spacing' => 'one'],
'constant_case' => true, 'constant_case' => true,
'control_structure_braces' => true,
'control_structure_continuation_position' => true,
'curly_braces_position' => [
'anonymous_functions_opening_brace' => 'next_line_unless_newline_at_signature_end',
'anonymous_classes_opening_brace' => 'next_line_unless_newline_at_signature_end',
],
'declare_equal_normalize' => ['space' => 'none'], 'declare_equal_normalize' => ['space' => 'none'],
'declare_parentheses' => true,
'declare_strict_types' => true, 'declare_strict_types' => true,
'dir_constant' => true, 'dir_constant' => true,
'echo_tag_syntax' => true, 'echo_tag_syntax' => true,
...@@ -147,6 +154,7 @@ $config->setFinder($finder) ...@@ -147,6 +154,7 @@ $config->setFinder($finder)
'no_leading_import_slash' => true, 'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true, 'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => ['use' => 'print'], 'no_mixed_echo_print' => ['use' => 'print'],
'no_multiple_statements_per_line' => true,
'no_multiline_whitespace_around_double_arrow' => true, 'no_multiline_whitespace_around_double_arrow' => true,
'no_null_property_initialization' => true, 'no_null_property_initialization' => true,
'no_php4_constructor' => true, 'no_php4_constructor' => true,
...@@ -272,11 +280,12 @@ $config->setFinder($finder) ...@@ -272,11 +280,12 @@ $config->setFinder($finder)
'single_import_per_statement' => true, 'single_import_per_statement' => true,
'single_line_after_imports' => true, 'single_line_after_imports' => true,
'single_quote' => true, 'single_quote' => true,
'single_space_after_construct' => true, 'single_space_around_construct' => true,
'single_trait_insert_per_statement' => true, 'single_trait_insert_per_statement' => true,
'space_after_semicolon' => true, 'space_after_semicolon' => true,
'standardize_increment' => true, 'standardize_increment' => true,
'standardize_not_equals' => true, 'standardize_not_equals' => true,
'statement_indentation' => true,
'static_lambda' => true, 'static_lambda' => true,
'strict_param' => true, 'strict_param' => true,
'string_line_ending' => true, 'string_line_ending' => true,
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
resolveFromConfigFile="false" resolveFromConfigFile="false"
errorBaseline=".psalm/baseline.xml" errorBaseline=".psalm/baseline.xml"
findUnusedBaselineEntry="true" findUnusedBaselineEntry="true"
findUnusedCode="false"
> >
<projectFiles> <projectFiles>
<directory name="src" /> <directory name="src" />
......
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
## [4.0.2] - 2023-05-07
### Fixed
* [#80](https://github.com/sebastianbergmann/php-file-iterator/pull/80): Ignore unresolvable symbolic link
## [4.0.1] - 2023-02-10 ## [4.0.1] - 2023-02-10
### Fixed ### Fixed
...@@ -138,6 +144,7 @@ No changes ...@@ -138,6 +144,7 @@ No changes
* [#23](https://github.com/sebastianbergmann/php-file-iterator/pull/23): Added support for wildcards (glob) in exclude * [#23](https://github.com/sebastianbergmann/php-file-iterator/pull/23): Added support for wildcards (glob) in exclude
[4.0.2]: https://github.com/sebastianbergmann/php-file-iterator/compare/4.0.1...4.0.2
[4.0.1]: https://github.com/sebastianbergmann/php-file-iterator/compare/4.0.0...4.0.1 [4.0.1]: https://github.com/sebastianbergmann/php-file-iterator/compare/4.0.0...4.0.1
[4.0.0]: https://github.com/sebastianbergmann/php-file-iterator/compare/3.0.6...4.0.0 [4.0.0]: https://github.com/sebastianbergmann/php-file-iterator/compare/3.0.6...4.0.0
[3.0.6]: https://github.com/sebastianbergmann/php-file-iterator/compare/3.0.5...3.0.6 [3.0.6]: https://github.com/sebastianbergmann/php-file-iterator/compare/3.0.5...3.0.6
......
...@@ -4,7 +4,7 @@ If you believe you have found a security vulnerability in the library that is de ...@@ -4,7 +4,7 @@ If you believe you have found a security vulnerability in the library that is de
**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.** **Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.**
Instead, please send an email to `sebastian@phpunit.de`. Instead, please email `sebastian@phpunit.de`.
Please include as much of the information listed below as you can to help us better understand and resolve the issue: Please include as much of the information listed below as you can to help us better understand and resolve the issue:
...@@ -22,9 +22,9 @@ This information will help us triage your report more quickly. ...@@ -22,9 +22,9 @@ This information will help us triage your report more quickly.
The library that is developed in this repository was either extracted from [PHPUnit](https://github.com/sebastianbergmann/phpunit) or developed specifically as a dependency for PHPUnit. The library that is developed in this repository was either extracted from [PHPUnit](https://github.com/sebastianbergmann/phpunit) or developed specifically as a dependency for PHPUnit.
The library is developed with a focus on development environments and the command-line. No specific testing or hardening with regard to using the library in a HTTP or web context or with untrusted input data is performed. The library might also contain functionality that intentionally exposes internal application data for debugging purposes. The library is developed with a focus on development environments and the command-line. No specific testing or hardening with regard to using the library in an HTTP or web context or with untrusted input data is performed. The library might also contain functionality that intentionally exposes internal application data for debugging purposes.
If the library is used in a web application, the application developer is responsible for filtering inputs or escaping outputs as necessary and for verifying that the used functionality is safe for use within the intended context. If the library is used in a web application, the application developer is responsible for filtering inputs or escaping outputs as necessary and for verifying that the used functionality is safe for use within the intended context.
Vulnerabilities specific to the use outside of a development context will be fixed as applicable, provided that the fix does not have an averse effect on the primary use case for development purposes. Vulnerabilities specific to the use outside a development context will be fixed as applicable, provided that the fix does not have an averse effect on the primary use case for development purposes.
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
} }
], ],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/php-file-iterator/issues" "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
"security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy"
}, },
"config": { "config": {
"platform": { "platform": {
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php" bootstrap="vendor/autoload.php"
executionOrder="depends,defects" executionOrder="depends,defects"
requireCoverageMetadata="true" requireCoverageMetadata="true"
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
</testsuite> </testsuite>
</testsuites> </testsuites>
<coverage> <source>
<include> <include>
<directory suffix=".php">src</directory> <directory>src</directory>
</include> </include>
</coverage> </source>
</phpunit> </phpunit>
...@@ -43,6 +43,10 @@ final class ExcludeIterator extends RecursiveFilterIterator ...@@ -43,6 +43,10 @@ final class ExcludeIterator extends RecursiveFilterIterator
$path = $current->getRealPath(); $path = $current->getRealPath();
if ($path === false) {
return false;
}
foreach ($this->exclude as $exclude) { foreach ($this->exclude as $exclude) {
if (str_starts_with($path, $exclude)) { if (str_starts_with($path, $exclude)) {
return false; return false;
......
...@@ -27,7 +27,6 @@ use SplFileInfo; ...@@ -27,7 +27,6 @@ use SplFileInfo;
final class Iterator extends FilterIterator final class Iterator extends FilterIterator
{ {
public const PREFIX = 0; public const PREFIX = 0;
public const SUFFIX = 1; public const SUFFIX = 1;
private string|false $basePath; private string|false $basePath;
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
namespace SebastianBergmann\FileIterator; namespace SebastianBergmann\FileIterator;
use function realpath; use function realpath;
use function symlink;
use function unlink;
use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Small; use PHPUnit\Framework\Attributes\Small;
...@@ -24,7 +26,7 @@ final class FacadeTest extends TestCase ...@@ -24,7 +26,7 @@ final class FacadeTest extends TestCase
{ {
public static function provider(): array public static function provider(): array
{ {
$fixtureDirectoryRealpath = realpath(__DIR__ . '/../fixture'); $fixtureDirectoryRealpath = self::fixtureDirectoryRealpath();
return [ return [
'filter prefix: no, filter suffix: no, excludes: none' => [ 'filter prefix: no, filter suffix: no, excludes: none' => [
...@@ -119,6 +121,21 @@ final class FacadeTest extends TestCase ...@@ -119,6 +121,21 @@ final class FacadeTest extends TestCase
]; ];
} }
protected function setUp(): void
{
$fixtureDirectoryRealpath = self::fixtureDirectoryRealpath();
symlink(
$fixtureDirectoryRealpath . '/a/DoesNotExist.php',
$fixtureDirectoryRealpath . '/a/DoesNotExist.php',
);
}
protected function tearDown(): void
{
unlink(self::fixtureDirectoryRealpath() . '/a/DoesNotExist.php');
}
#[DataProvider('provider')] #[DataProvider('provider')]
public function testSomething(array $expected, array|string $paths, array|string $suffixes, array|string $prefixes, array $exclude): void public function testSomething(array $expected, array|string $paths, array|string $suffixes, array|string $prefixes, array $exclude): void
{ {
...@@ -127,4 +144,9 @@ final class FacadeTest extends TestCase ...@@ -127,4 +144,9 @@ final class FacadeTest extends TestCase
(new Facade)->getFilesAsArray($paths, $suffixes, $prefixes, $exclude) (new Facade)->getFilesAsArray($paths, $suffixes, $prefixes, $exclude)
); );
} }
private static function fixtureDirectoryRealpath(): string|false
{
return realpath(__DIR__ . '/../fixture');
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment