Skip to content

Commit 226b7df

Browse files
committed
fix(Hooks): Don't use offset null as it's deprecated (and not actually used)
Signed-off-by: Joas Schilling <[email protected]>
1 parent c27db5f commit 226b7df

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

tests/lib/Files/ViewTest.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,13 +1811,13 @@ public static function basicOperationProviderForLocks(): array {
18111811
['touch', ['test.txt'], 'test.txt', 'touch', null, null, null],
18121812

18131813
// ---- no hooks, no locks ---
1814-
['is_dir', ['dir'], 'dir', null],
1815-
['is_file', ['dir'], 'dir', null],
1814+
['is_dir', ['dir'], 'dir', ''],
1815+
['is_file', ['dir'], 'dir', ''],
18161816
[
18171817
'stat',
18181818
['dir'],
18191819
'dir',
1820-
null,
1820+
'',
18211821
ILockingProvider::LOCK_SHARED,
18221822
ILockingProvider::LOCK_SHARED,
18231823
ILockingProvider::LOCK_SHARED,
@@ -1828,7 +1828,7 @@ public static function basicOperationProviderForLocks(): array {
18281828
'filetype',
18291829
['dir'],
18301830
'dir',
1831-
null,
1831+
'',
18321832
ILockingProvider::LOCK_SHARED,
18331833
ILockingProvider::LOCK_SHARED,
18341834
ILockingProvider::LOCK_SHARED,
@@ -1839,25 +1839,25 @@ public static function basicOperationProviderForLocks(): array {
18391839
'filesize',
18401840
['dir'],
18411841
'dir',
1842-
null,
1842+
'',
18431843
ILockingProvider::LOCK_SHARED,
18441844
ILockingProvider::LOCK_SHARED,
18451845
ILockingProvider::LOCK_SHARED,
18461846
null,
18471847
/* Return an int */
18481848
100
18491849
],
1850-
['isCreatable', ['dir'], 'dir', null],
1851-
['isReadable', ['dir'], 'dir', null],
1852-
['isUpdatable', ['dir'], 'dir', null],
1853-
['isDeletable', ['dir'], 'dir', null],
1854-
['isSharable', ['dir'], 'dir', null],
1855-
['file_exists', ['dir'], 'dir', null],
1850+
['isCreatable', ['dir'], 'dir', ''],
1851+
['isReadable', ['dir'], 'dir', ''],
1852+
['isUpdatable', ['dir'], 'dir', ''],
1853+
['isDeletable', ['dir'], 'dir', ''],
1854+
['isSharable', ['dir'], 'dir', ''],
1855+
['file_exists', ['dir'], 'dir', ''],
18561856
[
18571857
'filemtime',
18581858
['dir'],
18591859
'dir',
1860-
null,
1860+
'',
18611861
ILockingProvider::LOCK_SHARED,
18621862
ILockingProvider::LOCK_SHARED,
18631863
ILockingProvider::LOCK_SHARED,
@@ -1875,23 +1875,23 @@ public static function basicOperationProviderForLocks(): array {
18751875
* @param array $operationArgs arguments for the operation
18761876
* @param string $lockedPath path of the locked item to check
18771877
* @param string $hookType hook type
1878-
* @param int $expectedLockBefore expected lock during pre hooks
1879-
* @param int $expectedLockDuring expected lock during operation
1880-
* @param int $expectedLockAfter expected lock during post hooks
1881-
* @param int $expectedStrayLock expected lock after returning, should
1882-
* be null (unlock) for most operations
1878+
* @param ?int $expectedLockBefore expected lock during pre hooks
1879+
* @param ?int $expectedLockDuring expected lock during operation
1880+
* @param ?int $expectedLockAfter expected lock during post hooks
1881+
* @param ?int $expectedStrayLock expected lock after returning, should
1882+
* be null (unlock) for most operations
18831883
*/
18841884
#[\PHPUnit\Framework\Attributes\DataProvider('basicOperationProviderForLocks')]
18851885
public function testLockBasicOperation(
1886-
$operation,
1887-
$operationArgs,
1888-
$lockedPath,
1889-
$hookType,
1890-
$expectedLockBefore = ILockingProvider::LOCK_SHARED,
1891-
$expectedLockDuring = ILockingProvider::LOCK_SHARED,
1892-
$expectedLockAfter = ILockingProvider::LOCK_SHARED,
1893-
$expectedStrayLock = null,
1894-
$returnValue = true,
1886+
string $operation,
1887+
array $operationArgs,
1888+
string $lockedPath,
1889+
string $hookType,
1890+
?int $expectedLockBefore = ILockingProvider::LOCK_SHARED,
1891+
?int $expectedLockDuring = ILockingProvider::LOCK_SHARED,
1892+
?int $expectedLockAfter = ILockingProvider::LOCK_SHARED,
1893+
?int $expectedStrayLock = null,
1894+
mixed $returnValue = true,
18951895
): void {
18961896
$view = new View('/' . $this->user . '/files/');
18971897

@@ -1931,7 +1931,7 @@ function () use ($view, $lockedPath, &$lockTypeDuring, $returnValue) {
19311931
// do operation
19321932
call_user_func_array([$view, $operation], $operationArgs);
19331933

1934-
if ($hookType !== null) {
1934+
if ($hookType !== '') {
19351935
$this->assertEquals($expectedLockBefore, $lockTypePre, 'File locked properly during pre-hook');
19361936
$this->assertEquals($expectedLockAfter, $lockTypePost, 'File locked properly during post-hook');
19371937
$this->assertEquals($expectedLockDuring, $lockTypeDuring, 'File locked properly during operation');
@@ -2530,7 +2530,7 @@ function () use ($view, $path, $onMountPoint, &$lockTypePost): void {
25302530
}
25312531
);
25322532

2533-
if ($hookType !== null) {
2533+
if ($hookType !== '') {
25342534
Util::connectHook(
25352535
Filesystem::CLASSNAME,
25362536
$hookType,

0 commit comments

Comments
 (0)