From 50e7c2ad3d7110b06527d75a1aa954b7c20f6ea1 Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal Date: Wed, 18 May 2022 16:57:00 +0300 Subject: [PATCH 1/7] AC-1348 Add match keyword to a Reserved words sniff (#177) --- Magento2/Sniffs/NamingConvention/ReservedWordsSniff.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Magento2/Sniffs/NamingConvention/ReservedWordsSniff.php b/Magento2/Sniffs/NamingConvention/ReservedWordsSniff.php index 13109c58..9c6e453a 100644 --- a/Magento2/Sniffs/NamingConvention/ReservedWordsSniff.php +++ b/Magento2/Sniffs/NamingConvention/ReservedWordsSniff.php @@ -34,6 +34,7 @@ class ReservedWordsSniff implements Sniff 'object' => '7', 'mixed' => '7', 'numeric' => '7', + 'match' => '8' ]; private const CLASS_ERROR_CODE = 'ForbiddenAsClassName'; From 82723b999e65af38dcd26aa4fd11a25f01878393 Mon Sep 17 00:00:00 2001 From: Marc Ginesta Date: Wed, 25 May 2022 11:58:31 +0200 Subject: [PATCH 2/7] Update hasDeprecatedWellFormatted + upgrade rector --- .../Commenting/PHPDocFormattingValidator.php | 8 ++---- ...ssAndInterfacePHPDocFormattingUnitTest.php | 1 + .../ConstantsPHPDocFormattingUnitTest.1.inc | 10 ------- .../ConstantsPHPDocFormattingUnitTest.2.inc | 10 +++++++ .../ConstantsPHPDocFormattingUnitTest.php | 12 ++++---- composer.json | 2 +- composer.lock | 28 +++++++++---------- 7 files changed, 35 insertions(+), 36 deletions(-) diff --git a/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php b/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php index 745ec587..9fd42e7f 100644 --- a/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php +++ b/Magento2/Helpers/Commenting/PHPDocFormattingValidator.php @@ -121,15 +121,11 @@ public function hasDeprecatedWellFormatted($commentStartPtr, $tokens) if ($deprecatedPtr === -1) { return true; } - - $seeTagRequired = false; - if ($tokens[$deprecatedPtr + 2]['code'] !== T_DOC_COMMENT_STRING) { - $seeTagRequired = true; - } $seePtr = $this->getTagPosition('@see', $commentStartPtr, $tokens); if ($seePtr === -1) { - return !$seeTagRequired; + return false; } + return $tokens[$seePtr + 2]['code'] === T_DOC_COMMENT_STRING; } diff --git a/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.php b/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.php index 9b5b2f85..eebae4e8 100644 --- a/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.php +++ b/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.php @@ -33,6 +33,7 @@ public function getWarningList($testFile = '') 65 => 1, 66 => 1, 101 => 1, + 109 => 1, 118 => 1, 127 => 1, ]; diff --git a/Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.1.inc b/Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.1.inc index 6e0b16f0..0b402ec2 100644 --- a/Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.1.inc +++ b/Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.1.inc @@ -7,11 +7,6 @@ define('DS', DIRECTORY_SEPARATOR); define('BP', dirname(__FILE__)); -/** - * @deprecated It is a lie - */ -define('THERE IS', 'cake'); - /** * @deprecated New implementation available * @see \Ascii\Asterisk @@ -27,11 +22,6 @@ class Profiler */ const NUMBER_TWO = 2; - /** - * @deprecated Why not - */ - const YES = false; - /** * @deprecated Unable to identify the question, replaced * @see \ComputationalMatrix\Earth diff --git a/Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.2.inc b/Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.2.inc index b413bc92..12b89834 100644 --- a/Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.2.inc +++ b/Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.2.inc @@ -13,6 +13,11 @@ define('NUMBER_ONE', 1); */ define('A', 65); +/** + * @deprecated It is a lie + */ +define('THERE IS', 'cake'); + /** * @deprecated * @see @@ -42,6 +47,11 @@ class Profiler */ const a = 97; + /** + * @deprecated Why not + */ + const YES = false; + /** * @deprecated * @see diff --git a/Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.php b/Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.php index 16cd4d85..c11be454 100644 --- a/Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.php +++ b/Magento2/Tests/Commenting/ConstantsPHPDocFormattingUnitTest.php @@ -30,13 +30,15 @@ public function getWarningList($testFile = '') 6 => 1, 9 => 1, 14 => 1, - 20 => 1, - 26 => 1, - 33 => 1, + 19 => 1, + 25 => 1, + 31 => 1, 38 => 1, 43 => 1, - 49 => 1, - 55 => 1 + 48 => 1, + 53 => 1, + 59 => 1, + 65 => 1 ]; } } diff --git a/composer.json b/composer.json index 5b238f4f..b86022b9 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "ext-dom": "*", "phpcompatibility/php-compatibility": "^9.3", "squizlabs/php_codesniffer": "^3.6.1", - "rector/rector": "^0.12.17" + "rector/rector": "^0.13.0" }, "require-dev": { "phpunit/phpunit": "^9.5.8" diff --git a/composer.lock b/composer.lock index d09e8dde..d182abf8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "63d0aa40cf8f2071a5e7e572eae08f45", + "content-hash": "a3c03834eb0c721e9899cf1377029d57", "packages": [ { "name": "phpcompatibility/php-compatibility", @@ -70,16 +70,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.5.7", + "version": "1.7.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "7fb7e2e1e9f3d59a26a413b2d3d5e47f0edb75ac" + "reference": "e3baed2ee2ef322e0f9b8fe8f87fdbe024c7c719" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7fb7e2e1e9f3d59a26a413b2d3d5e47f0edb75ac", - "reference": "7fb7e2e1e9f3d59a26a413b2d3d5e47f0edb75ac", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e3baed2ee2ef322e0f9b8fe8f87fdbe024c7c719", + "reference": "e3baed2ee2ef322e0f9b8fe8f87fdbe024c7c719", "shasum": "" }, "require": { @@ -105,7 +105,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.5.7" + "source": "https://github.com/phpstan/phpstan/tree/1.7.1" }, "funding": [ { @@ -125,25 +125,25 @@ "type": "tidelift" } ], - "time": "2022-04-20T12:20:27+00:00" + "time": "2022-05-24T09:05:09+00:00" }, { "name": "rector/rector", - "version": "0.12.21", + "version": "0.13.0", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "2fb3b1c1d85e784a55e5806cf50734e5aa872eb4" + "reference": "bb3b32dd590cbd0deb67c2ce8ae32801357ff059" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/2fb3b1c1d85e784a55e5806cf50734e5aa872eb4", - "reference": "2fb3b1c1d85e784a55e5806cf50734e5aa872eb4", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/bb3b32dd590cbd0deb67c2ce8ae32801357ff059", + "reference": "bb3b32dd590cbd0deb67c2ce8ae32801357ff059", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.5.6" + "phpstan/phpstan": "^1.6.8" }, "conflict": { "phpstan/phpdoc-parser": "<1.2", @@ -177,7 +177,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.12.21" + "source": "https://github.com/rectorphp/rector/tree/0.13.0" }, "funding": [ { @@ -185,7 +185,7 @@ "type": "github" } ], - "time": "2022-04-18T12:12:41+00:00" + "time": "2022-05-23T10:26:32+00:00" }, { "name": "squizlabs/php_codesniffer", From e64106ddbdb9ee91ce89bb02b7858082eea21cf8 Mon Sep 17 00:00:00 2001 From: Marc Ginesta Date: Thu, 26 May 2022 12:41:20 +0200 Subject: [PATCH 3/7] Use hasDeprecatedWellFormatted for Method Annotations --- .../MethodAnnotationStructureSniff.php | 17 +++++ .../MethodAnnotationStructureUnitTest.inc | 63 +++++++++++++++++++ .../MethodAnnotationStructureUnitTest.php | 7 ++- 3 files changed, 86 insertions(+), 1 deletion(-) diff --git a/Magento2/Sniffs/Annotation/MethodAnnotationStructureSniff.php b/Magento2/Sniffs/Annotation/MethodAnnotationStructureSniff.php index fed274a9..a4ff6470 100644 --- a/Magento2/Sniffs/Annotation/MethodAnnotationStructureSniff.php +++ b/Magento2/Sniffs/Annotation/MethodAnnotationStructureSniff.php @@ -7,6 +7,7 @@ namespace Magento2\Sniffs\Annotation; +use Magento2\Helpers\Commenting\PHPDocFormattingValidator; use PHP_CodeSniffer\Files\File; use PHP_CodeSniffer\Sniffs\Sniff; @@ -20,12 +21,18 @@ class MethodAnnotationStructureSniff implements Sniff */ private $annotationFormatValidator; + /** + * @var PHPDocFormattingValidator + */ + private $PHPDocFormattingValidator; + /** * AnnotationStructureSniff constructor. */ public function __construct() { $this->annotationFormatValidator = new AnnotationFormatValidator(); + $this->PHPDocFormattingValidator = new PHPDocFormattingValidator(); } /** @@ -45,6 +52,16 @@ public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $commentStartPtr = $phpcsFile->findPrevious(T_DOC_COMMENT_OPEN_TAG, ($stackPtr), 0); + + if ($this->PHPDocFormattingValidator->hasDeprecatedWellFormatted($commentStartPtr, $tokens) !== true) { + $phpcsFile->addWarning( + 'Motivation behind the added @deprecated tag MUST be explained. ' + . '@see tag MUST be used with reference to new implementation when code is deprecated ' + . 'and there is a new alternative.', + $stackPtr, + 'InvalidDeprecatedTagUsage' + ); + } $commentEndPtr = $phpcsFile->findPrevious(T_DOC_COMMENT_CLOSE_TAG, ($stackPtr), 0); if (!$commentStartPtr) { $phpcsFile->addError('Comment block is missing', $stackPtr, 'MethodArguments'); diff --git a/Magento2/Tests/Annotation/MethodAnnotationStructureUnitTest.inc b/Magento2/Tests/Annotation/MethodAnnotationStructureUnitTest.inc index 8124bc75..4d3e0b7b 100644 --- a/Magento2/Tests/Annotation/MethodAnnotationStructureUnitTest.inc +++ b/Magento2/Tests/Annotation/MethodAnnotationStructureUnitTest.inc @@ -306,4 +306,67 @@ class MethodAnnotationFixture { return $start === $length; } + + /** + * This is a well-formed deprecated function + * + * @deprecated can be used in this context + * @see is ok here + */ + public function deprecated(): bool + { + return true; + } + + /** + * This deprecated function is incorrect since it only contains the @deprecated tag + * + * @deprecated + */ + public function incorrectlyDeprecated() + { + return false; + } + + /** + * This deprecated function is incorrect since it only contains the @deprecated tag + * + * @deprecated Should not be used + */ + public function incorrectAsWell() + { + return false; + } + + /** + * This deprecated function is incorrect since the @see tag does not have extra info + * + * @deprecated + * @see + */ + public function anotherOne() + { + return false; + } + + /** + * This deprecated function is incorrect since the @see tag does not have extra info + * + * @deprecated Should not be used + * @see + */ + public function yetAnotherOne() + { + return false; + } + + /** + * This function is correct since the @see tag can be used without the @deprecated tag + * + * @see Magento\Framework\NewHandler + */ + public function correctUseOfSee() + { + return true; + } } diff --git a/Magento2/Tests/Annotation/MethodAnnotationStructureUnitTest.php b/Magento2/Tests/Annotation/MethodAnnotationStructureUnitTest.php index 8c2ac4a1..b4c80141 100644 --- a/Magento2/Tests/Annotation/MethodAnnotationStructureUnitTest.php +++ b/Magento2/Tests/Annotation/MethodAnnotationStructureUnitTest.php @@ -46,6 +46,11 @@ public function getErrorList() */ public function getWarningList() { - return []; + return [ + 326 => 1, + 336 => 1, + 347 => 1, + 358 => 1 + ]; } } From eea2aced49e09e00577c50c83a62ee024bb5f046 Mon Sep 17 00:00:00 2001 From: Marc Ginesta Date: Thu, 26 May 2022 15:28:45 +0200 Subject: [PATCH 4/7] Remove unnecessary ',' --- .../Commenting/ClassAndInterfacePHPDocFormattingUnitTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.php b/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.php index eebae4e8..868187c3 100644 --- a/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.php +++ b/Magento2/Tests/Commenting/ClassAndInterfacePHPDocFormattingUnitTest.php @@ -35,7 +35,7 @@ public function getWarningList($testFile = '') 101 => 1, 109 => 1, 118 => 1, - 127 => 1, + 127 => 1 ]; } } From 3be61b1f1eb52d7fec7a73c942d99e38095eda4c Mon Sep 17 00:00:00 2001 From: Marc Ginesta Date: Thu, 26 May 2022 15:39:27 +0200 Subject: [PATCH 5/7] Use hasDeprecatedWellFormatted for properties --- .../ClassPropertyPHPDocFormattingSniff.php | 9 ++++ .../ClassPropertyPHPDocFormattingUnitTest.inc | 52 +++++++++++++++++++ .../ClassPropertyPHPDocFormattingUnitTest.php | 6 ++- 3 files changed, 66 insertions(+), 1 deletion(-) diff --git a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php index 1d381bdc..f05cc78b 100644 --- a/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php +++ b/Magento2/Sniffs/Commenting/ClassPropertyPHPDocFormattingSniff.php @@ -67,6 +67,15 @@ public function processMemberVar(File $phpcsFile, $stackPtr) } $commentStart = $tokens[$commentEnd]['comment_opener']; + if ($this->PHPDocFormattingValidator->hasDeprecatedWellFormatted($commentStart, $tokens) !== true) { + $phpcsFile->addWarning( + 'Motivation behind the added @deprecated tag MUST be explained. ' + . '@see tag MUST be used with reference to new implementation when code is deprecated ' + . 'and there is a new alternative.', + $stackPtr, + 'InvalidDeprecatedTagUsage' + ); + } $varAnnotationPosition = null; foreach ($tokens[$commentStart]['comment_tags'] as $tag) { if ($tokens[$tag]['content'] === '@var') { diff --git a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc index 6e0000bf..62e9688f 100644 --- a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc +++ b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.inc @@ -142,4 +142,56 @@ class correctlyFormattedClassMemberDocBlock * @var string|null */ protected ?string $test2; + + /** + * @var string + * @deprecated + */ + protected string $badlyDeprecated; + + /** + * @var string + * @deprecated Why not + */ + protected string $incorrectlyDeprecated; + + /** + * @var string + * @deprecated + * @see + */ + protected string $inaccurately; + + /** + * @var string + * @deprecated No reference specified + * @see + */ + protected string $mistakenly; + + /** + * @var string + * @deprecated No reference specified + * @see Some reference + */ + protected string $correctly; + + /** + * @var string + * @deprecated + * @see Some other reference + */ + protected string $alsoCorrect; + + /** + * @var string + * @see + */ + protected string $shouldBeCorrect; + + /** + * @var string + * @see Message with some reference + */ + protected string $itIsCorrect; } diff --git a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php index 1d6ad272..11acee41 100644 --- a/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php +++ b/Magento2/Tests/Commenting/ClassPropertyPHPDocFormattingUnitTest.php @@ -34,7 +34,11 @@ public function getWarningList() 63 => 1, 68 => 1, 75 => 1, - 125 => 1 + 125 => 1, + 150 => 1, + 156 => 1, + 163 => 1, + 170 => 1 ]; } } From afd864c9af508264b3a72e6da332ed7013aac66d Mon Sep 17 00:00:00 2001 From: Sergii Ivashchenko Date: Tue, 31 May 2022 11:35:25 +0100 Subject: [PATCH 6/7] AC-3187: Incorrect message for discouraged functions --- .../Functions/DiscouragedFunctionSniff.php | 76 +++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php b/Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php index 13acffdc..51730217 100644 --- a/Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php +++ b/Magento2/Sniffs/Functions/DiscouragedFunctionSniff.php @@ -40,11 +40,11 @@ class DiscouragedFunctionSniff extends ForbiddenFunctionsSniff '^chdir$' => null, '^chgrp$' => null, '^chmod$' => 'Magento\Framework\Filesystem\DriverInterface::changePermissions() - or Magento\Framework\Filesystem\DriverInterface::changePermissionsRecursively()', + or Magento\Framework\Filesystem\DriverInterface::changePermissionsRecursively', '^chown$' => null, '^chroot$' => null, '^com_load_typelib$' => null, - '^copy$' => 'Magento\Framework\Filesystem\DriverInterface::copy()', + '^copy$' => 'Magento\Framework\Filesystem\DriverInterface::copy', '^curl_.*$' => null, '^cyrus_connect$' => null, '^dba_.*$' => null, @@ -54,21 +54,21 @@ class DiscouragedFunctionSniff extends ForbiddenFunctionsSniff '^dcngettext$' => null, '^dgettext$' => null, '^dio_.*$' => null, - '^dirname$' => 'Magento\Framework\Filesystem\DriverInterface::getParentDirectory()', + '^dirname$' => 'Magento\Framework\Filesystem\DriverInterface::getParentDirectory', '^dngettext$' => null, '^domxml_.*$' => null, '^fbsql_.*$' => null, '^fbsql$' => null, '^fdf_add_doc_javascript$' => null, '^fdf_open$' => null, - '^fopen$' => 'Magento\Framework\Filesystem\DriverInterface::fileOpen()', - '^fclose$' => 'Magento\Framework\Filesystem\DriverInterface::fileClose()', - '^fsockopen$' => 'Magento\Framework\Filesystem\Driver\Http::open()', + '^fopen$' => 'Magento\Framework\Filesystem\DriverInterface::fileOpen', + '^fclose$' => 'Magento\Framework\Filesystem\DriverInterface::fileClose', + '^fsockopen$' => 'Magento\Framework\Filesystem\Driver\Http::open', '^ftp_.*$' => null, - '^fwrite$' => 'Magento\Framework\Filesystem\DriverInterface::fileWrite()', - '^fputs$' => 'Magento\Framework\Filesystem\DriverInterface::fileWrite()', - '^gettext$' => 'Magento\Framework\Translate\AdapterInterface::translate()', - '^_$' => 'Magento\Framework\Translate\AdapterInterface::translate()', + '^fwrite$' => 'Magento\Framework\Filesystem\DriverInterface::fileWrite', + '^fputs$' => 'Magento\Framework\Filesystem\DriverInterface::fileWrite', + '^gettext$' => 'Magento\Framework\Translate\AdapterInterface::translate', + '^_$' => 'Magento\Framework\Translate\AdapterInterface::translate', '^gz.*$' => null, '^header$' => null, '^highlight_file$' => null, @@ -84,7 +84,7 @@ class DiscouragedFunctionSniff extends ForbiddenFunctionsSniff '^link$' => null, '^mail$' => null, '^mb_send_mail$' => null, - '^mkdir$' => 'Magento\Framework\Filesystem\DriverInterface::createDirectory()', + '^mkdir$' => 'Magento\Framework\Filesystem\DriverInterface::createDirectory', '^move_uploaded_file$' => null, '^msession_.*$' => null, '^msg_send$' => null, @@ -102,7 +102,7 @@ class DiscouragedFunctionSniff extends ForbiddenFunctionsSniff '^parse_str$' => null, '^parse_url$' => null, '^parsekit_compile_string$' => null, - '^pathinfo$' => 'Magento\Framework\Filesystem\Io\File::getPathInfo()', + '^pathinfo$' => 'Magento\Framework\Filesystem\Io\File::getPathInfo', '^pcntl_.*$' => null, '^posix_.*$' => null, '^pfpro_.*$' => null, @@ -112,14 +112,14 @@ class DiscouragedFunctionSniff extends ForbiddenFunctionsSniff '^print_r$' => null, '^printf$' => null, '^putenv$' => null, - '^readfile$' => 'Magento\Framework\Filesystem\DriverInterface::fileRead()', + '^readfile$' => 'Magento\Framework\Filesystem\DriverInterface::fileRead', '^readgzfile$' => null, - '^readline$' => 'Magento\Framework\Filesystem\DriverInterface::fileReadLine()', + '^readline$' => 'Magento\Framework\Filesystem\DriverInterface::fileReadLine', '^readlink$' => null, '^register_shutdown_function$' => null, '^register_tick_function$' => null, - '^rename$' => 'Magento\Framework\Filesystem\DriverInterface::rename()', - '^rmdir$' => 'Magento\Framework\Filesystem\DriverInterface::deleteDirectory()', + '^rename$' => 'Magento\Framework\Filesystem\DriverInterface::rename', + '^rmdir$' => 'Magento\Framework\Filesystem\DriverInterface::deleteDirectory', '^scandir$' => null, '^session_.*$' => null, '^set_include_path$' => null, @@ -127,15 +127,15 @@ class DiscouragedFunctionSniff extends ForbiddenFunctionsSniff '^ini_alter$' => null, '^set_time_limit$' => null, '^setcookie$' => null, - '^setlocale$' => 'Magento\Framework\Translate\AdapterInterface::setlocale()', + '^setlocale$' => 'Magento\Framework\Translate\AdapterInterface::setLocale', '^setrawcookie$' => null, '^sleep$' => null, '^socket_.*$' => null, '^stream_.*$' => null, '^sybase_.*$' => null, - '^symlink$' => 'Magento\Framework\Filesystem\DriverInterface::symlink()', + '^symlink$' => 'Magento\Framework\Filesystem\DriverInterface::symlink', '^syslog$' => null, - '^touch$' => 'Magento\Framework\Filesystem\DriverInterface::touch()', + '^touch$' => 'Magento\Framework\Filesystem\DriverInterface::touch', '^trigger_error$' => null, '^unlink$' => null, '^vprintf$' => null, @@ -158,7 +158,7 @@ class DiscouragedFunctionSniff extends ForbiddenFunctionsSniff '^fdf_.*$' => null, '^fget.*$' => null, '^fread$' => null, - '^fflush$' => 'Magento\Framework\Filesystem\DriverInterface::fileFlush()', + '^fflush$' => 'Magento\Framework\Filesystem\DriverInterface::fileFlush', '^get_browser$' => null, '^get_headers$' => null, '^get_meta_tags$' => null, @@ -204,23 +204,23 @@ class DiscouragedFunctionSniff extends ForbiddenFunctionsSniff '^gettype$' => null, '^var_dump$' => null, '^tempnam$' => null, - '^realpath$' => 'Magento\Framework\Filesystem\DriverInterface::getRealPath()', + '^realpath$' => 'Magento\Framework\Filesystem\DriverInterface::getRealPath', '^linkinfo$' => null, - '^lstat$' => 'Magento\Framework\Filesystem\DriverInterface::stat()', + '^lstat$' => 'Magento\Framework\Filesystem\DriverInterface::stat', '^stat$' => null, '^lchgrp$' => null, '^lchown$' => null, - '^is_dir$' => 'Magento\Framework\Filesystem\DriverInterface::isDirectory()', + '^is_dir$' => 'Magento\Framework\Filesystem\DriverInterface::isDirectory', '^is_executable$' => null, - '^is_file$' => 'Magento\Framework\Filesystem\DriverInterface::isFile()', + '^is_file$' => 'Magento\Framework\Filesystem\DriverInterface::isFile', '^is_link$' => null, - '^is_readable$' => 'Magento\Framework\Filesystem\DriverInterface::isReadable()', - '^is_writable$' => 'Magento\Framework\Filesystem\DriverInterface::isWritable()', - '^is_writeable$' => 'Magento\Framework\Filesystem\DriverInterface::isWritable()', + '^is_readable$' => 'Magento\Framework\Filesystem\DriverInterface::isReadable', + '^is_writable$' => 'Magento\Framework\Filesystem\DriverInterface::isWritable', + '^is_writeable$' => 'Magento\Framework\Filesystem\DriverInterface::isWritable', '^is_uploaded_file$' => null, - '^glob$' => 'Magento\Framework\Filesystem\Glob::glob()', + '^glob$' => 'Magento\Framework\Filesystem\Glob::glob', '^ssh2_.*$' => null, - '^delete$' => 'Magento\Framework\Filesystem\DriverInterface::deleteFile()', + '^delete$' => 'Magento\Framework\Filesystem\DriverInterface::deleteFile', '^file.*$' => null, '^chop$' => 'rtrim()', '^sizeof$' => 'count()', @@ -229,15 +229,15 @@ class DiscouragedFunctionSniff extends ForbiddenFunctionsSniff '^strval$' => '(string) construction', '^htmlspecialchars$' => '\Magento\Framework\Escaper->escapeHtml', '^getimagesize$' => 'getimagesizefromstring', - '^file_exists$' => 'Magento\Framework\Filesystem\DriverInterface::isExists()', - '^file_get_contents$' => 'Magento\Framework\Filesystem\DriverInterface::fileGetContents()', - '^file_put_contents$' => 'Magento\Framework\Filesystem\DriverInterface::filePutContents()', - '^fgetcsv$' => 'Magento\Framework\Filesystem\DriverInterface::fileGetCsv()', - '^fputcsv$' => 'Magento\Framework\Filesystem\DriverInterface::filePutCsv()', - '^ftell$' => 'Magento\Framework\Filesystem\DriverInterface::fileTell()', - '^fseek$' => 'Magento\Framework\Filesystem\DriverInterface::fileSeek()', - '^feof$' => 'Magento\Framework\Filesystem\DriverInterface::endOfFile()', - '^flock$' => 'Magento\Framework\Filesystem\DriverInterface::fileLock()', + '^file_exists$' => 'Magento\Framework\Filesystem\DriverInterface::isExists', + '^file_get_contents$' => 'Magento\Framework\Filesystem\DriverInterface::fileGetContents', + '^file_put_contents$' => 'Magento\Framework\Filesystem\DriverInterface::filePutContents', + '^fgetcsv$' => 'Magento\Framework\Filesystem\DriverInterface::fileGetCsv', + '^fputcsv$' => 'Magento\Framework\Filesystem\DriverInterface::filePutCsv', + '^ftell$' => 'Magento\Framework\Filesystem\DriverInterface::fileTell', + '^fseek$' => 'Magento\Framework\Filesystem\DriverInterface::fileSeek', + '^feof$' => 'Magento\Framework\Filesystem\DriverInterface::endOfFile', + '^flock$' => 'Magento\Framework\Filesystem\DriverInterface::fileLock', '^date_sunrise$' => 'date_sun_info', '^date_sunset$' => 'date_sun_info', '^strptime$' => 'date_parse_from_format', From 1bb395b8d5587496ca88b207d4b32322dd162110 Mon Sep 17 00:00:00 2001 From: Sergii Ivashchenko Date: Tue, 31 May 2022 15:52:31 +0100 Subject: [PATCH 7/7] Version 23 --- composer.json | 2 +- composer.lock | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index b86022b9..b345fb0a 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "AFL-3.0" ], "type": "phpcodesniffer-standard", - "version": "22", + "version": "23", "require": { "php": ">=7.3", "webonyx/graphql-php": "^14.9", diff --git a/composer.lock b/composer.lock index d182abf8..63cc9b1c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a3c03834eb0c721e9899cf1377029d57", + "content-hash": "5929082e101a2921524f8ded269292d8", "packages": [ { "name": "phpcompatibility/php-compatibility", @@ -70,16 +70,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.7.1", + "version": "1.7.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e3baed2ee2ef322e0f9b8fe8f87fdbe024c7c719" + "reference": "cadad14ac63d8a432e01ae89ac5d0ff6fc3b16ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e3baed2ee2ef322e0f9b8fe8f87fdbe024c7c719", - "reference": "e3baed2ee2ef322e0f9b8fe8f87fdbe024c7c719", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/cadad14ac63d8a432e01ae89ac5d0ff6fc3b16ab", + "reference": "cadad14ac63d8a432e01ae89ac5d0ff6fc3b16ab", "shasum": "" }, "require": { @@ -105,7 +105,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.7.1" + "source": "https://github.com/phpstan/phpstan/tree/1.7.7" }, "funding": [ { @@ -125,25 +125,25 @@ "type": "tidelift" } ], - "time": "2022-05-24T09:05:09+00:00" + "time": "2022-05-31T13:58:21+00:00" }, { "name": "rector/rector", - "version": "0.13.0", + "version": "0.13.3", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "bb3b32dd590cbd0deb67c2ce8ae32801357ff059" + "reference": "38c15a123c19748af5c3c2fd011ba105ce34a9e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/bb3b32dd590cbd0deb67c2ce8ae32801357ff059", - "reference": "bb3b32dd590cbd0deb67c2ce8ae32801357ff059", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/38c15a123c19748af5c3c2fd011ba105ce34a9e7", + "reference": "38c15a123c19748af5c3c2fd011ba105ce34a9e7", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.6.8" + "phpstan/phpstan": "^1.7.6" }, "conflict": { "phpstan/phpdoc-parser": "<1.2", @@ -162,7 +162,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "0.12-dev" + "dev-main": "0.13-dev" } }, "autoload": { @@ -177,7 +177,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.13.0" + "source": "https://github.com/rectorphp/rector/tree/0.13.3" }, "funding": [ { @@ -185,7 +185,7 @@ "type": "github" } ], - "time": "2022-05-23T10:26:32+00:00" + "time": "2022-05-31T12:26:36+00:00" }, { "name": "squizlabs/php_codesniffer",