Skip to content

Commit

Permalink
Add PHP 8.4 tests support
Browse files Browse the repository at this point in the history
  • Loading branch information
SerafimArts committed Jul 28, 2024
1 parent b600b85 commit ae6db76
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
stability: [ prefer-lowest, prefer-stable ]
steps:
Expand Down
21 changes: 9 additions & 12 deletions src/ReadableInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,18 @@ interface ReadableInterface
/**
* Returns the resource stream of the source.
*
* @return resource Returns the streaming contents of a file.
*
* @throws SourceExceptionInterface May occur during the inability to
* open or some operations with the resource stream.
* @return resource returns the streaming contents of a file
* @throws SourceExceptionInterface may occur during the inability to
* open or some operations with the resource stream
*/
public function getStream();

/**
* Returns the contents of the source.
*
* @return string Returns the string contents of a file.
*
* @throws SourceExceptionInterface May occur when it is not possible to
* read source's data and/or convert it to a string.
* @return string returns the string contents of a file
* @throws SourceExceptionInterface may occur when it is not possible to
* read source's data and/or convert it to a string
*/
public function getContents(): string;

Expand All @@ -32,10 +30,9 @@ public function getContents(): string;
* If the value of the source content changes, the hash value will
* also be changed.
*
* @return non-empty-string Returns hash of a file.
*
* @throws SourceExceptionInterface May occur when it is not possible to
* convert object state information into a hash.
* @return non-empty-string returns hash of a file
* @throws SourceExceptionInterface may occur when it is not possible to
* convert object state information into a hash
*/
public function getHash(): string;
}
8 changes: 4 additions & 4 deletions src/SourceFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
interface SourceFactoryInterface
{
/**
* @param mixed $source Arbitrary source reference from which you can
* create a {@see ReadableInterface} instance.
* @param mixed $source arbitrary source reference from which you can
* create a {@see ReadableInterface} instance
*
* @throws SourceExceptionInterface In case of an error in creating the
* source object.
* @throws SourceExceptionInterface in case of an error in creating the
* source object
*/
public function create($source): ReadableInterface;
}
22 changes: 18 additions & 4 deletions tests/CompatibilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public function testFileCompatibility(): void
public function getPathname(): string {}

public function getStream() {}

public function getContents(): string {}

public function getHash(): string {}
};
}
Expand All @@ -39,7 +41,9 @@ public function testFileWithMixedCompatibility(): void
public function getPathname(): string {}

public function getStream(): mixed {}

public function getContents(): string {}

public function getHash(): string {}
};
}
Expand All @@ -50,7 +54,9 @@ public function testReadableCompatibility(): void

new class () implements ReadableInterface {
public function getStream() {}

public function getContents(): string {}

public function getHash(): string {}
};
}
Expand All @@ -64,7 +70,9 @@ public function testReadableWithMixedCompatibility(): void

new class () implements ReadableInterface {
public function getStream(): mixed {}

public function getContents(): string {}

public function getHash(): string {}
};
}
Expand All @@ -82,9 +90,12 @@ public function testSourceFactoryCompatibility(): void

new class () implements SourceFactoryInterface {
public function create($source): ReadableInterface {}
public function createFromString(string $content = '', string $name = null): ReadableInterface {}

public function createFromString(string $content = '', ?string $name = null): ReadableInterface {}

public function createFromFile(string $filename): FileInterface {}
public function createFromStream($stream, string $name = null): ReadableInterface {}

public function createFromStream($stream, ?string $name = null): ReadableInterface {}
};
}

Expand All @@ -97,9 +108,12 @@ public function testSourceFactoryWithMixedCompatibility(): void

new class () implements SourceFactoryInterface {
public function create(mixed $source): ReadableInterface {}
public function createFromString(string $content = '', string $name = null): ReadableInterface {}

public function createFromString(string $content = '', ?string $name = null): ReadableInterface {}

public function createFromFile(string $filename): FileInterface {}
public function createFromStream(mixed $stream, string $name = null): ReadableInterface {}

public function createFromStream(mixed $stream, ?string $name = null): ReadableInterface {}
};
}
}

0 comments on commit ae6db76

Please sign in to comment.