Skip to content

Commit

Permalink
Use diff patching for Faker
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbalandan committed Oct 26, 2022
1 parent 33ea56b commit 97f9d85
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/patches/Base.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/vendor/fakerphp/faker/src/Faker/Provider/Base.php b/vendor/fakerphp/faker/src/Faker/Provider/Base.php
index 4ff4492..a6b69c4 100644
--- a/vendor/fakerphp/faker/src/Faker/Provider/Base.php
+++ b/vendor/fakerphp/faker/src/Faker/Provider/Base.php
@@ -369,6 +369,14 @@ class Base
return $string;
}

+ if (strpos($callback, '::') !== false) {
+ $parts = explode('::', $callback, 2);
+
+ if (strtolower($parts[0]) === 'static') {
+ $callback = static::class . '::' . $parts[1];
+ }
+ }
+
for ($i = $pos, $last = strrpos($string, $wildcard, $pos) + 1; $i < $last; ++$i) {
if ($string[$i] === $wildcard) {
$string[$i] = call_user_func($callback);
4 changes: 4 additions & 0 deletions .github/workflows/test-phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ jobs:
composer update --ansi --no-interaction ${{ matrix.composer-option }}
composer remove --ansi --dev --unused ${{ matrix.composer-option }} -W -- rector/rector phpstan/phpstan friendsofphp/php-cs-fixer nexusphp/cs-config codeigniter/coding-standard
- name: Apply patch to Faker
if: matrix.php-versions == '8.2'
run: git apply --verbose .github/patches/Base.patch

- name: Profile slow tests in PHP ${{ env.COVERAGE_PHP_VERSION }}
if: matrix.php-versions == env.COVERAGE_PHP_VERSION
run: echo "TACHYCARDIA_MONITOR_GA=enabled" >> $GITHUB_ENV
Expand Down

0 comments on commit 97f9d85

Please sign in to comment.