diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml new file mode 100644 index 0000000..042362b --- /dev/null +++ b/.github/workflows/coding-standards.yml @@ -0,0 +1,19 @@ +name: Static Tests +on: [push] + +jobs: + coding-standards: + name: Coding Standards + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: extdn/github-actions-m2/magento-coding-standard/8.1@master + + static-analysis: + name: Static Analysis + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: extdn/github-actions-m2/magento-phpstan/8.1@master + with: + composer_name: elevinskii/module-media-storage diff --git a/Model/Gallery/Image.php b/Model/Gallery/Image.php index 932113b..ab009ad 100644 --- a/Model/Gallery/Image.php +++ b/Model/Gallery/Image.php @@ -60,6 +60,7 @@ public function getCatalogPath(): string */ public function getPathInfo(): PathInfo { + // phpcs:ignore $pathInfo = pathinfo($this->getAbsolutePath()); return $this->pathInfoFactory->create() @@ -76,6 +77,7 @@ public function getFileSize(): int { $absolutePath = $this->getAbsolutePath(); + // phpcs:ignore $fileSize = @filesize($absolutePath); if (!$fileSize) { throw new FileSystemException( @@ -98,6 +100,7 @@ public function getHash(): string $hash = $this->hashCache->get($absolutePath); if (!$hash) { + // phpcs:ignore $hash = @hash_file(self::HASH_ALGORITHM, $absolutePath) ?: null; $this->hashCache->set($absolutePath, $hash); } diff --git a/Model/Gallery/Image/HashCache.php b/Model/Gallery/Image/HashCache.php index 9b703ef..bba3516 100644 --- a/Model/Gallery/Image/HashCache.php +++ b/Model/Gallery/Image/HashCache.php @@ -24,6 +24,8 @@ public function get(string $path): ?string /** * Set file hash by path * + * @param string $path + * @param string|null $hash * @return $this */ public function set(string $path, ?string $hash): self