fix little issues
This commit is contained in:
parent
bdfb251876
commit
2e2bd4a32d
@ -14,7 +14,7 @@
|
|||||||
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l",
|
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l",
|
||||||
"cs:check": "php-cs-fixer fix --dry-run --diff",
|
"cs:check": "php-cs-fixer fix --dry-run --diff",
|
||||||
"cs:fix": "php-cs-fixer fix",
|
"cs:fix": "php-cs-fixer fix",
|
||||||
"psalm:check": "psalm.phar --threads=1 --no-cache",
|
"psalm:check": "psalm.phar --threads=1 --no-cache --show-info=true",
|
||||||
"psalm:fix": "psalm.phar --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType"
|
"psalm:fix": "psalm.phar --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
|
@ -27,10 +27,11 @@ class Application extends App {
|
|||||||
|
|
||||||
/** @psalm-suppress DeprecatedInterface */
|
/** @psalm-suppress DeprecatedInterface */
|
||||||
$container = $this->getContainer();
|
$container = $this->getContainer();
|
||||||
$hooks = new Hooks(
|
/** @var IRootFolder $rootFolder */
|
||||||
$container->get(IRootFolder::class),
|
$rootFolder = $container->get(IRootFolder::class);
|
||||||
$container->get(IDBConnection::class),
|
/** @var IDBConnection $dbConnection */
|
||||||
);
|
$dbConnection = $container->get(IDBConnection::class);
|
||||||
|
$hooks = new Hooks($rootFolder, $dbConnection);
|
||||||
$hooks->register();
|
$hooks->register();
|
||||||
|
|
||||||
/** @psalm-suppress DeprecatedMethod */
|
/** @psalm-suppress DeprecatedMethod */
|
||||||
|
@ -57,20 +57,20 @@ class BookmarkMapper extends ReaderMapper {
|
|||||||
* @brief write bookmark to database
|
* @brief write bookmark to database
|
||||||
*
|
*
|
||||||
* @param int $fileId
|
* @param int $fileId
|
||||||
* @param ?string $name
|
* @param string $name
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @param ?string $type
|
* @param ?string $type
|
||||||
* @param ?string $content
|
* @param ?string $content
|
||||||
*
|
*
|
||||||
* @return ReaderEntity the newly created or updated bookmark
|
* @return ReaderEntity the newly created or updated bookmark
|
||||||
*/
|
*/
|
||||||
public function set(int $fileId, ?string $name = null, string $value, ?string $type = null, ?string $content = null): ReaderEntity {
|
public function set(int $fileId, string $name, string $value, ?string $type = null, ?string $content = null): ReaderEntity {
|
||||||
/** @var Bookmark[] $result */
|
/** @var Bookmark[] $result */
|
||||||
$result = $this->get($fileId, $name);
|
$result = $this->get($fileId, $name);
|
||||||
|
|
||||||
if(empty($result)) {
|
if(empty($result)) {
|
||||||
// anonymous bookmarks are named after their contents
|
// anonymous bookmarks are named after their contents
|
||||||
if (null === $name) {
|
if (empty($name)) {
|
||||||
$name = $value;
|
$name = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,12 +54,12 @@ class BookmarkService extends Service {
|
|||||||
* position type is format-dependent, eg CFI for epub, page number for CBR/CBZ, etc
|
* position type is format-dependent, eg CFI for epub, page number for CBR/CBZ, etc
|
||||||
*
|
*
|
||||||
* @param int $fileId
|
* @param int $fileId
|
||||||
* @param ?string $name
|
* @param string $name
|
||||||
* @param string $value
|
* @param string $value
|
||||||
* @param ?string $type
|
* @param ?string $type
|
||||||
* @param ?string $content
|
* @param ?string $content
|
||||||
*/
|
*/
|
||||||
public function set(int $fileId, ?string $name = null, string $value, ?string $type = null, ?string $content = null): ReaderEntity {
|
public function set(int $fileId, string $name, string $value, ?string $type = null, ?string $content = null): ReaderEntity {
|
||||||
return $this->bookmarkMapper->set($fileId, $name, $value, $type, $content);
|
return $this->bookmarkMapper->set($fileId, $name, $value, $type, $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
<psalm
|
<psalm
|
||||||
errorLevel="2"
|
errorLevel="2"
|
||||||
resolveFromConfigFile="true"
|
resolveFromConfigFile="true"
|
||||||
|
findUnusedBaselineEntry="true"
|
||||||
|
findUnusedCode="false"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns="https://getpsalm.org/schema/config"
|
xmlns="https://getpsalm.org/schema/config"
|
||||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||||
|
Reference in New Issue
Block a user