Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuperfluousPhpdocTagsFixer - Causing error during fix run #3953

Closed
jaydiablo opened this issue Jul 31, 2018 · 1 comment
Closed

NoSuperfluousPhpdocTagsFixer - Causing error during fix run #3953

jaydiablo opened this issue Jul 31, 2018 · 1 comment
Labels

Comments

@jaydiablo
Copy link
Contributor

The PHP version you are using ($ php -v):

7.2.8

PHP CS Fixer version you are using ($ php-cs-fixer -V):

2.12.2 (have also tested against dev-master)

The command you use to run PHP CS Fixer:

./vendor/bin/php-cs-fixer fix config.php

The configuration file you are using, if any:

<?php

return PhpCsFixer\Config::create()
    ->setRules([
        'no_superfluous_phpdoc_tags' => true,
    ]);

If applicable, please provide minimum samples of PHP code (as plain text, not screenshots):

  • before running PHP CS Fixer (no changes):
<?php
/**
 * Configuration for "min", the default application built with the Minify
 * library
 *
 * @package Minify
 */


/**
 * Enable the static serving feature
 */
$min_enableStatic = false;


/**
 * Allow use of the Minify URI Builder app. Only set this to true while you need it.
 */
$min_enableBuilder = false;


/**
 * Concatenate but do not minify the files. This can be used for testing.
 */
$min_concatOnly = false;


/**
 * If non-empty, the Builder will be protected with HTTP Digest auth.
 * The username is "admin".
 */
$min_builderPassword = 'admin';


/**
 * Set to true to log messages to FirePHP (Firefox Firebug addon) and PHP's error_log
 * Set to false for no error logging (Minify may be slightly faster).
 */
$min_errorLogger = false;


/**
 * To allow debug mode output, you must set this option to true.
 *
 * Once true, you can send the cookie minDebug to request debug mode output. The
 * cookie value should match the URIs you'd like to debug. E.g. to debug
 * /min/f=file1.js send the cookie minDebug=file1.js
 * You can manually enable debugging by appending "&debug" to a URI.
 * E.g. /min/?f=script1.js,script2.js&debug
 *
 * In 'debug' mode, Minify combines files with no minification and adds comments
 * to indicate line #s of the original files.
 */
$min_allowDebugFlag = false;


/**
 * For best performance, specify your temp directory here. Otherwise Minify
 * will have to load extra code to guess. Some examples below:
 */
//$min_cachePath = 'c:\\WINDOWS\\Temp';
$min_cachePath = '/tmp';
//$min_cachePath = preg_replace('/^\\d+;/', '', session_save_path());


/**
 * To use APC/Memcache/ZendPlatform for cache storage, require the class and
 * set $min_cachePath to an instance. Example below:
 */
$min_cachePath = new Minify_Cache_APC();


/**
 * Leave an empty string to use PHP's $_SERVER['DOCUMENT_ROOT'].
 *
 * On some servers, this value may be misconfigured or missing. If so, set this
 * to your full document root path with no trailing slash.
 * E.g. '/home/accountname/public_html' or 'c:\\xampp\\htdocs'
 *
 * If /min/ is directly inside your document root, just uncomment the
 * second line. The third line might work on some Apache servers.
 */
$min_documentRoot = '';
//$min_documentRoot = dirname(dirname(__DIR__));
//$min_documentRoot = substr(__FILE__, 0, -15);
//$min_documentRoot = $_SERVER['SUBDOMAIN_DOCUMENT_ROOT'];


/**
 * Cache file locking. Set to false if filesystem is NFS. On at least one
 * NFS system flock-ing attempts stalled PHP for 30 seconds!
 */
$min_cacheFileLocking = true;


/**
 * Combining multiple CSS files can place @import declarations after rules, which
 * is invalid. Minify will attempt to detect when this happens and place a
 * warning comment at the top of the CSS output. To resolve this you can either
 * move the @imports within your CSS files, or enable this option, which will
 * move all @imports to the top of the output. Note that moving @imports could
 * affect CSS values (which is why this option is disabled by default).
 */
$min_serveOptions['bubbleCssImports'] = false;


/**
 * Cache-Control: max-age value sent to browser (in seconds). After this period,
 * the browser will send another conditional GET. Use a longer period for lower
 * traffic but you may want to shorten this before making changes if it's crucial
 * those changes are seen immediately.
 *
 * Note: Despite this setting, if you include a number at the end of the
 * querystring, maxAge will be set to one year. E.g. /min/f=hello.css&123456
 */
$min_serveOptions['maxAge'] = 1800;


/**
 * To use the CSS compressor that shipped with 2.x, uncomment the following line:
 */
//$min_serveOptions['minifiers'][Minify::TYPE_CSS] = array('Minify_CSS', 'minify');


/**
 * To use Google's Closure Compiler API to minify Javascript (falling back to JSMin
 * on failure), uncomment the following line:
 */
//$min_serveOptions['minifiers']['application/x-javascript'] = array('Minify_JS_ClosureCompiler', 'minify');


/**
 * If you'd like to restrict the "f" option to files within/below
 * particular directories below DOCUMENT_ROOT, set this here.
 * You will still need to include the directory in the
 * f or b GET parameters.
 *
 * // = shortcut for DOCUMENT_ROOT
 */
//$min_serveOptions['minApp']['allowDirs'] = array('//js', '//css');

/**
 * Set to true to disable the "f" GET parameter for specifying files.
 * Only the "g" parameter will be considered.
 */
$min_serveOptions['minApp']['groupsOnly'] = false;


/**
 * By default, Minify will not minify files with names containing .min or -min
 * before the extension. E.g. myFile.min.js will not be processed by JSMin
 *
 * To minify all files, set this option to null. You could also specify your
 * own pattern that is matched against the filename.
 */
//$min_serveOptions['minApp']['noMinPattern'] = '@[-\\.]min\\.(?:js|css)$@i';


/**
 * If you minify CSS files stored in symlink-ed directories, the URI rewriting
 * algorithm can fail. To prevent this, provide an array of link paths to
 * target paths, where the link paths are within the document root.
 *
 * Because paths need to be normalized for this to work, use "//" to substitute
 * the doc root in the link paths (the array keys). E.g.:
 * <code>
 * array('//symlink' => '/real/target/path') // unix
 * array('//static' => 'D:\\staticStorage')  // Windows
 * </code>
 */
$min_symlinks = [];


/**
 * If you upload files from Windows to a non-Windows server, Windows may report
 * incorrect mtimes for the files. This may cause Minify to keep serving stale
 * cache files when source file changes are made too frequently (e.g. more than
 * once an hour).
 *
 * Immediately after modifying and uploading a file, use the touch command to
 * update the mtime on the server. If the mtime jumps ahead by a number of hours,
 * set this variable to that number. If the mtime moves back, this should not be
 * needed.
 *
 * In the Windows SFTP client WinSCP, there's an option that may fix this
 * issue without changing the variable below. Under login > environment,
 * select the option "Adjust remote timestamp with DST".
 * @link http://winscp.net/eng/docs/ui_login_environment#daylight_saving_time
 */
$min_uploaderHoursBehind = 0;


/**
 * Advanced: you can replace some of the PHP classes Minify uses to serve requests.
 * To do this, assign a callable to one of the elements of the $min_factories array.
 *
 * You can see the default implementations (and what gets passed in) in index.php.
 */
//$min_factories['minify'] = ... a callable accepting a Minify\App object
//$min_factories['controller'] = ... a callable accepting a Minify\App object

That file is config.php that I'm telling the fixer to run against. It comes from this project: https://github.com/mrclay/minify/blob/master/config.php but with minor modifications for our environment.

PHP-CS-Fixer emits this message when processing this file with this fixer:

Files that were not fixed due to errors reported during fixing:
   1) config.php

With -vvv, I get this message:

Files that were not fixed due to errors reported during fixing:
   1) config.php

        [RuntimeException]
        Index invalid or out of range

      PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer->findDocumentedFunction()
        in vendor/friendsofphp/php-cs-fixer/src/Fixer/Phpdoc/NoSuperfluousPhpdocTagsFixer.php at line 94
      PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer->applyFix()
        in vendor/friendsofphp/php-cs-fixer/src/AbstractFixer.php at line 75
      PhpCsFixer\AbstractFixer->fix()
        in vendor/friendsofphp/php-cs-fixer/src/Runner/Runner.php at line 190
      PhpCsFixer\Runner\Runner->fixFile()
        in vendor/friendsofphp/php-cs-fixer/src/Runner/Runner.php at line 132
      PhpCsFixer\Runner\Runner->fix()
        in vendor/friendsofphp/php-cs-fixer/src/Console/Command/FixCommand.php at line 220
      PhpCsFixer\Console\Command\FixCommand->execute()
        in vendor/symfony/console/Command/Command.php at line 251
      [ ... ]

PHP doesn't complain about this file (with php -l config.php) and if I remove that particular fixer all is good.

@SpacePossum
Copy link
Contributor

Thanks for reporting @jaydiablo 👍
@kubawerlos put together a fix which will be part of the next release for this bug in the fixer

keradus added a commit that referenced this issue Aug 1, 2018
…e (kubawerlos)

This PR was squashed before being merged into the 2.12 branch (closes #3954).

Discussion
----------

NoSuperfluousPhpdocTagsFixer - Index invalid or out of range

Fixes #3953

Commits
-------

b511032 NoSuperfluousPhpdocTagsFixer - Index invalid or out of range
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants