From 34afb02e0e2506346ce429c2d7ff64bb7eadd5d9 Mon Sep 17 00:00:00 2001 From: Oshomo Oforomeh Date: Wed, 23 Jun 2021 16:23:25 +0200 Subject: [PATCH] Updated php-cs-fixer --- README.md | 2 +- src/Converter/JsonConverter.php | 4 ++-- src/Converter/XmlConverter.php | 8 ++++---- src/Rules/Url.php | 2 +- src/Validator/Validator.php | 10 +++++----- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index feca393..d417b8c 100644 --- a/README.md +++ b/README.md @@ -296,4 +296,4 @@ The project run's automatic checks to make sure that the Symfony code standards So, before pushing or making any pull request run the below command: * `composer test`: For running test -* `composer lint`: For running php-cs-fixer to check that the code meet the set standard +* `composer fixlint`: For running php-cs-fixer to fix linting errors diff --git a/src/Converter/JsonConverter.php b/src/Converter/JsonConverter.php index b59f2f7..b066202 100755 --- a/src/Converter/JsonConverter.php +++ b/src/Converter/JsonConverter.php @@ -8,7 +8,7 @@ class JsonConverter implements ConverterHandlerInterface { - const FILE_EXTENSION = 'json'; + public const FILE_EXTENSION = 'json'; /** * The converted data. @@ -37,6 +37,6 @@ public function convert(array $data): ConverterHandlerInterface public function write(string $filename): bool { - return (file_put_contents($filename, $this->data)) ? true : false; + return (bool) file_put_contents($filename, $this->data); } } diff --git a/src/Converter/XmlConverter.php b/src/Converter/XmlConverter.php index b0a45a3..9ab651e 100755 --- a/src/Converter/XmlConverter.php +++ b/src/Converter/XmlConverter.php @@ -10,9 +10,9 @@ class XmlConverter implements ConverterHandlerInterface { - const FILE_EXTENSION = 'xml'; - const DEFAULT_ROOT_ELEMENT = 'data'; - const DEFAULT_RECORD_ELEMENT = 'item'; + public const FILE_EXTENSION = 'xml'; + public const DEFAULT_ROOT_ELEMENT = 'data'; + public const DEFAULT_RECORD_ELEMENT = 'item'; /** * XML node root element. @@ -79,6 +79,6 @@ public function write(string $filename): bool $dom->appendChild($domXml); - return ($dom->save($filename)) ? true : false; + return (bool) $dom->save($filename); } } diff --git a/src/Rules/Url.php b/src/Rules/Url.php index 6ba2196..de1072f 100644 --- a/src/Rules/Url.php +++ b/src/Rules/Url.php @@ -8,7 +8,7 @@ class Url implements ValidationRuleInterface { - const PATTERN = '~^ + public const PATTERN = '~^ (%s):// # protocol (([\.\pL\pN-]+:)?([\.\pL\pN-]+)@)? # basic auth ( diff --git a/src/Validator/Validator.php b/src/Validator/Validator.php index 5f8dbe2..1159ccd 100755 --- a/src/Validator/Validator.php +++ b/src/Validator/Validator.php @@ -14,11 +14,11 @@ class Validator { use FormatsMessages; - const FILE_EXTENSION = '.csv'; - const ERROR_MESSAGE = 'Validation fails.'; - const NO_ERROR_MESSAGE = 'File is valid.'; - const INVALID_FILE_PATH_ERROR = 'Supplied file is not accessible.'; - const SUCCESS_MESSAGE = 'CSV is valid.'; + public const FILE_EXTENSION = '.csv'; + public const ERROR_MESSAGE = 'Validation fails.'; + public const NO_ERROR_MESSAGE = 'File is valid.'; + public const INVALID_FILE_PATH_ERROR = 'Supplied file is not accessible.'; + public const SUCCESS_MESSAGE = 'CSV is valid.'; /** * The message bag instance.