Skip to content

Commit 188df5a

Browse files
committed
Repo updates and maintenance
1 parent 1fa48dc commit 188df5a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+473
-367
lines changed

.gitattributes

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
# Exclude these files from release archives.
33
#
44
# This will also make the files unavailable when using Composer with `--prefer-dist`.
5-
# If you develop using Composer, use `--prefer-source`.
65
#
76
# Via WPCS.
87
#
98
/.github export-ignore
10-
/.php-cs-fixer.dist.php export-ignore
11-
/phpcs.xml export-ignore
9+
/.phpcs.xml export-ignore
10+
/.phpcs export-ignore
1211
/phpunit.xml export-ignore
1312
/tests export-ignore
13+
/configure.php export-ignore
14+
/Makefile export-ignore
1415

1516
#
1617
# Auto detect text files and perform LF normalization.

.github/workflows/all-pr-tests.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "All Pull Request Tests"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types: [opened, synchronize, reopened, ready_for_review]
8+
9+
jobs:
10+
# We use a single job to ensure that all steps run in the same environment and
11+
# reduce the number of minutes used.
12+
pr-tests:
13+
# Don't run on draft PRs
14+
if: github.event.pull_request.draft == false
15+
# Timeout after 10 minutes
16+
timeout-minutes: 10
17+
# Define a matrix of PHP/WordPress versions to test against
18+
strategy:
19+
matrix:
20+
php: [8.2, 8.3]
21+
wordpress: ["latest"]
22+
runs-on: ubuntu-latest
23+
# Cancel any existing runs of this workflow
24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}-P${{ matrix.php }}-WP${{ matrix.wordpress }}
26+
cancel-in-progress: true
27+
# Name the job in the matrix
28+
name: "PR Tests PHP ${{ matrix.php }} WordPress ${{ matrix.wordpress }}"
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Run General Tests
33+
# See https://github.com/alleyinteractive/action-test-general for more options
34+
uses: alleyinteractive/action-test-general@develop
35+
36+
- name: Run PHP Tests
37+
# See https://github.com/alleyinteractive/action-test-php for more options
38+
uses: alleyinteractive/action-test-php@develop
39+
with:
40+
php-version: '${{ matrix.php }}'
41+
audit-command: 'composer audit --no-dev --ansi --no-interaction'
42+
wordpress-version: '${{ matrix.wordpress }}'
43+
skip-wordpress-install: 'true'

.github/workflows/coding-standards.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/workflows/unit-test.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.php-cs-fixer.dist.php

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0"?>
2-
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="alleyinteractive/wp-match-blocks" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
2+
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="alleyinteractive/wp-match-blocks"
3+
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd">
34
<description>PHP_CodeSniffer standard for alleyinteractive/wp-match-blocks.</description>
45

5-
<file>src/</file>
6-
<file>tests/</file>
7-
<exclude-pattern>vendor/</exclude-pattern>
6+
<!-- Include Alley Rules -->
7+
<rule ref="Alley-Interactive"/>
88

99
<!--
1010
Pass some flags to PHPCS:
@@ -13,38 +13,35 @@
1313
-->
1414
<arg value="ps"/>
1515

16-
<!-- Use the Alley standard. -->
17-
<rule ref="Alley-Interactive"/>
16+
<file>src/</file>
17+
<file>tests/</file>
18+
<exclude-pattern>vendor/</exclude-pattern>
1819

19-
<!-- Check up to N files simultaneously. -->
20-
<arg name="parallel" value="75"/>
20+
<!-- Strip the filepaths down to the relevant bit. -->
21+
<arg name="basepath" value="./"/>
22+
23+
<!-- Check up to 20 files simultaneously. -->
24+
<arg name="parallel" value="20"/>
2125

2226
<!-- Set severity to 1 to see everything that isn't effectively turned off. -->
2327
<arg name="severity" value="1"/>
2428

25-
<!-- Set the allowed text domains for i18n. -->
26-
<rule ref="WordPress.WP.I18n">
27-
<properties>
28-
<property name="text_domain" type="array" value="alley"/>
29-
</properties>
30-
</rule>
29+
<!-- In effect, set the minimum supported version of WordPress to the latest version. -->
30+
<config name="minimum_supported_wp_version" value="99.0"/>
3131

32-
<!-- Set the allowed prefixes for functions, etc. -->
32+
<!-- Define the prefixes that can be used by the plugin -->
3333
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
3434
<properties>
35-
<property name="prefixes" type="array" value="Alley"/>
35+
<property name="prefixes" type="array">
36+
<element value="alley"/>
37+
</property>
3638
</properties>
3739
</rule>
3840

39-
<!-- Use a test-*.php class naming convention. -->
40-
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
41-
<exclude-pattern>tests/</exclude-pattern>
42-
</rule>
43-
4441
<!-- Allow snake case properties from WP_Block_Parser_Block and Laminas Validator. -->
4542
<rule ref="WordPress.NamingConventions.ValidVariableName">
4643
<properties>
47-
<property name="customPropertiesWhitelist" type="array">
44+
<property name="allowed_custom_properties" type="array">
4845
<element value="blockName"/>
4946
<element value="innerBlocks"/>
5047
<element value="innerHTML"/>
@@ -54,6 +51,7 @@
5451
</properties>
5552
</rule>
5653

57-
<!-- In effect, set the minimum supported version of WordPress to the latest version. -->
58-
<config name="minimum_supported_wp_version" value="99.0"/>
54+
<rule ref="WordPress.Files.FileName">
55+
<exclude-pattern>tests/*</exclude-pattern>
56+
</rule>
5957
</ruleset>

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ This library adheres to [Semantic Versioning](https://semver.org/) and [Keep a C
66

77
Nothing yet.
88

9+
## 4.0.0
10+
11+
### Changed
12+
13+
- The minimum PHP version is now 8.2.
14+
915
## 3.1.0
1016

1117
### Changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Additionally:
2929
Install the latest version with:
3030

3131
```bash
32-
$ composer require alleyinteractive/wp-match-blocks
32+
composer require alleyinteractive/wp-match-blocks
3333
```
3434

3535
## Basic usage

composer.json

Lines changed: 65 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,68 @@
11
{
2-
"name": "alleyinteractive/wp-match-blocks",
3-
"description": "Match WordPress blocks in the given content.",
4-
"type": "library",
5-
"license": "GPL-2.0-or-later",
6-
"authors": [
7-
{
8-
"name": "Alley",
9-
"email": "[email protected]"
10-
}
11-
],
12-
"autoload": {
13-
"files": [
14-
"src/alley/wp/match-blocks.php",
15-
"src/alley/wp/internals/internals.php"
16-
]
17-
},
18-
"config": {
19-
"allow-plugins": {
20-
"alleyinteractive/composer-wordpress-autoloader": true,
21-
"dealerdirect/phpcodesniffer-composer-installer": true
2+
"name": "alleyinteractive/wp-match-blocks",
3+
"description": "Match WordPress blocks in the given content.",
4+
"license": "GPL-2.0-or-later",
5+
"type": "library",
6+
"authors": [
7+
{
8+
"name": "Alley",
9+
"email": "[email protected]"
10+
}
11+
],
12+
"require": {
13+
"php": "^8.2",
14+
"alleyinteractive/composer-wordpress-autoloader": "^1.0.0",
15+
"alleyinteractive/laminas-validator-extensions": "^2.0.0"
16+
},
17+
"require-dev": {
18+
"alleyinteractive/alley-coding-standards": "^2.0",
19+
"ergebnis/composer-normalize": "^2.44",
20+
"mantle-framework/testkit": "^1.2",
21+
"szepeviktor/phpstan-wordpress": "^1.3"
22+
},
23+
"minimum-stability": "dev",
24+
"prefer-stable": true,
25+
"autoload": {
26+
"files": [
27+
"src/match-blocks.php",
28+
"src/internals/internals.php"
29+
]
30+
},
31+
"autoload-dev": {
32+
"Alley\\WP\\Tests": "tests/"
33+
},
34+
"config": {
35+
"allow-plugins": {
36+
"alleyinteractive/composer-wordpress-autoloader": true,
37+
"dealerdirect/phpcodesniffer-composer-installer": true,
38+
"ergebnis/composer-normalize": true
39+
},
40+
"lock": false,
41+
"sort-packages": true
42+
},
43+
"extra": {
44+
"wordpress-autoloader": {
45+
"autoload": {
46+
"Alley\\WP\\": "src/"
47+
}
48+
}
2249
},
23-
"lock": false
24-
},
25-
"require": {
26-
"php": "^8.0",
27-
"alleyinteractive/composer-wordpress-autoloader": "^1.0.0",
28-
"alleyinteractive/laminas-validator-extensions": "^2.0.0"
29-
},
30-
"require-dev": {
31-
"alleyinteractive/alley-coding-standards": "^1.0.0",
32-
"friendsofphp/php-cs-fixer": "^3.8",
33-
"mantle-framework/testkit": "^0.9"
34-
},
35-
"scripts": {
36-
"fixer": "php-cs-fixer -v fix --allow-risky=yes",
37-
"phpcbf": "phpcbf",
38-
"phpcs": "phpcs",
39-
"phpunit": "phpunit"
40-
},
41-
"extra": {
42-
"wordpress-autoloader": {
43-
"autoload": {
44-
"Alley\\": "src/alley/"
45-
},
46-
"autoload-dev": {
47-
"Alley\\": "tests/alley/"
48-
}
50+
"scripts": {
51+
"pre-install-cmd": [
52+
"@tidy"
53+
],
54+
"post-install-cmd": [
55+
"@tidy"
56+
],
57+
"phpcbf": "phpcbf",
58+
"phpcs": "phpcs",
59+
"phpstan": "phpstan -v --memory-limit=512M",
60+
"phpunit": "phpunit",
61+
"test": [
62+
"@phpcs",
63+
"@phpstan",
64+
"@phpunit"
65+
],
66+
"tidy": "[ $COMPOSER_DEV_MODE -eq 0 ] || composer normalize"
4967
}
50-
}
51-
}
68+
}

phpstan.neon

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
includes:
2+
- vendor/szepeviktor/phpstan-wordpress/extension.neon
3+
4+
parameters:
5+
# Level 9 is the highest level
6+
level: max
7+
8+
paths:
9+
- src/
10+
11+
typeAliases:
12+
Block_Array: 'array{blockName: ?string, attrs: array<string, mixed>, innerBlocks: mixed[], innerHTML: string, innerContent: string[]}'

0 commit comments

Comments
 (0)