-
Notifications
You must be signed in to change notification settings - Fork 90
Add PHP 8.5 support #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vedavith
wants to merge
51
commits into
php-lock:master
Choose a base branch
from
vedavith:patch-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
b28ae9a
Update composer.json
vedavith 8aab350
Update test-unit.yml
vedavith 4a4329a
test_workflow.yml
vedavith 01af359
Update workflow.yml
vedavith dabbcb1
Create workflow.yml
vedavith 6c169e2
Updated composer.json to support php8.5
vedavith 71df896
Update composer.json to support 8.5
vedavith 55d5b2e
Update composer.json
vedavith 0263dcf
Update workflow.yml
vedavith 23a35ab
Delete .github/workflows/workflow.yml
vedavith b37e49c
Update test-unit.yml
vedavith c9a2cbc
Update composer.json
vedavith 23c345d
Update composer.json - php85
vedavith 044a97b
Update composer.json
vedavith 09f2573
Update composer.json - eloquent/liberator
vedavith fcb17df
Update composer.json
vedavith c1845a1
Update composer.json - Backward compatibility
vedavith 75a7671
Merge branch 'master' into patch-1
vedavith 49452c6
Prevent INF/NAN from being passed to acquireMutex
vedavith 2f5653f
Updated composer - eloquent
vedavith 355875c
Updated files:
vedavith 6337b31
Refactor formatTimeout to simplify NaN and infinite value handling
vedavith ff26db6
Refactor tests to remove dependency on Eloquent Liberator and introdu…
vedavith 3a3bed1
Refactor TestAccess class to remove static methods and streamline pro…
vedavith daebb8a
Add namespace declaration to TestAccess class
vedavith 070f2d5
Refactor tests to use instance of TestAccess for property access
vedavith 6a0e20e
Refactor TestAccess class for improved readability and consistency
vedavith ef9cd52
Remove version constraint for spatie/async in composer.json
vedavith 4a00e6a
Update phpunit version constraint in composer.json to support newer v…
vedavith 3783124
Update PHP version constraints in composer.json and test-unit.yml to …
vedavith f9ab21a
Enhance formatTimeout to handle NaN and infinities
vedavith 05ff89c
Refactored TestAccess
vedavith 0ce53d3
Merge branch 'patch-1' of github.com:vedavith/lock into patch-1
vedavith cc35223
Updated TestAccess class
vedavith 5b51cd6
Updated TestAccess.php
vedavith 9909553
Calling PopsValue from TestAccess
vedavith dd99643
Refactor MutexConcurrencyTest to simplify TestAccess usage and enhanc…
vedavith 09c825d
Refactor MutexConcurrencyTest: Remove unused imports, adjust type ann…
vedavith 5ba7f99
Refactor FlockMutexTest: Update TestAccess usage for setting private …
vedavith 5cdaa00
Refactor FlockMutexTest: Simplify TestAccess usage and adjust annotat…
vedavith 8572d2f
Refactor tests: Replace `IsType::TYPE_*` constants with strings and r…
vedavith e4430e1
Refactor tests: Use `NativeType` constants in `IsType` assertions for…
vedavith 7309015
Update test workflow: Add PHP 8.4 to matrix
vedavith 7dca492
Refactor MutexConcurrencyTest: Simplify TestAccess usage, remove redu…
vedavith e46fc81
Refactor tests: Replace `IsType` usage with `TestAccess::phpunitIsTyp…
vedavith e232bc3
Refactor tests: Clean up imports, adjust annotations, and simplify `T…
vedavith f3ad4b0
Add cweagans/composer-patches for patch management and configure spat…
vedavith de2d80e
Add cweagans/composer-patches for patch management and configure spat…
vedavith cc642bb
Merge remote-tracking branch 'origin/patch-1' into patch-1
vedavith 0e8dfae
Add cweagans/composer-patches for patch management and configure spat…
vedavith 73ad986
Add cweagans/composer-patches for patch management and configure spat…
vedavith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| diff --git a/src/Pool.php b/src/Pool.php | ||
| index 3ed9c41..4d1f7c8 100644 | ||
| --- a/src/Pool.php | ||
| +++ b/src/Pool.php | ||
| @@ -248,7 +248,7 @@ class Pool implements ArrayAccess, IteratorAggregate | ||
| $this->failed[$process->getPid()] = $process; | ||
| } | ||
|
|
||
| - public function offsetExists($offset): bool | ||
| + public function offsetExists(mixed $offset): bool | ||
| { | ||
| // TODO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
|
|
||
| namespace Malkusch\Lock\Tests\Mutex; | ||
|
|
||
| use Eloquent\Liberator\Liberator; | ||
| require_once __DIR__ . '/../TestAccess.php'; | ||
| use Malkusch\Lock\Mutex\DistributedMutex; | ||
| use Malkusch\Lock\Mutex\FlockMutex; | ||
| use Malkusch\Lock\Mutex\MemcachedMutex; | ||
|
|
@@ -13,9 +13,9 @@ | |
| use Malkusch\Lock\Mutex\PostgreSQLMutex; | ||
| use Malkusch\Lock\Mutex\RedisMutex; | ||
| use Malkusch\Lock\Mutex\SemaphoreMutex; | ||
| use Malkusch\Lock\Tests\TestAccess; | ||
| use Malkusch\Lock\Util\LockUtil; | ||
| use PHPUnit\Framework\Attributes\DataProvider; | ||
| use PHPUnit\Framework\Constraint\IsType; | ||
| use PHPUnit\Framework\TestCase; | ||
| use Predis\Client as PredisClient; | ||
| use Spatie\Async\Pool; | ||
|
|
@@ -66,8 +66,6 @@ private function fork(int $concurrency, \Closure $code): void | |
| * @param \Closure(0|1): int $code The counter code | ||
| * @param \Closure(float): Mutex $mutexFactory | ||
| * @param \Closure(): void $setUp | ||
| * | ||
| * @dataProvider provideHighContentionCases | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need to keep these annotations for PHP 7.4... |
||
| */ | ||
| #[DataProvider('provideHighContentionCases')] | ||
| public function testHighContention(\Closure $code, \Closure $mutexFactory, ?\Closure $setUp = null): void | ||
|
|
@@ -124,8 +122,6 @@ static function () use ($filename) { | |
| * Tests that five processes run sequentially. | ||
| * | ||
| * @param \Closure(float): Mutex $mutexFactory | ||
| * | ||
| * @dataProvider provideExecutionIsSerializedWhenLockedCases | ||
| */ | ||
| #[DataProvider('provideExecutionIsSerializedWhenLockedCases')] | ||
| public function testExecutionIsSerializedWhenLocked(\Closure $mutexFactory): void | ||
|
|
@@ -163,19 +159,19 @@ public static function provideExecutionIsSerializedWhenLockedCases(): iterable | |
| if (extension_loaded('pcntl')) { | ||
| yield 'flockWithTimoutPcntl' => [static function ($timeout) use ($filename) { | ||
| $file = fopen($filename, 'w'); | ||
| $lock = Liberator::liberate(new FlockMutex($file, $timeout)); | ||
| $lock->strategy = \Closure::bind(static fn () => FlockMutex::STRATEGY_PCNTL, null, FlockMutex::class)(); // @phpstan-ignore property.notFound | ||
| $lock = new FlockMutex($file, $timeout); | ||
| (new TestAccess($lock))->setProperty('strategy', \Closure::bind(static fn () => FlockMutex::STRATEGY_PCNTL, null, FlockMutex::class)()); | ||
|
|
||
| return $lock->popsValue(); | ||
| return (new TestAccess($lock))->popsValue(); | ||
| }]; | ||
| } | ||
|
|
||
| yield 'flockWithTimoutLoop' => [static function ($timeout) use ($filename) { | ||
| $file = fopen($filename, 'w'); | ||
| $lock = Liberator::liberate(new FlockMutex($file, $timeout)); | ||
| $lock->strategy = \Closure::bind(static fn () => FlockMutex::STRATEGY_LOOP, null, FlockMutex::class)(); // @phpstan-ignore property.notFound | ||
| $lock = new FlockMutex($file, $timeout); | ||
| (new TestAccess($lock))->setProperty('strategy', \Closure::bind(static fn () => FlockMutex::STRATEGY_LOOP, null, FlockMutex::class)()); | ||
|
|
||
| return $lock->popsValue(); | ||
| return (new TestAccess($lock))->popsValue(); | ||
| }]; | ||
|
|
||
| if (extension_loaded('sysvsem')) { | ||
|
|
@@ -185,7 +181,7 @@ public static function provideExecutionIsSerializedWhenLockedCases(): iterable | |
| $semaphore, | ||
| self::logicalOr( | ||
| self::isInstanceOf(\SysvSemaphore::class), | ||
| new IsType(IsType::TYPE_RESOURCE) | ||
| TestAccess::phpunitIsType('resource') | ||
| ) | ||
| ); | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this change. Please send it as an extra PR.
Then this PR for PHP 8.5 would be hugely simplified and much more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please help me with a method
popsValuethis is not defined anywhere. Calling this method is failing the testcases. @mvorisekThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See https://github.com/search?q=repo%3Aeloquent%2Fpops%20popsvalue&type=code , it is part of
eloquent/popspackage.