diff --git a/.github/workflows/wordpress.yml b/.github/workflows/wordpress.yml index fe15669..8373814 100644 --- a/.github/workflows/wordpress.yml +++ b/.github/workflows/wordpress.yml @@ -2,8 +2,6 @@ name: Library CI/CD on: push: - branches: - - master tags: - '*' pull_request: @@ -11,15 +9,15 @@ on: - master jobs: - test: - strategy: - matrix: - php: [ '7.4', '8.0' ] # PHP versions to check. - wp: [ 'latest', '5.9' ] # WordPress version to check. - uses: tarosky/workflows/.github/workflows/wp-unit-test.yml@main - with: - php_version: ${{ matrix.php }} - wp_version: ${{ matrix.wp }} +# test: +# strategy: +# matrix: +# php: [ '7.4', '8.0' ] # PHP versions to check. +# wp: [ 'latest', '5.9' ] # WordPress version to check. +# uses: tarosky/workflows/.github/workflows/wp-unit-test.yml@main +# with: +# php_version: ${{ matrix.php }} +# wp_version: ${{ matrix.wp }} phpcs: name: PHP Syntax check @@ -29,8 +27,10 @@ jobs: status-check: name: Status Check - needs: [ test, phpcs ] + if: always() + needs: [ phpcs ] runs-on: ubuntu-latest steps: - - name: Display Status - run: echo "All Green!" + - uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} diff --git a/composer.json b/composer.json index 88495ee..11bed21 100644 --- a/composer.json +++ b/composer.json @@ -22,11 +22,8 @@ }, "require-dev": { "phpunit/phpunit": ">5.7", - "squizlabs/php_codesniffer": "^3.7", - "wp-coding-standards/wpcs": "^2.3", - "yoast/phpunit-polyfills": "^2.0", - "phpcompatibility/php-compatibility": "^9.3", - "dealerdirect/phpcodesniffer-composer-installer": "^1.0" + "wp-coding-standards/wpcs": "^3.0", + "yoast/phpunit-polyfills": "^2.0" }, "autoload": { "psr-0": { diff --git a/phpcs.ruleset.xml b/phpcs.ruleset.xml index 12df84f..3aa16ba 100644 --- a/phpcs.ruleset.xml +++ b/phpcs.ruleset.xml @@ -23,11 +23,8 @@ - - - - - + a + */node_modules/* diff --git a/src/Kunoichi/TocGenerator/Parser.php b/src/Kunoichi/TocGenerator/Parser.php index 81e5a9a..9268830 100644 --- a/src/Kunoichi/TocGenerator/Parser.php +++ b/src/Kunoichi/TocGenerator/Parser.php @@ -62,7 +62,7 @@ public function add_link_html( $html ) { * @return string */ protected function convert_link( $matches ) { - $this->counter++; + ++$this->counter; $attributes = $matches[2]; if ( preg_match( '/id=\'|"([\'"]*)(\'|")/u', $matches[2], $id_matches ) ) { $id = $id_matches[1]; @@ -166,7 +166,7 @@ public function get_toc( $items = [], $class_name = 'toc' ) { $out .= sprintf( '
  • ', $bench_mark - $level ); $out .= $item->get_markup(); $prev = $level; - $counter++; + ++$counter; } $last_diff = $bench_mark - $prev; if ( 0 > $last_diff ) { diff --git a/src/Kunoichi/TocGenerator/WpItem.php b/src/Kunoichi/TocGenerator/WpItem.php index 26c543b..ef1219a 100644 --- a/src/Kunoichi/TocGenerator/WpItem.php +++ b/src/Kunoichi/TocGenerator/WpItem.php @@ -38,9 +38,9 @@ public function get_markup() { $url = get_permalink(); } else { if ( ! get_option( 'permalink_structure' ) || in_array( get_post_status(), array( - 'draft', - 'pending' - ), true ) ) { + 'draft', + 'pending', + ), true ) ) { $url = add_query_arg( 'page', $item_page, get_permalink() ); } elseif ( 'page' === get_option( 'show_on_front' ) && (int) get_option( 'page_on_front' ) === get_the_ID() ) { $url = trailingslashit( get_permalink() ) . user_trailingslashit( "$wp_rewrite->pagination_base/" . $item_page, 'single_paged' ); diff --git a/src/Kunoichi/TocGenerator/WpParser.php b/src/Kunoichi/TocGenerator/WpParser.php index 3f34513..9e7e71a 100644 --- a/src/Kunoichi/TocGenerator/WpParser.php +++ b/src/Kunoichi/TocGenerator/WpParser.php @@ -77,7 +77,7 @@ public function add_link_html( $html ) { $this->page_counter = 0; foreach ( $contents as $content ) { $this->counter = 0; - $this->page_counter ++; + ++$this->page_counter; $replaced_html .= preg_replace_callback( '/<(h[1-6])([^>]*?)>/u', [ $this, 'convert_link' ], $content ); } @@ -95,12 +95,12 @@ public function add_link_html( $html ) { * @return string */ protected function convert_link( $matches ) { - $this->counter ++; + ++$this->counter; $attributes = $matches[2]; if ( preg_match( '/id=\'|"([\'"]*)(\'|")/u', $matches[2], $id_matches ) ) { $id = $id_matches[1]; } else { - $id = sprintf( '%s%d', $this->id_prefix, $this->counter ); + $id = sprintf( '%s%d', $this->id_prefix, $this->counter ); $attributes .= sprintf( ' id="%s"', $id ) . $matches[2]; } // Add an attribute for the page number.