From f837dff19d4078ea73911a4173e849a59a1d9925 Mon Sep 17 00:00:00 2001 From: Gemorroj Date: Sat, 22 May 2021 16:11:53 +0300 Subject: [PATCH] build: upd deps --- .gitignore | 4 ++-- .php_cs.dist => .php-cs-fixer.dist.php | 10 ++++------ README.md | 23 +++-------------------- composer.json | 2 +- 4 files changed, 10 insertions(+), 29 deletions(-) rename .php_cs.dist => .php-cs-fixer.dist.php (71%) diff --git a/.gitignore b/.gitignore index d942338..93e40cd 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,5 @@ phpstan.neon phpunit.xml .phpunit.result.cache -.php_cs -.php_cs.cache +/.php-cs-fixer.php +/.php-cs-fixer.cache diff --git a/.php_cs.dist b/.php-cs-fixer.dist.php similarity index 71% rename from .php_cs.dist rename to .php-cs-fixer.dist.php index bece217..0b23676 100644 --- a/.php_cs.dist +++ b/.php-cs-fixer.dist.php @@ -4,23 +4,21 @@ ->exclude('fixtures') ->in(['src', 'tests']); -return PhpCsFixer\Config::create() +return (new PhpCsFixer\Config()) ->setRules([ '@Symfony' => true, '@PHP73Migration' => true, - 'array_syntax' => ['syntax' => 'short'], + 'combine_consecutive_issets' => true, 'combine_consecutive_unsets' => true, 'compact_nullable_typehint' => true, 'linebreak_after_opening_tag' => true, - 'list_syntax' => ['syntax' => 'short'], - // 'mb_str_functions' => true, - 'native_function_invocation' => true, + 'native_function_invocation' => ['scope' => 'all', 'include' => ['@all']], 'native_constant_invocation' => true, 'no_null_property_initialization' => true, 'no_useless_else' => true, 'no_useless_return' => true, - 'ordered_imports' => ['sortAlgorithm' => 'alpha'], + 'ordered_imports' => ['sort_algorithm' => 'alpha'], 'phpdoc_order' => true, 'strict_comparison' => true, 'combine_nested_dirname' => true, diff --git a/README.md b/README.md index a59b088..5a6ed39 100644 --- a/README.md +++ b/README.md @@ -165,6 +165,7 @@ implement `ExtTagInterface` interface use M3uParser\M3uParser; use M3uParser\Tag\ExtTagInterface; +// create custom tag class ExtCustomTag implements ExtTagInterface { /** @@ -174,7 +175,6 @@ class ExtCustomTag implements ExtTagInterface /** * #EXTCUSTOMTAG:data - * @param string $lineStr */ public function __construct(?string $lineStr = null) { @@ -183,9 +183,6 @@ class ExtCustomTag implements ExtTagInterface } } - /** - * @param string $lineStr - */ protected function makeData(string $lineStr): void { /* @@ -200,45 +197,31 @@ example: $this->setData(\trim($data)); } - /** - * @return string - */ public function getData(): string { return $this->data; } - /** - * @param string $data - * @return $this - */ public function setData(string $data): self { $this->data = $data; return $this; } - /** - * @return string - */ public function __toString(): string { return '#EXTCUSTOMTAG: ' . $this->getData(); } - /** - * @param string $lineStr - * @return bool - */ public static function isMatch(string $lineStr): bool { return 0 === \stripos($lineStr, '#EXTCUSTOMTAG:'); } } +// use custom tag $m3uParser = new M3uParser(); -// add custom tag -$m3uParser->addTag(ExtCustomTag::class); +$m3uParser->addTag(ExtCustomTag::class); // add custom tag $data = $m3uParser->parseFile('path_to_file.m3u'); print_r($data); diff --git a/composer.json b/composer.json index 02d7926..683a6b5 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ }, "require-dev": { "phpunit/phpunit": "^9.5", - "friendsofphp/php-cs-fixer": "^2.19", + "friendsofphp/php-cs-fixer": "^3.0", "phpstan/phpstan": "^0.12" }, "autoload": {