Skip to content

Commit 630cf52

Browse files
committed
ADD TO: publish action / auto-generate table of contents
1 parent 16c790f commit 630cf52

11 files changed

+32
-200
lines changed

.github/workflows/publish-wiki.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,16 @@ jobs:
3535
- name: Checkout code
3636
uses: actions/checkout@v4
3737

38+
- name: Install DocToc table of contents generator
39+
run: npm install -g doctoc
40+
3841
- name: Copy wiki files to temporary location
3942
shell: bash
4043
run: cp -v -a wiki _wiki
4144

45+
- name: Update tables of contents
46+
run: doctoc ./_wiki/ --github --maxlevel 4 --update-only
47+
4248
- name: Deploy to wiki
4349
uses: Andrew-Chen-Wang/github-wiki-action@v4
4450
with:

wiki/About-Standards-for-PHP_CodeSniffer.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
## Table of contents
22

3-
* [A Project ruleset or a standard ?](#a-project-ruleset-or-a-standard-)
4-
* [How does PHP_CodeSniffer determine which standard or ruleset to apply ?](#how-does-php_codesniffer-determine-which-standard-or-ruleset-to-apply-)
5-
* [About standards](#about-standards)
6-
* [Creating an external standard for PHP_CodeSniffer](#creating-an-external-standard-for-php_codesniffer)
7-
* [Creating new rules](#creating-new-rules)
8-
* [Naming conventions](#naming-conventions)
9-
* [1. Directory structure](#1-directory-structure)
10-
* [2. Sniff file name](#2-sniff-file-name)
11-
* [3. Namespace and class name](#3-namespace-and-class-name)
12-
* [Examples](#examples)
3+
<!-- START doctoc -->
4+
<!-- END doctoc -->
135

146
***
157

wiki/Advanced-Usage.md

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
11
## Table of contents
22

3-
* [Specifying Valid File Extensions](#specifying-valid-file-extensions)
4-
* [Ignoring Files and Folders](#ignoring-files-and-folders)
5-
* [Ignoring Parts of a File](#ignoring-parts-of-a-file)
6-
* [Limiting Results to Specific Sniffs](#limiting-results-to-specific-sniffs)
7-
* [Filtering Errors and Warnings Based on Severity](#filtering-errors-and-warnings-based-on-severity)
8-
* [Replacing Tabs with Spaces](#replacing-tabs-with-spaces)
9-
* [Specifying an Encoding](#specifying-an-encoding)
10-
* [Using a Bootstrap File](#using-a-bootstrap-file)
11-
* [Using a Default Configuration File](#using-a-default-configuration-file)
12-
* [Specifying php.ini Settings](#specifying-phpini-settings)
13-
* [Setting Configuration Options](#setting-configuration-options)
14-
* [Deleting Configuration Options](#deleting-configuration-options)
15-
* [Viewing Configuration Options](#viewing-configuration-options)
16-
* [Printing Verbose Tokeniser Output](#printing-verbose-tokeniser-output)
17-
* [The Scope Map](#the-scope-map)
18-
* [The Level Map](#the-level-map)
19-
* [Printing Verbose Token Processing Output](#printing-verbose-token-processing-output)
20-
* [Quieting Output](#quieting-output)
21-
* [Understanding the Exit Codes](#understanding-the-exit-codes)
3+
<!-- START doctoc -->
4+
<!-- END doctoc -->
225

236
***
247

wiki/Configuration-Options.md

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,7 @@
11
## Table of contents
22

3-
* [Setting the default coding standard](#setting-the-default-coding-standard)
4-
* [Setting the default report format](#setting-the-default-report-format)
5-
* [Hiding warnings by default](#hiding-warnings-by-default)
6-
* [Showing progress by default](#showing-progress-by-default)
7-
* [Using colors in output by default](#using-colors-in-output-by-default)
8-
* [Changing the default severity levels](#changing-the-default-severity-levels)
9-
* [Setting the default report width](#setting-the-default-report-width)
10-
* [Setting the default encoding](#setting-the-default-encoding)
11-
* [Setting the default tab width](#setting-the-default-tab-width)
12-
* [Setting the installed standard paths](#setting-the-installed-standard-paths)
13-
* [Setting the PHP version](#setting-the-php-version)
14-
* [Ignoring errors when generating the exit code](#ignoring-errors-when-generating-the-exit-code)
15-
* [Ignoring warnings when generating the exit code](#ignoring-warnings-when-generating-the-exit-code)
16-
* [Ignoring non-auto-fixable issues when generating the exit code (PHP_CodeSniffer >= 4.0.0)](#ignoring-non-auto-fixable-issues-when-generating-the-exit-code-php_codesniffer--400)
17-
* Setting tool paths
18-
* [CSSLint](#setting-the-path-to-csslint)
19-
* [Google Closure Linter](#setting-the-path-to-the-google-closure-linter)
20-
* [PHP](#setting-the-path-to-php)
21-
* [JSHint](#setting-the-path-to-jshint)
22-
* [JSLint](#setting-the-path-to-jslint)
23-
* [JavaScript Lint](#setting-the-path-to-javascript-lint)
24-
* [Zend Code Analyzer](#setting-the-path-to-the-zend-code-analyzer)
3+
<!-- START doctoc -->
4+
<!-- END doctoc -->
255

266
***
277

wiki/Customisable-Sniff-Properties.md

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4,70 +4,8 @@ For more information about changing sniff behaviour by customising your ruleset,
44

55
## Table of contents
66

7-
* [Generic Sniffs](#generic-sniffs)
8-
* [Generic.Arrays.ArrayIndent](#genericarraysarrayindent)
9-
* [Generic.CodeAnalysis.UnusedFunctionParameter](#genericcodeanalysisunusedfunctionparameter)
10-
* [Generic.ControlStructures.InlineControlStructure](#genericcontrolstructuresinlinecontrolstructure)
11-
* [Generic.Debug.ClosureLinter](#genericdebugclosurelinter)
12-
* [Generic.Debug.ESLint](#genericdebugeslint)
13-
* [Generic.Files.LineEndings](#genericfileslineendings)
14-
* [Generic.Files.LineLength](#genericfileslinelength)
15-
* [Generic.Formatting.MultipleStatementAlignment](#genericformattingmultiplestatementalignment)
16-
* [Generic.Formatting.SpaceAfterCast](#genericformattingspaceaftercast)
17-
* [Generic.Formatting.SpaceAfterNot](#genericformattingspaceafternot)
18-
* [Generic.Functions.OpeningFunctionBraceBsdAllman](#genericfunctionsopeningfunctionbracebsdallman)
19-
* [Generic.Functions.OpeningFunctionBraceKernighanRitchie](#genericfunctionsopeningfunctionbracekernighanritchie)
20-
* [Generic.Metrics.CyclomaticComplexity](#genericmetricscyclomaticcomplexity)
21-
* [Generic.Metrics.NestingLevel](#genericmetricsnestinglevel)
22-
* [Generic.NamingConventions.CamelCapsFunctionName](#genericnamingconventionscamelcapsfunctionname)
23-
* [Generic.PHP.ForbiddenFunctions](#genericphpforbiddenfunctions)
24-
* [Generic.PHP.NoSilencedErrors](#genericphpnosilencederrors)
25-
* [Generic.Strings.UnnecessaryStringConcat](#genericstringsunnecessarystringconcat)
26-
* [Generic.WhiteSpace.ArbitraryParenthesesSpacing](#genericwhitespacearbitraryparenthesesspacing)
27-
* [Generic.WhiteSpace.ScopeIndent](#genericwhitespacescopeindent)
28-
* [Generic.WhiteSpace.SpreadOperatorSpacingAfter](#genericwhitespacespreadoperatorspacingafter)
29-
* [PEAR Sniffs](#pear-sniffs)
30-
* [PEAR.Commenting.FunctionComment](#pearcommentingfunctioncomment)
31-
* [PEAR.ControlStructures.ControlSignature](#pearcontrolstructurescontrolsignature)
32-
* [PEAR.ControlStructures.MultiLineCondition](#pearcontrolstructuresmultilinecondition)
33-
* [PEAR.Formatting.MultiLineAssignment](#pearformattingmultilineassignment)
34-
* [PEAR.Functions.FunctionCallSignature](#pearfunctionsfunctioncallsignature)
35-
* [PEAR.Functions.FunctionDeclaration](#pearfunctionsfunctiondeclaration)
36-
* [PEAR.WhiteSpace.ObjectOperatorIndent](#pearwhitespaceobjectoperatorindent)
37-
* [PEAR.WhiteSpace.ScopeClosingBrace](#pearwhitespacescopeclosingbrace)
38-
* [PEAR.WhiteSpace.ScopeIndent](#pearwhitespacescopeindent)
39-
* [PSR2 Sniffs](#psr2-sniffs)
40-
* [PSR2.Classes.ClassDeclaration](#psr2classesclassdeclaration)
41-
* [PSR2.ControlStructures.ControlStructureSpacing](#psr2controlstructurescontrolstructurespacing)
42-
* [PSR2.ControlStructures.SwitchDeclaration](#psr2controlstructuresswitchdeclaration)
43-
* [PSR2.Methods.FunctionCallSignature](#psr2methodsfunctioncallsignature)
44-
* [PSR12 Sniffs](#psr12-sniffs)
45-
* [PSR12.Classes.AnonClassDeclaration](#psr12classesanonclassdeclaration)
46-
* [PSR12.ControlStructures.BooleanOperatorPlacement](#psr12controlstructuresbooleanoperatorplacement)
47-
* [PSR12.ControlStructures.ControlStructureSpacing](#psr12controlstructurescontrolstructurespacing)
48-
* [PSR12.Namespaces.CompoundNamespaceDepth](#psr12namespacescompoundnamespacedepth)
49-
* [PSR12.Operators.OperatorSpacing](#psr12operatorsoperatorspacing)
50-
* [Squiz Sniffs](#squiz-sniffs)
51-
* [Squiz.Classes.ClassDeclaration](#squizclassesclassdeclaration)
52-
* [Squiz.Commenting.FunctionComment](#squizcommentingfunctioncomment)
53-
* [Squiz.Commenting.LongConditionClosingComment](#squizcommentinglongconditionclosingcomment)
54-
* [Squiz.ControlStructures.ControlSignature](#squizcontrolstructurescontrolsignature)
55-
* [Squiz.ControlStructures.ForEachLoopDeclaration](#squizcontrolstructuresforeachloopdeclaration)
56-
* [Squiz.ControlStructures.ForLoopDeclaration](#squizcontrolstructuresforloopdeclaration)
57-
* [Squiz.ControlStructures.SwitchDeclaration](#squizcontrolstructuresswitchdeclaration)
58-
* [Squiz.CSS.ForbiddenStyles](#squizcssforbiddenstyles)
59-
* [Squiz.CSS.Indentation](#squizcssindentation)
60-
* [Squiz.Functions.FunctionDeclaration](#squizfunctionsfunctiondeclaration)
61-
* [Squiz.Functions.FunctionDeclarationArgumentSpacing](#squizfunctionsfunctiondeclarationargumentspacing)
62-
* [Squiz.PHP.CommentedOutCode](#squizphpcommentedoutcode)
63-
* [Squiz.PHP.DiscouragedFunctions](#squizphpdiscouragedfunctions)
64-
* [Squiz.PHP.ForbiddenFunctions](#squizphpforbiddenfunctions)
65-
* [Squiz.Strings.ConcatenationSpacing](#squizstringsconcatenationspacing)
66-
* [Squiz.WhiteSpace.FunctionSpacing](#squizwhitespacefunctionspacing)
67-
* [Squiz.WhiteSpace.MemberVarSpacing](#squizwhitespacemembervarspacing)
68-
* [Squiz.WhiteSpace.ObjectOperatorSpacing](#squizwhitespaceobjectoperatorspacing)
69-
* [Squiz.WhiteSpace.OperatorSpacing](#squizwhitespaceoperatorspacing)
70-
* [Squiz.WhiteSpace.SuperfluousWhitespace](#squizwhitespacesuperfluouswhitespace)
7+
<!-- START doctoc -->
8+
<!-- END doctoc -->
719

7210
***
7311

wiki/FAQ.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
## Table of contents
22

3-
* [Does PHP_CodeSniffer perform any code coverage or unit testing?](#does-php_codesniffer-perform-any-code-coverage-or-unit-testing)
4-
* [My code is fine! Why do I need PHP_CodeSniffer?](#my-code-is-fine-why-do-i-need-php_codesniffer)
5-
* [Does PHP_CodeSniffer parse my code to ensure it will execute?](#does-php_codesniffer-parse-my-code-to-ensure-it-will-execute)
6-
* [I don't agree with your coding standards! Can I make PHP_CodeSniffer enforce my own?](#i-dont-agree-with-your-coding-standards-can-i-make-php_codesniffer-enforce-my-own)
7-
* [How come PHP_CodeSniffer reported errors, I fixed them, now I get even more?](#how-come-php_codesniffer-reported-errors-i-fixed-them-now-i-get-even-more)
8-
* [What does PHP_CodeSniffer use to tokenize my code?](#what-does-php_codesniffer-use-to-tokenize-my-code)
3+
<!-- START doctoc -->
4+
<!-- END doctoc -->
95

106
***
117

wiki/Fixing-Errors-Automatically.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
## Table of contents
22

3-
* [About Automatic Fixing](#about-automatic-fixing)
4-
* [Using the PHP Code Beautifier and Fixer](#using-the-php-code-beautifier-and-fixer)
5-
* [Viewing Debug Information](#viewing-debug-information)
3+
<!-- START doctoc -->
4+
<!-- END doctoc -->
65

76
***
87

wiki/Usage.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
## Table of contents
22

3-
* [Getting Help from the Command Line](#getting-help-from-the-command-line)
4-
* [Checking Files and Folders](#checking-files-and-folders)
5-
* [Printing a Summary Report](#printing-a-summary-report)
6-
* [Printing Progress Information](#printing-progress-information)
7-
* [Specifying a Coding Standard](#specifying-a-coding-standard)
8-
* [Printing a List of Installed Coding Standards](#printing-a-list-of-installed-coding-standards)
9-
* [Listing Sniffs Inside a Coding Standard](#listing-sniffs-inside-a-coding-standard)
3+
<!-- START doctoc -->
4+
<!-- END doctoc -->
105

116
***
127

wiki/Version-3.0-Upgrade-Guide.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,8 @@ PHP_CodeSniffer version 3 contains a large number of core changes and breaks bac
77

88
## Table of contents
99

10-
* [Upgrading Custom Sniffs](#upgrading-custom-sniffs)
11-
* [Extending Other Sniffs](#extending-other-sniffs)
12-
* [Extending the Included Abstract Sniffs](#extending-the-included-abstract-sniffs)
13-
* [AbstractVariableSniff](#abstractvariablesniff)
14-
* [AbstractPatternSniff](#abstractpatternsniff)
15-
* [AbstractScopeSniff](#abstractscopesniff)
16-
* [New Class Names](#new-class-names)
17-
* [PHP_CodeSniffer_File](#php_codesniffer_file)
18-
* [PHP_CodeSniffer_Tokens](#php_codesniffer_tokens)
19-
* [PHP_CodeSniffer](#php_codesniffer)
20-
* [Upgrading Unit Tests](#upgrading-unit-tests)
21-
* [Setting CLI Values](#setting-cli-values)
22-
* [Upgrading Custom Reports](#upgrading-custom-reports)
23-
* [Supporting Concurrency](#supporting-concurrency)
10+
<!-- START doctoc -->
11+
<!-- END doctoc -->
2412

2513
***
2614

wiki/Version-4.0-Developer-Upgrade-Guide.md

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,10 @@ There is a separate [[Upgrade Guide for Ruleset Maintainers and End-Users|Versio
1414

1515
## Table of contents
1616

17-
* [Should I upgrade ?](#should-i-upgrade-)
18-
* [Upgrade strategies](#upgrade-strategies)
19-
* [Upgrading the ruleset.xml file](#upgrading-the-rulesetxml-file)
20-
* [Upgrading Standards](#upgrading-standards)
21-
* [Support for external standards named "Internal" has been removed](#support-for-external-standards-named-internal-has-been-removed)
22-
* [Upgrading Custom Sniffs](#upgrading-custom-sniffs)
23-
* [Sniffs need to comply with the naming conventions](#sniffs-need-to-comply-with-the-naming-conventions)
24-
* [Sniffs must implement the `PHP_CodeSniffer\Sniffs\Sniff` interface](#sniffs-must-implement-the-php_codesniffersniffssniff-interface)
25-
* [Support for JS/CSS has been removed](#support-for-jscss-has-been-removed)
26-
* [Property type casting has been made more consistent](#property-type-casting-has-been-made-more-consistent)
27-
* [Changed Methods](#changed-methods)
28-
* [File::getDeclarationName()](#filegetdeclarationname)
29-
* [File::getMemberProperties()](#filegetmemberproperties)
30-
* [Config::setConfigData() is no longer static](#configsetconfigdata-is-no-longer-static)
31-
* [Tokens class changes](#tokens-class-changes)
32-
* [Token arrays are now class constants](#token-arrays-are-now-class-constants)
33-
* [Removed Tokens](#removed-tokens)
34-
* [Tokenizer Changes](#tokenizer-changes)
35-
* [T_USE (for closures), T_ISSET, T_UNSET, T_EMPTY, T_EVAL, T_EXIT are parenthesis owners](#t_use-for-closures-t_isset-t_unset-t_empty-t_eval-t_exit-are-parenthesis-owners)
36-
* [Namespaced Names](#namespaced-names)
37-
* [T_STATIC](#t_static)
38-
* [T_OPEN_TAG](#t_open_tag)
39-
* [`goto`](#goto)
40-
* [Other Tokenizer Changes](#other-tokenizer-changes)
41-
* [Changes to abstract sniffs](#changes-to-abstract-sniffs)
42-
* [Changes to PHPCS native sniffs](#changes-to-phpcs-native-sniffs)
43-
* [Various sniffs listen to fewer tokens](#various-sniffs-listen-to-fewer-tokens)
44-
* [PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\SelfMemberReferenceSniff](#php_codesnifferstandardssquizsniffsclassesselfmemberreferencesniff)
45-
* [Miscellaneous other changes which may affect code extending PHP_CodeSniffer](#miscellaneous-other-changes-which-may-affect-code-extending-php_codesniffer)
46-
* [Unit Tests](#unit-tests)
47-
* [For standards using their own test framework](#for-standards-using-their-own-test-framework)
48-
* [For standards using the PHPCS native test framework](#for-standards-using-the-phpcs-native-test-framework)
17+
<!-- START doctoc -->
18+
<!-- END doctoc -->
19+
20+
***
4921

5022
## Should I upgrade ?
5123

@@ -517,12 +489,12 @@ The `protected` `getDeclarationNameWithNamespace()` and `getNamespaceOfScope()`
517489
* The `PHP_CodeSniffer\Reporter::$totalFixable` and `Reporter::$totalFixed` properties are deprecated and should no longer be used.
518490
Use respectively `(Reporter::$totalFixableErrors + Reporter::$totalFixableWarnings)` and `(Reporter::$totalFixedErrors + Reporter::$totalFixedWarnings)` instead.
519491

520-
* `PHP_CodeSniffer\Ruleset::setSniffProperty()`: the BC-layer supporting the old array format for the `$settings` parameter for the method has been removed.
492+
* `PHP_CodeSniffer\Ruleset::setSniffProperty()`: the BC-layer supporting the old array format for the `$settings` parameter for the method has been removed.
521493
The `$settings` parameter must be passed as an array with the following two keys: `'scope'` and `'value'`, with `'scope'` being set to either `'sniff'` or `'standard'`, and `'value'` containing the new property value.
522494
Also see [squizlabs/PHP_CodeSniffer#3629](https://github.com/squizlabs/PHP_CodeSniffer/pull/3629).
523495

524496
* Various class properties have been replaced with class constants. Where these were in the public API (= the below list), the properties still exist, but are now (soft) deprecated and will be removed in PHP_CodeSniffer 5.0.
525-
The visibility of the (deprecated) properties and their class constant replacements is the same.
497+
The visibility of the (deprecated) properties and their class constant replacements is the same.
526498
If you previously overloaded one of these properties in a custom sniff extending one of the affected sniffs, you will now need to overload the class constant.
527499
To obtain cross-version compatibility with PHPCS 3.x as well as 4.x, you may need to overload both the property as well as the constant.
528500

0 commit comments

Comments
 (0)