Skip to content

Commit

Permalink
Prep 0.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
belgattitude committed Jan 5, 2019
1 parent 6e120b3 commit 2a69c86
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 21 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 0.8.7 (2019-01-05)

### Fixed

- Minor fix: `ConverterAdapterInterface` allowed `null` input file.

### Changed

- Minor phpdoc typehints tuning

### Q&A

- Added psalm to Q&A checks

## 0.8.6 (2018-12-27)

### Improvement
Expand Down
6 changes: 4 additions & 2 deletions src/Video/Adapter/FFMpegAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,14 @@ public function getMappedConversionParams(VideoConvertParamsInterface $conversio
*/
public function getCliCommand(array $arguments, string $inputFile, $outputFile = null, array $prependArguments = []): array
{
$outputArg = '';
$outputArg = null;
if ($outputFile instanceof UnescapedFileInterface) {
$outputArg = $outputFile->getFile();
} elseif (is_string($outputFile)) {
$outputArg = $outputFile;
} elseif ($outputFile !== null) {
}

if ($outputArg === null) {
throw new InvalidArgumentException(sprintf(
'Output file must be either a non empty string, null or PlatformNullFile (type %s)',
gettype($outputFile)
Expand Down
2 changes: 1 addition & 1 deletion src/Video/Config/FFMpegConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class FFMpegConfig implements FFMpegConfigInterface
/** @var int|null */
protected $threads;

/** @var FFMpegAdapter */
/** @var FFMpegAdapter|null */
protected $ffmpegAdapter;

/** @var ProcessParams */
Expand Down
6 changes: 2 additions & 4 deletions src/Video/Config/FFMpegConfigFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

namespace Soluble\MediaTools\Video\Config;

use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Soluble\MediaTools\Common\Config\SafeConfigReader;
use Soluble\MediaTools\Common\Exception\InvalidConfigException;

Expand Down Expand Up @@ -36,7 +34,7 @@ public function __invoke(ContainerInterface $container): FFMpegConfigInterface
{
try {
$containerConfig = $container->get($this->entryName);
} catch (NotFoundExceptionInterface | ContainerExceptionInterface $e) {
} catch (\Throwable $e) {
throw new InvalidConfigException(
sprintf('Cannot resolve container entry \'%s\' ($entryName).', $this->entryName)
);
Expand All @@ -50,7 +48,7 @@ public function __invoke(ContainerInterface $container): FFMpegConfigInterface
);
}

$scr = new SafeConfigReader($config, $this->configKey ?? '');
$scr = new SafeConfigReader($config, $this->configKey ?: '');

return new FFMpegConfig(
$scr->getNullableString('ffmpeg.binary', null),
Expand Down
6 changes: 2 additions & 4 deletions src/Video/Config/FFProbeConfigFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

namespace Soluble\MediaTools\Video\Config;

use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Soluble\MediaTools\Common\Config\SafeConfigReader;
use Soluble\MediaTools\Common\Exception\InvalidConfigException;

Expand Down Expand Up @@ -36,7 +34,7 @@ public function __invoke(ContainerInterface $container): FFProbeConfigInterface
{
try {
$containerConfig = $container->get($this->entryName);
} catch (NotFoundExceptionInterface | ContainerExceptionInterface $e) {
} catch (\Throwable $e) {
throw new InvalidConfigException(
sprintf('Cannot resolve container entry \'%s\' ($entryName).', $this->entryName)
);
Expand All @@ -50,7 +48,7 @@ public function __invoke(ContainerInterface $container): FFProbeConfigInterface
);
}

$scr = new SafeConfigReader($config, $this->configKey ?? '');
$scr = new SafeConfigReader($config, $this->configKey ?: '');

return new FFProbeConfig(
$scr->getNullableString('ffprobe.binary', null),
Expand Down
2 changes: 1 addition & 1 deletion src/Video/Filter/SelectFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function getFFmpegCLIValue(): string
{
return sprintf(
'select=%s',
str_replace('"', '\"', $this->expression ?? '')
str_replace('"', '\"', $this->expression ?: '')
);
}
}
2 changes: 1 addition & 1 deletion src/Video/VideoAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class VideoAnalyzer implements VideoAnalyzerInterface
/** @var FFMpegConfigInterface */
protected $ffmpegConfig;

/** @var LoggerInterface|NullLogger */
/** @var LoggerInterface */
protected $logger;

public function __construct(FFMpegConfigInterface $ffmpegConfig, ?LoggerInterface $logger = null)
Expand Down
6 changes: 4 additions & 2 deletions src/Video/VideoConvertParamsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
namespace Soluble\MediaTools\Video;

use Soluble\MediaTools\Common\Service\ActionParamInterface;
use Soluble\MediaTools\Video\Adapter\FFMpegCLIValueInterface;
use Soluble\MediaTools\Video\Exception\InvalidArgumentException;
use Soluble\MediaTools\Video\Exception\UnsetParamException;
use Soluble\MediaTools\Video\Filter\Type\VideoFilterInterface;

interface VideoConvertParamsInterface extends ActionParamInterface
{
Expand Down Expand Up @@ -87,8 +89,8 @@ interface VideoConvertParamsInterface extends ActionParamInterface
/**
* Set a built-in param...
*
* @param string $paramName a param that must exist in builtInParams
* @param mixed $paramValue
* @param string $paramName a param that must exist in builtInParams
* @param bool|string|int|VideoFilterInterface|FFMpegCLIValueInterface $paramValue
*
* @throws InvalidArgumentException in case of unsupported builtin param
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Video/VideoConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(FFMpegConfigInterface $ffmpegConfig, ?LoggerInterfac
{
$this->ffmpegConfig = $ffmpegConfig;

$this->logger = $logger ?: new NullLogger();
$this->logger = $logger ?? new NullLogger();
}

/**
Expand Down Expand Up @@ -72,7 +72,7 @@ public function getSymfonyProcess(string $inputFile, $outputFile, VideoConvertPa
try {
$ffmpegCmd = $adapter->getCliCommand($arguments, $inputFile, $outputFile);
} catch (CommonException\InvalidArgumentException $e) {
throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
throw new InvalidArgumentException($e->getMessage(), (int) $e->getCode(), $e);
}

$pp = $processParams ?? $this->ffmpegConfig->getProcessParams();
Expand Down
2 changes: 1 addition & 1 deletion src/Video/VideoInfoReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class VideoInfoReader implements VideoInfoReaderInterface
/** @var FFProbeConfigInterface */
protected $ffprobeConfig;

/** @var LoggerInterface|NullLogger */
/** @var LoggerInterface */
protected $logger;

public function __construct(FFProbeConfigInterface $ffProbeConfig, ?LoggerInterface $logger = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Video/VideoThumbGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class VideoThumbGenerator implements VideoThumbGeneratorInterface
/** @var int */
protected $defaultQualityScale;

/** @var LoggerInterface|NullLogger */
/** @var LoggerInterface */
protected $logger;

public function __construct(FFMpegConfigInterface $ffmpegConfig, ?LoggerInterface $logger = null, int $defaultQualityScale = self::DEFAULT_QUALITY_SCALE)
Expand Down
6 changes: 4 additions & 2 deletions src/Video/VideoThumbParamsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
namespace Soluble\MediaTools\Video;

use Soluble\MediaTools\Common\Service\ActionParamInterface;
use Soluble\MediaTools\Video\Adapter\FFMpegCLIValueInterface;
use Soluble\MediaTools\Video\Exception\InvalidArgumentException;
use Soluble\MediaTools\Video\Filter\Type\VideoFilterInterface;

interface VideoThumbParamsInterface extends ActionParamInterface
{
Expand All @@ -31,8 +33,8 @@ interface VideoThumbParamsInterface extends ActionParamInterface
/**
* Set a built-in param...
*
* @param string $paramName a param that must exist in builtInParams
* @param mixed $paramValue
* @param string $paramName a param that must exist in builtInParams
* @param bool|string|int|VideoFilterInterface|FFMpegCLIValueInterface $paramValue
*
* @throws InvalidArgumentException in case of unsupported builtin param
*/
Expand Down

0 comments on commit 2a69c86

Please sign in to comment.