Skip to content

Commit

Permalink
Update for PHP 8.0+
Browse files Browse the repository at this point in the history
  • Loading branch information
schlessera committed Jan 9, 2025
1 parent b2ad12e commit 3dc7983
Show file tree
Hide file tree
Showing 12 changed files with 132 additions and 284 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Code Quality Checks

on:
pull_request:
push:
branches:
- main
- master

jobs:
code-quality:
uses: brightnucleus/.github/.github/workflows/reusable-code-quality.yml@main
16 changes: 16 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Testing

on:
pull_request:
push:
branches:
- main
- master
schedule:
- cron: '17 1 * * *' # Run every day on a seemingly random time.

jobs:
test:
uses: brightnucleus/.github/.github/workflows/reusable-testing.yml@main
with:
minimum-php: '8.0'
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
vendor/
vendor/
composer.lock
33 changes: 29 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,41 @@
}
],
"require": {
"brightnucleus/config": ">=0.2",
"brightnucleus/exceptions": ">=0.2",
"brightnucleus/invoker": ">=0.1",
"brightnucleus/contracts": ">=0.1"
"php": ">=8.0",
"brightnucleus/config": ">=0.5",
"brightnucleus/exceptions": ">=0.3",
"brightnucleus/invoker": ">=0.2",
"brightnucleus/contracts": ">=0.2"
},
"require-dev": {
"malukenho/docheader": "^1",
"yoast/phpunit-polyfills": "^3",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.5 || ^10",
"squizlabs/php_codesniffer": "^3",
"php-parallel-lint/php-parallel-lint": "^1",
"wp-coding-standards/wpcs": "^3.0",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0"
},
"autoload": {
"psr-4": {
"BrightNucleus\\Dependency\\": "src/"
}
},
"scripts": {
"check": [
"@cs-check",
"@test"
],
"upload-coverage": "vendor/bin/coveralls -v --coverage_clover clover.xml",
"cs-check": "vendor/bin/phpcs -ps --colors",
"cs-fix": "vendor/bin/phpcbf -ps --colors",
"test": "echo 'No tests yet.'",
"test-coverage": "echo 'No tests yet.'",
"license-check": "vendor/bin/docheader --ansi check src/"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
228 changes: 0 additions & 228 deletions composer.lock

This file was deleted.

13 changes: 0 additions & 13 deletions phpcs.xml

This file was deleted.

25 changes: 25 additions & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards for BrightNucleus Dependencies">
<description>A custom set of PHPCS rules for BrightNucleus Dependencies.</description>

<!-- What to scan -->
<file>.</file>
<exclude-pattern>/vendor/</exclude-pattern>
<exclude-pattern>/tests/</exclude-pattern>

<!-- How to scan -->
<arg value="sp"/> <!-- Show sniff and progress -->
<arg name="colors"/>
<arg name="basepath" value="."/>
<arg name="parallel" value="8"/>
<arg name="extensions" value="php"/>

<!-- Rules: WordPress Coding Standards -->
<config name="minimum_supported_wp_version" value="8.0"/>

<!-- For help in understanding these custom sniff properties:
https://github.com/WordPress/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
<rule ref="WordPress">
<exclude name="WordPress.Files.FileName"/>
</rule>
</ruleset>
6 changes: 3 additions & 3 deletions src/AbstractDependencyHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ abstract protected function get_register_function();
*/
public function enqueue( $args = null ) {
if ( array_key_exists( 'handle', $args )
&& $this->is_enqueued( $args['handle'] ) ) {
&& $this->is_enqueued( $args['handle'] ) ) {
return;
}

Expand Down Expand Up @@ -103,7 +103,7 @@ public function maybe_enqueue( $handle ) {
*
* @since 0.3.3
*
* @param string $handle The handle to check
* @param string $handle The handle to check.
* @return bool Whether it is enqueued or not.
*/
abstract public function is_enqueued( $handle );
Expand All @@ -114,7 +114,7 @@ abstract public function is_enqueued( $handle );
* @since 0.2.3
* @since 0.3.3 Publicly accessible.
*
* @param string $handle The handle to check
* @param string $handle The handle to check.
* @return bool Whether it is registered or not.
*/
abstract public function is_registered( $handle );
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyHandlerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function maybe_enqueue( $handle );
*
* @since 0.3.3
*
* @param string $handle The handle to check
* @param string $handle The handle to check.
* @return bool Whether it is registered or not.
*/
public function is_registered( $handle );
Expand All @@ -49,7 +49,7 @@ public function is_registered( $handle );
*
* @since 0.3.3
*
* @param string $handle The handle to check
* @param string $handle The handle to check.
* @return bool Whether it is enqueued or not.
*/
public function is_enqueued( $handle );
Expand Down
Loading

0 comments on commit 3dc7983

Please sign in to comment.