Skip to content

Commit

Permalink
Cleanup (#1349)
Browse files Browse the repository at this point in the history
Signed-off-by: Nathanael Esayeas <nathanael.esayeas@protonmail.com>
  • Loading branch information
ghostwriter committed Dec 10, 2023
2 parents ec11614 + 79bf01d commit 1a0f031
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 114 deletions.
42 changes: 21 additions & 21 deletions .editorconfig
@@ -1,21 +1,21 @@
# https://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab
# https://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab
10 changes: 6 additions & 4 deletions .gitattributes
@@ -1,14 +1,16 @@
* text=auto

/.github export-ignore
/docker export-ignore
/tests export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
/.github export-ignore
/.phive export-ignore
/docker export-ignore
/fixtures export-ignore
/tests export-ignore
Makefile export-ignore
codecov.yml export-ignore
ecs.php export-ignore
Makefile export-ignore
phpunit.xml.dist export-ignore
psalm-baseline.xml export-ignore
psalm.xml.dist export-ignore
20 changes: 7 additions & 13 deletions CONTRIBUTING.md
Expand Up @@ -6,17 +6,15 @@ We'd love you to help out with mockery and no contribution is too small.

## Reporting Bugs

Issues can be reported on the [issue
tracker](https://github.com/padraic/mockery/issues). Please try and report any
bugs with a minimal reproducible example, it will make things easier for other
Issues can be reported on the [issue tracker](https://github.com/mockery/mockery/issues).
Please try and report any bugs with a minimal reproducible example, it will make things easier for other
contributors and your problems will hopefully be resolved quickly.


## Requesting Features

We're always interested to hear about your ideas and you can request features by
creating a ticket in the [issue
tracker](https://github.com/padraic/mockery/issues). We can't always guarantee
creating a ticket in the [issue tracker](https://github.com/mockery/mockery/issues). We can't always guarantee
someone will jump on it straight away, but putting it out there to see if anyone
else is interested is a good idea.

Expand All @@ -33,24 +31,20 @@ and
[PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) coding standards,
but we'll probably merge any code that looks close enough.

* Fork the [repository](https://github.com/padraic/mockery) on GitHub
* Fork the [repository](https://github.com/mockery/mockery) on GitHub
* Add the code for your feature or bug
* Add some tests for your feature or bug
* Optionally, but preferably, write some documentation
* Optionally, update the CHANGELOG.md file with your feature or
[BC](http://en.wikipedia.org/wiki/Backward_compatibility) break
* Send a [Pull
Request](https://help.github.com/articles/creating-a-pull-request) to the
* Send a [Pull Request](https://help.github.com/articles/creating-a-pull-request) to the
correct target branch (see below)

If you have a big change or would like to discuss something, create an issue in
the [issue tracker](https://github.com/padraic/mockery/issues) or jump in to
\#mockery on freenode
the [issue tracker](https://github.com/mockery/mockery/issues) or jump in to \#mockery on freenode


Any code you contribute must be licensed under the [BSD 3-Clause
License](http://opensource.org/licenses/BSD-3-Clause).

Any code you contribute must be licensed under the [BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause).

## Target Branch

Expand Down
38 changes: 19 additions & 19 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 12 additions & 57 deletions fixtures/autoload.php
Expand Up @@ -2,62 +2,17 @@

declare(strict_types=1);

if (!function_exists('recursiveGlob')) {
function globRecursively($pattern)
{
$files = glob($pattern) ?: [];
foreach (glob(dirname($pattern) . '/*', GLOB_ONLYDIR | GLOB_NOSORT) ?: [] as $dir) {
$files = array_merge($files, globRecursively($dir . '/' . basename($pattern)));
}
return $files;
spl_autoload_register(static function (string $class): void {
$filePath = sprintf(
'%s%s%s.php',
__DIR__,
DIRECTORY_SEPARATOR,
str_replace('\\', DIRECTORY_SEPARATOR, $class)
);

if (!file_exists($filePath)) {
return;
}
}

// Autoload test fixtures for supported PHP versions (current and previous)

$phpVersions = [
'PHP83' => 80300,
'PHP82' => 80200,
'PHP81' => 80100,
'PHP80' => 80000,
'PHP74' => 70400,
'PHP73' => 70300,
'PHP72' => 70200,
];

$allVersions = implode('|', array_keys($phpVersions));

$currentSupportedVersion = implode('|', array_keys(array_filter($phpVersions, static function (int $version): bool {
return PHP_VERSION_ID >= $version;
})));

$allTestsAndFixtures = globRecursively(dirname(__DIR__) . '/fixtures/*.php');

$currentSupportedVersionTestsAndFixtures = array_filter(
$allTestsAndFixtures,
static function (string $filePath) use ($currentSupportedVersion): bool {
return preg_match('#' . $currentSupportedVersion . '#', $filePath) === 1;
}
);

$allPhpVersionTestsAndFixtures = array_filter(
$allTestsAndFixtures,
static function (string $filePath) use ($allVersions): bool {
return preg_match('#' . $allVersions . '#', $filePath) === 1;
}
);

$excludedPhpVersions = array_diff($allPhpVersionTestsAndFixtures, $currentSupportedVersionTestsAndFixtures);

$autoloadTestsAndFixtures = array_diff($allTestsAndFixtures, $excludedPhpVersions);

array_map(
static function (string $file): void {
if (!file_exists($file)) {
return;
}

require_once $file;
},
$autoloadTestsAndFixtures
);
require_once $filePath;
});

0 comments on commit 1a0f031

Please sign in to comment.