Browse Source

Use phpcs' new style comments.

The old style is deprecated.
ADmad 7 years ago
parent
commit
af5594e11f

+ 7 - 7
src/Cache/Engine/FileEngine.php

@@ -233,9 +233,9 @@ class FileEngine extends CacheEngine
         $path = $this->_File->getRealPath();
         $this->_File = null;
 
-        //@codingStandardsIgnoreStart
+        // phpcs:disable
         return @unlink($path);
-        //@codingStandardsIgnoreEnd
+        // phpcs:enable
     }
 
     /**
@@ -302,9 +302,9 @@ class FileEngine extends CacheEngine
                 $filePath = $file->getRealPath();
                 $file = null;
 
-                //@codingStandardsIgnoreStart
+                // phpcs:disable
                 @unlink($filePath);
-                //@codingStandardsIgnoreEnd
+                // phpcs:enable
             }
         }
 
@@ -396,9 +396,9 @@ class FileEngine extends CacheEngine
         $path = $dir->getPathname();
         $success = true;
         if (!is_dir($path)) {
-            //@codingStandardsIgnoreStart
+            // phpcs:disable
             $success = @mkdir($path, 0775, true);
-            //@codingStandardsIgnoreEnd
+            // phpcs:enable
         }
 
         $isWritableDir = ($dir->isDir() && $dir->isWritable());
@@ -474,7 +474,7 @@ class FileEngine extends CacheEngine
         foreach ($filtered as $object) {
             $path = $object->getPathname();
             $object = null;
-            // @codingStandardsIgnoreLine
+            // phpcs:ignore
             @unlink($path);
         }
 

+ 2 - 2
src/Database/Driver/Sqlite.php

@@ -71,9 +71,9 @@ class Sqlite extends Driver
         $this->_connect($dsn, $config);
 
         if (!$databaseExists && $config['database'] !== ':memory:') {
-            //@codingStandardsIgnoreStart
+            // phpcs:disable
             @chmod($config['database'], $config['mask']);
-            //@codingStandardsIgnoreEnd
+            // phpcs:enable
         }
 
         if (!empty($config['init'])) {

+ 2 - 2
src/Database/Expression/QueryExpression.php

@@ -404,7 +404,7 @@ class QueryExpression implements ExpressionInterface, Countable
         return $this->add(new BetweenExpression($field, $from, $to, $type));
     }
 
-// @codingStandardsIgnoreStart
+// phpcs:disable
     /**
      * Returns a new QueryExpression object containing all the conditions passed
      * and set up the conjunction to be "AND"
@@ -440,7 +440,7 @@ class QueryExpression implements ExpressionInterface, Countable
 
         return new static($conditions, $this->getTypeMap()->setTypes($types), 'OR');
     }
-// @codingStandardsIgnoreEnd
+// phpcs:enable
 
     /**
      * Adds a new set of conditions to this level of the tree and negates

+ 7 - 7
src/Filesystem/Filesystem.php

@@ -135,10 +135,10 @@ class Filesystem
         $exists = file_exists($filename);
 
         if ($this->isStream($filename)) {
-            // @codingStandardsIgnoreLine
+            // phpcs:ignore
             $success = @file_put_contents($filename, $content);
         } else {
-            // @codingStandardsIgnoreLine
+            // phpcs:ignore
             $success = @file_put_contents($filename, $content, LOCK_EX);
         }
 
@@ -166,7 +166,7 @@ class Filesystem
         }
 
         $old = umask(0);
-        // @codingStandardsIgnoreLine
+        // phpcs:ignore
         if (@mkdir($dir, $mode, true) === false) {
             umask($old);
             throw new Exception(sprintf('Failed to create directory "%s"', $dir));
@@ -200,16 +200,16 @@ class Filesystem
         $result = true;
         foreach ($iterator as $fileInfo) {
             if ($fileInfo->getType() === self::TYPE_DIR) {
-                // @codingStandardsIgnoreLine
+                // phpcs:ignore
                 $result = $result && @rmdir($fileInfo->getPathname());
                 continue;
             }
 
-            // @codingStandardsIgnoreLine
+            // phpcs:ignore
             $result = $result && @unlink($fileInfo->getPathname());
         }
 
-        // @codingStandardsIgnoreLine
+        // phpcs:ignore
         $result = $result && @rmdir($path);
 
         return $result;
@@ -240,7 +240,7 @@ class Filesystem
                     $destination . DIRECTORY_SEPARATOR . $fileInfo->getFilename()
                 );
             } else {
-                // @codingStandardsIgnoreLine
+                // phpcs:ignore
                 $result = $result && @copy(
                     $fileInfo->getPathname(),
                     $destination . DIRECTORY_SEPARATOR . $fileInfo->getFilename()

+ 12 - 12
src/Filesystem/Folder.php

@@ -447,9 +447,9 @@ class Folder
         }
 
         if ($recursive === false && is_dir($path)) {
-            //@codingStandardsIgnoreStart
+            // phpcs:disable
             if (@chmod($path, intval($mode, 8))) {
-                //@codingStandardsIgnoreEnd
+                // phpcs:enable
                 $this->_messages[] = sprintf('%s changed to %s', $path, $mode);
 
                 return true;
@@ -472,9 +472,9 @@ class Folder
                         continue;
                     }
 
-                    //@codingStandardsIgnoreStart
+                    // phpcs:disable
                     if (@chmod($fullpath, intval($mode, 8))) {
-                        //@codingStandardsIgnoreEnd
+                        // phpcs:enable
                         $this->_messages[] = sprintf('%s changed to %s', $fullpath, $mode);
                     } else {
                         $this->_errors[] = sprintf('%s NOT changed to %s', $fullpath, $mode);
@@ -707,17 +707,17 @@ class Folder
             foreach ($iterator as $item) {
                 $filePath = $item->getPathname();
                 if ($item->isFile() || $item->isLink()) {
-                    //@codingStandardsIgnoreStart
+                    // phpcs:disable
                     if (@unlink($filePath)) {
-                        //@codingStandardsIgnoreEnd
+                        // phpcs:enable
                         $this->_messages[] = sprintf('%s removed', $filePath);
                     } else {
                         $this->_errors[] = sprintf('%s NOT removed', $filePath);
                     }
                 } elseif ($item->isDir() && !$item->isDot()) {
-                    //@codingStandardsIgnoreStart
+                    // phpcs:disable
                     if (@rmdir($filePath)) {
-                        //@codingStandardsIgnoreEnd
+                        // phpcs:enable
                         $this->_messages[] = sprintf('%s removed', $filePath);
                     } else {
                         $this->_errors[] = sprintf('%s NOT removed', $filePath);
@@ -728,9 +728,9 @@ class Folder
             }
 
             $path = rtrim($path, DIRECTORY_SEPARATOR);
-            //@codingStandardsIgnoreStart
+            // phpcs:disable
             if (@rmdir($path)) {
-                //@codingStandardsIgnoreEnd
+                // phpcs:enable
                 $this->_messages[] = sprintf('%s removed', $path);
             } else {
                 $this->_errors[] = sprintf('%s NOT removed', $path);
@@ -791,9 +791,9 @@ class Folder
         }
 
         $exceptions = array_merge(['.', '..', '.svn'], $options['skip']);
-        //@codingStandardsIgnoreStart
+        // phpcs:disable
         if ($handle = @opendir($fromDir)) {
-            //@codingStandardsIgnoreEnd
+            // phpcs:enable
             while (($item = readdir($handle)) !== false) {
                 $to = Folder::addPathElement($toDir, $item);
                 if (($options['scheme'] !== Folder::SKIP || !is_dir($to)) && !in_array($item, $exceptions)) {

+ 2 - 2
src/Mailer/Transport/MailTransport.php

@@ -72,12 +72,12 @@ class MailTransport extends AbstractTransport
      */
     protected function _mail(string $to, string $subject, string $message, string $headers, ?string $params = null): void
     {
-        //@codingStandardsIgnoreStart
+        // phpcs:disable
         if (!@mail($to, $subject, $message, $headers, $params)) {
             $error = error_get_last();
             $msg = 'Could not send email: ' . (isset($error['message']) ? $error['message'] : 'unknown');
             throw new SocketException($msg);
         }
-        //@codingStandardsIgnoreEnd
+        // phpcs:enable
     }
 }

+ 6 - 6
src/Network/Socket.php

@@ -88,7 +88,7 @@ class Socket
      * @var array
      */
     protected $_encryptMethods = [
-        // @codingStandardsIgnoreStart
+        // phpcs:disable
         'sslv23_client' => STREAM_CRYPTO_METHOD_SSLv23_CLIENT,
         'tls_client' => STREAM_CRYPTO_METHOD_TLS_CLIENT,
         'tlsv10_client' => STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT,
@@ -99,7 +99,7 @@ class Socket
         'tlsv10_server' => STREAM_CRYPTO_METHOD_TLSv1_0_SERVER,
         'tlsv11_server' => STREAM_CRYPTO_METHOD_TLSv1_1_SERVER,
         'tlsv12_server' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER
-        // @codingStandardsIgnoreEnd
+        // phpcs:enable
     ];
 
     /**
@@ -441,14 +441,14 @@ class Socket
         // See https://github.com/php/php-src/commit/10bc5fd4c4c8e1dd57bd911b086e9872a56300a0
         if (version_compare(PHP_VERSION, '5.6.7', '>=')) {
             if ($method === STREAM_CRYPTO_METHOD_TLS_CLIENT) {
-                // @codingStandardsIgnoreStart
+                // phpcs:disable
                 $method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
-                // @codingStandardsIgnoreEnd
+                // phpcs:enable
             }
             if ($method === STREAM_CRYPTO_METHOD_TLS_SERVER) {
-                // @codingStandardsIgnoreStart
+                // phpcs:disable
                 $method |= STREAM_CRYPTO_METHOD_TLSv1_1_SERVER | STREAM_CRYPTO_METHOD_TLSv1_2_SERVER;
-                // @codingStandardsIgnoreEnd
+                // phpcs:enable
             }
         }
 

+ 5 - 5
src/Shell/Task/AssetsTask.php

@@ -221,7 +221,7 @@ class AssetsTask extends Shell
         }
 
         if (is_link($dest)) {
-            // @codingStandardsIgnoreLine
+            // phpcs:ignore
             if (@unlink($dest)) {
                 $this->out('Unlinked ' . $dest);
 
@@ -254,9 +254,9 @@ class AssetsTask extends Shell
     protected function _createDirectory(string $dir): bool
     {
         $old = umask(0);
-        // @codingStandardsIgnoreStart
+        // phpcs:disable
         $result = @mkdir($dir, 0755, true);
-        // @codingStandardsIgnoreEnd
+        // phpcs:enable
         umask($old);
 
         if ($result) {
@@ -279,9 +279,9 @@ class AssetsTask extends Shell
      */
     protected function _createSymlink(string $target, string $link): bool
     {
-        // @codingStandardsIgnoreStart
+        // phpcs:disable
         $result = @symlink($target, $link);
-        // @codingStandardsIgnoreEnd
+        // phpcs:enable
 
         if ($result) {
             $this->out('Created symlink ' . $link);

+ 2 - 2
src/TestSuite/TestCase.php

@@ -619,7 +619,7 @@ abstract class TestCase extends BaseTestCase
         return str_replace('/', DIRECTORY_SEPARATOR, $path);
     }
 
-// @codingStandardsIgnoreStart
+// phpcs:disable
 
     /**
      * Compatibility function to test if a value is between an acceptable range.
@@ -684,7 +684,7 @@ abstract class TestCase extends BaseTestCase
         return $condition;
     }
 
-// @codingStandardsIgnoreEnd
+// phpcs:enable
 
     /**
      * Mock a model, maintain fixtures and table association

+ 4 - 4
tests/TestCase/Cache/Engine/MemcachedEngineTest.php

@@ -36,9 +36,9 @@ class MemcachedEngineTest extends TestCase
         parent::setUp();
         $this->skipIf(!class_exists('Memcached'), 'Memcached is not installed or configured properly.');
 
-        // @codingStandardsIgnoreStart
+        // phpcs:disable
         $socket = @fsockopen('127.0.0.1', 11211, $errno, $errstr, 1);
-        // @codingStandardsIgnoreEnd
+        // phpcs:enable
         $this->skipIf(!$socket, 'Memcached is not running.');
         fclose($socket);
 
@@ -374,11 +374,11 @@ class MemcachedEngineTest extends TestCase
 
         foreach ($servers as $server) {
             list($host, $port) = explode(':', $server);
-            //@codingStandardsIgnoreStart
+            // phpcs:disable
             if (!$Memcached->addServer($host, (int)$port)) {
                 $available = false;
             }
-            //@codingStandardsIgnoreEnd
+            // phpcs:enable
         }
 
         $this->skipIf(!$available, 'Need memcached servers at ' . implode(', ', $servers) . ' to run this test.');

+ 2 - 2
tests/TestCase/Cache/Engine/RedisEngineTest.php

@@ -35,9 +35,9 @@ class RedisEngineTest extends TestCase
         parent::setUp();
         $this->skipIf(!class_exists('Redis'), 'Redis extension is not installed or configured properly.');
 
-        // @codingStandardsIgnoreStart
+        // phpcs:disable
         $socket = @fsockopen('127.0.0.1', 6379, $errno, $errstr, 1);
-        // @codingStandardsIgnoreEnd
+        // phpcs:enable
         $this->skipIf(!$socket, 'Redis is not running.');
         fclose($socket);
 

+ 2 - 2
tests/TestCase/Controller/ControllerTest.php

@@ -106,7 +106,7 @@ class TestController extends ControllerTestAppController
         return 'I am from the controller.';
     }
 
-    //@codingStandardsIgnoreStart
+    // phpcs:disable
     protected function protected_m()
     {
     }
@@ -118,7 +118,7 @@ class TestController extends ControllerTestAppController
     public function _hidden()
     {
     }
-    //@codingStandardsIgnoreEnd
+    // phpcs:enable
 
     public function admin_add(): void
     {

+ 2 - 2
tests/TestCase/Error/ErrorHandlerTest.php

@@ -192,9 +192,9 @@ class ErrorHandlerTest extends TestCase
         $this->_restoreError = true;
 
         ob_start();
-        //@codingStandardsIgnoreStart
+        // phpcs:disable
         @include 'invalid.file';
-        //@codingStandardsIgnoreEnd
+        // phpcs:enable
         $result = ob_get_clean();
         $this->assertEmpty($result);
     }

+ 10 - 10
tests/TestCase/View/Helper/FormHelperTest.php

@@ -4917,7 +4917,7 @@ class FormHelperTest extends TestCase
         ]);
 
         $result = $this->Form->radio('Model.field', ['option A', 'option B']);
-        //@codingStandardsIgnoreStart
+        // phpcs:disable
         $expected = [
             ['input' => [
                 'type' => 'hidden',
@@ -4943,7 +4943,7 @@ class FormHelperTest extends TestCase
                 'option B',
             '/label',
         ];
-        //@codingStandardsIgnoreEnd
+        // phpcs:enable
         $this->assertHtml($expected, $result);
     }
 
@@ -8347,7 +8347,7 @@ class FormHelperTest extends TestCase
         $article = new Article(['comments' => [$comment]]);
         $this->Form->create([$article]);
         $result = $this->Form->control('0.comments.1.comment');
-        //@codingStandardsIgnoreStart
+        // phpcs:disable
         $expected = [
             'div' => ['class' => 'input textarea'],
                 'label' => ['for' => '0-comments-1-comment'],
@@ -8361,11 +8361,11 @@ class FormHelperTest extends TestCase
                 '/textarea',
             '/div'
         ];
-        //@codingStandardsIgnoreEnd
+        // phpcs:enable
         $this->assertHtml($expected, $result);
 
         $result = $this->Form->control('0.comments.0.comment');
-        //@codingStandardsIgnoreStart
+        // phpcs:disable
         $expected = [
             'div' => ['class' => 'input textarea'],
                 'label' => ['for' => '0-comments-0-comment'],
@@ -8380,12 +8380,12 @@ class FormHelperTest extends TestCase
                 '/textarea',
             '/div'
         ];
-        //@codingStandardsIgnoreEnd
+        // phpcs:enable
         $this->assertHtml($expected, $result);
 
         $comment->setError('comment', ['Not valid']);
         $result = $this->Form->control('0.comments.0.comment');
-        //@codingStandardsIgnoreStart
+        // phpcs:disable
         $expected = [
             'div' => ['class' => 'input textarea error'],
                 'label' => ['for' => '0-comments-0-comment'],
@@ -8404,14 +8404,14 @@ class FormHelperTest extends TestCase
                 '/div',
             '/div'
         ];
-        //@codingStandardsIgnoreEnd
+        // phpcs:enable
         $this->assertHtml($expected, $result);
 
         $this->getTableLocator()->get('Comments')
             ->getValidator('default')
             ->allowEmpty('comment', false);
         $result = $this->Form->control('0.comments.1.comment');
-        //@codingStandardsIgnoreStart
+        // phpcs:disable
         $expected = [
             'div' => ['class' => 'input textarea required'],
                 'label' => ['for' => '0-comments-1-comment'],
@@ -8428,7 +8428,7 @@ class FormHelperTest extends TestCase
                 '/textarea',
             '/div'
         ];
-        //@codingStandardsIgnoreEnd
+        // phpcs:enable
         $this->assertHtml($expected, $result);
     }
 

+ 2 - 2
tests/bootstrap.php

@@ -47,13 +47,13 @@ define('APP', TEST_APP . 'TestApp' . DS);
 define('WWW_ROOT', TEST_APP . 'webroot' . DS);
 define('CONFIG', TEST_APP . 'config' . DS);
 
-//@codingStandardsIgnoreStart
+// phpcs:disable
 @mkdir(LOGS);
 @mkdir(SESSIONS);
 @mkdir(CACHE);
 @mkdir(CACHE . 'views');
 @mkdir(CACHE . 'models');
-//@codingStandardsIgnoreEnd
+// phpcs:enable
 
 require_once CORE_PATH . 'config/bootstrap.php';
 

+ 2 - 2
tests/test_app/TestApp/Shell/ShellTestShell.php

@@ -61,7 +61,7 @@ class ShellTestShell extends Shell
     {
     }
 
-    //@codingStandardsIgnoreStart
+    // phpcs:disable
     public function doSomething()
     {
     }
@@ -74,5 +74,5 @@ class ShellTestShell extends Shell
     {
         $this->log($this->testMessage);
     }
-    //@codingStandardsIgnoreEnd
+    // phpcs:enable
 }