Refacto all project #1
@ -14,7 +14,7 @@
|
||||
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l",
|
||||
"cs:check": "php-cs-fixer fix --dry-run --diff",
|
||||
"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"
|
||||
},
|
||||
"config": {
|
||||
|
@ -27,10 +27,11 @@ class Application extends App {
|
||||
|
||||
/** @psalm-suppress DeprecatedInterface */
|
||||
$container = $this->getContainer();
|
||||
$hooks = new Hooks(
|
||||
$container->get(IRootFolder::class),
|
||||
$container->get(IDBConnection::class),
|
||||
);
|
||||
/** @var IRootFolder $rootFolder */
|
||||
$rootFolder = $container->get(IRootFolder::class);
|
||||
/** @var IDBConnection $dbConnection */
|
||||
$dbConnection = $container->get(IDBConnection::class);
|
||||
$hooks = new Hooks($rootFolder, $dbConnection);
|
||||
$hooks->register();
|
||||
|
||||
/** @psalm-suppress DeprecatedMethod */
|
||||
|
@ -57,20 +57,20 @@ class BookmarkMapper extends ReaderMapper {
|
||||
* @brief write bookmark to database
|
||||
*
|
||||
* @param int $fileId
|
||||
* @param ?string $name
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @param ?string $type
|
||||
* @param ?string $content
|
||||
*
|
||||
* @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 */
|
||||
$result = $this->get($fileId, $name);
|
||||
|
||||
if(empty($result)) {
|
||||
// anonymous bookmarks are named after their contents
|
||||
if (null === $name) {
|
||||
if (empty($name)) {
|
||||
$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
|
||||
*
|
||||
* @param int $fileId
|
||||
* @param ?string $name
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @param ?string $type
|
||||
* @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);
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
<psalm
|
||||
errorLevel="2"
|
||||
resolveFromConfigFile="true"
|
||||
findUnusedBaselineEntry="true"
|
||||
findUnusedCode="false"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="https://getpsalm.org/schema/config"
|
||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||
|
Reference in New Issue
Block a user