add PHP 7.4

This commit is contained in:
madflow 2019-12-03 15:39:12 +01:00 committed by Adrien Loison
parent 7964dadc21
commit f54f7a400c
2 changed files with 11 additions and 4 deletions

View File

@ -1,4 +1,4 @@
dist: trusty dist: bionic
sudo: false sudo: false
language: php language: php
@ -13,6 +13,9 @@ matrix:
env: WITH_PHPUNIT=true env: WITH_PHPUNIT=true
- php: 7.3 - php: 7.3
env: WITH_PHPUNIT=true env: WITH_PHPUNIT=true
- php: 7.4
env: WITH_PHPUNIT=true
cache: cache:
directories: directories:

View File

@ -17,7 +17,7 @@ class FileSystemHelper implements FileSystemHelperInterface
/** /**
* @param string $baseFolderPath The path of the base folder where all the I/O can occur * @param string $baseFolderPath The path of the base folder where all the I/O can occur
*/ */
public function __construct($baseFolderPath) public function __construct(string $baseFolderPath)
{ {
$this->baseFolderRealPath = \realpath($baseFolderPath); $this->baseFolderRealPath = \realpath($baseFolderPath);
} }
@ -117,12 +117,16 @@ class FileSystemHelper implements FileSystemHelperInterface
* should occur is not inside the base folder. * should occur is not inside the base folder.
* *
* @param string $operationFolderPath The path of the folder where the I/O operation should occur * @param string $operationFolderPath The path of the folder where the I/O operation should occur
* @throws \Box\Spout\Common\Exception\IOException If the folder where the I/O operation should occur is not inside the base folder * @throws \Box\Spout\Common\Exception\IOException If the folder where the I/O operation should occur
* is not inside the base folder or the base folder does not exist
* @return void * @return void
*/ */
protected function throwIfOperationNotInBaseFolder($operationFolderPath) protected function throwIfOperationNotInBaseFolder(string $operationFolderPath)
{ {
$operationFolderRealPath = \realpath($operationFolderPath); $operationFolderRealPath = \realpath($operationFolderPath);
if (!$this->baseFolderRealPath) {
throw new IOException("The base folder path is invalid: {$this->baseFolderRealPath}");
}
$isInBaseFolder = (\strpos($operationFolderRealPath, $this->baseFolderRealPath) === 0); $isInBaseFolder = (\strpos($operationFolderRealPath, $this->baseFolderRealPath) === 0);
if (!$isInBaseFolder) { if (!$isInBaseFolder) {
throw new IOException("Cannot perform I/O operation outside of the base folder: {$this->baseFolderRealPath}"); throw new IOException("Cannot perform I/O operation outside of the base folder: {$this->baseFolderRealPath}");