From 0db799a12a70ac9db041d6e6d990eebb99fa20a5 Mon Sep 17 00:00:00 2001 From: tentacode Date: Sun, 31 Mar 2024 20:00:18 +0200 Subject: [PATCH] Fixing pint coding standard --- src/UsesContent.php | 4 ++-- src/UsesFeeds.php | 8 ++++---- src/UsesFileParsers.php | 44 ++++++++++++++++++++--------------------- src/UsesUrls.php | 2 +- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/UsesContent.php b/src/UsesContent.php index 25697c2..afcf472 100644 --- a/src/UsesContent.php +++ b/src/UsesContent.php @@ -382,7 +382,7 @@ protected function prepContent(): array * @see https://phpscraper.de/examples/extract-keywords.html * @see https://github.com/spekulatius/phpscraper-keyword-scraping-example * - * @param string $locale (default: 'en_US') + * @param string $locale (default: 'en_US') */ public function contentKeywords($locale = 'en_US'): array { @@ -408,7 +408,7 @@ public function contentKeywords($locale = 'en_US'): array * @see https://phpscraper.de/examples/extract-keywords.html * @see https://github.com/spekulatius/phpscraper-keyword-scraping-example * - * @param string $locale (default: 'en_US') + * @param string $locale (default: 'en_US') */ public function contentKeywordsWithScores($locale = 'en_US'): array { diff --git a/src/UsesFeeds.php b/src/UsesFeeds.php index c80fa29..9f787a1 100644 --- a/src/UsesFeeds.php +++ b/src/UsesFeeds.php @@ -19,7 +19,7 @@ public function sitemapUrl(): string * * @return array $sitemap */ - public function sitemapRaw(string $url = null): array + public function sitemapRaw(?string $url = null): array { return $this->parseXml($this->fetchAsset($url ?? $this->sitemapUrl())); } @@ -31,7 +31,7 @@ public function sitemapRaw(string $url = null): array * * @return array $sitemap */ - public function sitemap(string $url = null): array + public function sitemap(?string $url = null): array { return array_map( // Create the generic DTO for each @@ -59,7 +59,7 @@ public function searchIndexUrl(): string * * @return array $searchIndex */ - public function searchIndexRaw(string $url = null): array + public function searchIndexRaw(?string $url = null): array { return $this->parseJson($this->fetchAsset($url ?? $this->searchIndexUrl())); } @@ -69,7 +69,7 @@ public function searchIndexRaw(string $url = null): array * * @return array $searchIndex */ - public function searchIndex(string $url = null): array + public function searchIndex(?string $url = null): array { return array_map( // Create the generic DTO for each diff --git a/src/UsesFileParsers.php b/src/UsesFileParsers.php index d2ff7cf..c5c7df1 100644 --- a/src/UsesFileParsers.php +++ b/src/UsesFileParsers.php @@ -11,9 +11,9 @@ trait UsesFileParsers */ public function csvDecodeRaw( string $csvString, - string $separator = null, - string $enclosure = null, - string $escape = null + ?string $separator = null, + ?string $enclosure = null, + ?string $escape = null ): array { try { $csv = array_map( @@ -39,9 +39,9 @@ public function csvDecodeRaw( */ public function csvDecode( string $csvString, - string $separator = null, - string $enclosure = null, - string $escape = null + ?string $separator = null, + ?string $enclosure = null, + ?string $escape = null ): array { try { $csv = $this->csvDecodeRaw($csvString, $separator, $enclosure, $escape); @@ -68,9 +68,9 @@ public function csvDecode( */ public function csvDecodeWithHeaderRaw( string $csvString, - string $separator = null, - string $enclosure = null, - string $escape = null + ?string $separator = null, + ?string $enclosure = null, + ?string $escape = null ): array { try { $csv = $this->csvDecodeRaw($csvString, $separator, $enclosure, $escape); @@ -99,9 +99,9 @@ function (&$row, $key, $header): void { */ public function csvDecodeWithHeader( string $csvString, - string $separator = null, - string $enclosure = null, - string $escape = null + ?string $separator = null, + ?string $enclosure = null, + ?string $escape = null ): array { try { $csv = $this->csvDecodeWithHeaderRaw($csvString, $separator, $enclosure, $escape); @@ -143,10 +143,10 @@ public function castType(string $entry): int|float|string * @return array $data */ public function parseCsv( - string $csvStringOrUrl = null, - string $separator = null, - string $enclosure = null, - string $escape = null + ?string $csvStringOrUrl = null, + ?string $separator = null, + ?string $enclosure = null, + ?string $escape = null ): array { // Check if we got either a current page or at least a URL string to process if ($csvStringOrUrl === null && $this->currentPage === null) { @@ -195,10 +195,10 @@ public function parseCsv( * @return array $data */ public function parseCsvWithHeader( - string $csvStringOrUrl = null, - string $separator = null, - string $enclosure = null, - string $escape = null + ?string $csvStringOrUrl = null, + ?string $separator = null, + ?string $enclosure = null, + ?string $escape = null ): array { // Check if we got either a current page or at least a URL string to process if ($csvStringOrUrl === null && $this->currentPage === null) { @@ -246,7 +246,7 @@ public function parseCsvWithHeader( * * @return array $data */ - public function parseJson(string $jsonStringOrUrl = null): array + public function parseJson(?string $jsonStringOrUrl = null): array { // Check if we got either a current page or at least a URL string to process if ($jsonStringOrUrl === null && $this->currentPage === null) { @@ -294,7 +294,7 @@ public function parseJson(string $jsonStringOrUrl = null): array * * @return array $data */ - public function parseXml(string $xmlStringOrUrl = null): array + public function parseXml(?string $xmlStringOrUrl = null): array { // Check if we got either a current page or at least a URL string to process if ($xmlStringOrUrl === null && $this->currentPage === null) { diff --git a/src/UsesUrls.php b/src/UsesUrls.php index a7df9d9..39b28c4 100644 --- a/src/UsesUrls.php +++ b/src/UsesUrls.php @@ -52,7 +52,7 @@ public function currentBaseHost(): string * * @return ?string $absoluteUrl */ - public function makeUrlAbsolute(string $url = null, string $baseUrl = null): ?string + public function makeUrlAbsolute(?string $url = null, ?string $baseUrl = null): ?string { // Allow to pass null through if ($url === null || $this->currentPage === null) {