Skip to content

Commit

Permalink
Merge branch 'main' into updates
Browse files Browse the repository at this point in the history
  • Loading branch information
srtfisher authored Nov 30, 2023
2 parents 6b6b08c + db9b6b2 commit bc9d1e3
Show file tree
Hide file tree
Showing 36 changed files with 293 additions and 157 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ on:
push:
branches:
- main
- '*.*.x'
pull_request:
schedule:
- cron: '0 0 * * *'
- cron: '0 0 * * 0'

jobs:
coding-standards:
uses: alleyinteractive/.github/.github/workflows/php-coding-standards.yml@main
with:
php: 8.2
phpstan:
uses: alleyinteractive/.github/.github/workflows/php-code-quality.yml@main
with:
command: "phpstan"
php: 8.2
4 changes: 4 additions & 0 deletions .github/workflows/node-tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Node Tests

on:
push:
branches:
- main
- '*.*.x'
pull_request:

jobs:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ on:
push:
branches:
- main
- '*.*.x'
pull_request:
schedule:
- cron: '0 0 * * *'
- cron: '0 0 * * 0'

jobs:
php-tests:
strategy:
matrix:
php: [8.0]
php: [8.0, 8.1, 8.2]
wordpress: ["latest"]
multisite: [true, false]
uses: alleyinteractive/.github/.github/workflows/php-tests.yml@main
with:
multisite: ${{ matrix.multisite }}
php: ${{ matrix.php }}
wordpress: ${{ matrix.wordpress }}
multisite: ${{ matrix.multisite }}
2 changes: 1 addition & 1 deletion .github/workflows/upgrade-wordpress-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: alleyinteractive/action-update-wordpress-plugin@v1.1.0
- uses: alleyinteractive/action-update-wordpress-plugin@v1.2.1
with:
plugin-file: 'plugin.php'
upgrade-npm-dependencies: "true"
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ and layout and leaving the rest of the functionality to be built within the
Mantle plugin.

For more information about the framework and how to get started using it, check
out the [Mantle Documentation Site](https://mantle.alley.co/).
out the [Mantle Documentation Site](https://mantle.alley.com/).

## Installation

Expand All @@ -57,13 +57,13 @@ You can also use a our
[create-mantle-app](https://github.com/alleyinteractive/create-mantle-app)
starter kit to get a fully scaffolded `wp-content`-rooted WordPress project out
of the box. For more information, see
[Installation](https://mantle.alley.co/getting-started/installation.html).
[Installation](https://mantle.alley.com/getting-started/installation.html).

## Maintainers

This project is actively maintained by [Alley
Interactive](https://github.com/alleyinteractive). Like what you see? [Come work
with us](https://alley.co/careers/).
with us](https://alley.com/careers/).

![Alley logo](https://avatars.githubusercontent.com/u/1733454?s=200&v=4)

Expand Down
2 changes: 1 addition & 1 deletion app/console/class-kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Kernel extends Console_Kernel {
/**
* The commands provided by the application.
*
* @var array
* @var array<int, class-string<\Mantle\Console\Command>>
*/
protected $commands = [
// ...
Expand Down
8 changes: 4 additions & 4 deletions app/exceptions/class-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Handler extends Base_Handler {
/**
* A list of the exception types that are not reported.
*
* @var string[]
* @var array<int, class-string<\Throwable>>
*/
protected $dont_report = [
// ...
Expand All @@ -29,7 +29,7 @@ class Handler extends Base_Handler {
*
* @param Throwable $exception Exception thrown.
*/
public function report( Throwable $exception ) {
public function report( Throwable $exception ): void {
parent::report( $exception );
}

Expand All @@ -38,9 +38,9 @@ public function report( Throwable $exception ) {
*
* @param \Mantle\Http\Request $request Request object.
* @param \Throwable $exception Exception thrown.
* @return \Symfony\Component\HttpFoundation\Response
* @return mixed
*/
public function render( $request, Throwable $exception ) {
public function render( $request, Throwable $exception ): mixed {
return parent::render( $request, $exception );
}
}
6 changes: 3 additions & 3 deletions app/http/class-kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ class Kernel extends Http_Kernel {
*
* These middleware are run during every request to your application.
*
* @var array
* @var array<int, callable|class-string>
*/
protected $middleware = [];

/**
* The application's route middleware groups.
*
* @var array
* @var array<string, array<int, callable|class-string>>
*/
protected $middleware_groups = [
'web' => [
Expand All @@ -43,7 +43,7 @@ class Kernel extends Http_Kernel {
*
* These middleware may be assigned to groups or used individually.
*
* @var array
* @var array<string, callable|class-string>
*/
protected $route_middleware = [
'can' => \Mantle\Auth\Middleware\Authorize::class,
Expand Down
5 changes: 3 additions & 2 deletions app/jobs/class-example-job.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
* Example Job that can be queued.
*/
class Example_Job implements Job, Can_Queue {
use Queueable, Dispatchable;
use Queueable;
use Dispatchable;

/**
* Handle the job.
*/
public function handle() {
public function handle(): void {
// Handle it here!
}
}
2 changes: 1 addition & 1 deletion app/models/class-category.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Category extends Term {
*
* @return Has_Many
*/
public function posts() : Has_Many {
public function posts(): Has_Many {
return $this->has_many( Post::class );
}
}
2 changes: 1 addition & 1 deletion app/models/class-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function category() {
*
* @return Has_Many
*/
public function tags() : Has_Many {
public function tags(): Has_Many {
return $this->has_many( Tag::class );
}
}
2 changes: 1 addition & 1 deletion app/models/class-tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Tag extends Term {
*
* @return Has_Many
*/
public function posts() : Has_Many {
public function posts(): Has_Many {
return $this->has_many( Post::class );
}
}
7 changes: 4 additions & 3 deletions app/providers/class-app-service-provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace App\Providers;

use Mantle\Application\App_Service_Provider as Service_Provider;
use Mantle\Scheduling\Schedule;

/**
* Application Service Provider
Expand All @@ -16,14 +17,14 @@ class App_Service_Provider extends Service_Provider {
/**
* Register any application services.
*/
public function register() {
public function register(): void {
// Add application registration here.
}

/**
* Bootstrap any application services.
*/
public function boot() {
public function boot(): void {
// Boot the application here.
}

Expand All @@ -32,7 +33,7 @@ public function boot() {
*
* @param \Mantle\Scheduling\Schedule $schedule Scheduler instance.
*/
protected function schedule( $schedule ) {
protected function schedule( $schedule ): void {
// Schedule any commands, jobs, callbacks, etc. here.
}
}
10 changes: 5 additions & 5 deletions app/providers/class-asset-service-provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ public function boot() {
|
| Enqueue a raw asset using the asset() helper:
|
| asset()->script( 'example-entry' )->async()->src( asset_loader( '/app.js' ) );
| asset()->style( 'example-entry' )->condition( 'single' )->src( asset_loader( '/app.css' ) );
| asset()->script( 'example-entry' )->async()->src( asset_loader( '/app.js' ) );
| asset()->style( 'example-entry' )->condition( 'single' )->src( asset_loader( '/app.css' ) );
|
| Enqueue an asset with dependencies from @wordpress/dependency-extraction-webpack-plugin:
|
| asset()->script( 'example-block' )->src( asset_loader( '/example-block.js' ) )->dependencies( asset_loader()->dependencies( '/example-block.js' ) );
| asset()->script( 'example-block' )->src( asset_loader( '/example-block.js' ) )->dependencies( asset_loader()->dependencies( '/example-block.js' ) );
|
| Get cookin'!
|
Expand All @@ -60,8 +60,8 @@ public function boot() {
/**
* Filter the asset conditions for the site.
*
* @param array $conditions Conditions to filter.
* @return array
* @param array<string, boolean> $conditions Conditions to filter.
* @return array<string, boolean>
*/
public function on_am_asset_conditions( array $conditions ): array {
// Perform any modifications here.
Expand Down
6 changes: 2 additions & 4 deletions app/providers/class-event-service-provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Event_Service_Provider extends Service_Provider {
/**
* The event listener mappings for the application.
*
* @var array
* @var array<string, array<int, class-string>>
*/
protected $listen = [
/**
Expand All @@ -35,10 +35,8 @@ class Event_Service_Provider extends Service_Provider {

/**
* Register any other events for your application.
*
* @return void
*/
public function boot() {
public function boot(): void {
// ...
}

Expand Down
4 changes: 2 additions & 2 deletions app/providers/class-route-service-provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Route_Service_Provider extends Service_Provider {
/**
* Bootstrap any application services.
*/
public function boot() {
public function boot(): void {
parent::boot();

$this->allow_pass_through_requests();
Expand All @@ -26,7 +26,7 @@ public function boot() {
/**
* Define routes for the application.
*/
public function map() {
public function map(): void {
Route::middleware( 'web' )->group( base_path( 'routes/web.php' ) );
Route::middleware( 'rest-api' )->group( base_path( 'routes/rest-api.php' ) );
}
Expand Down
27 changes: 9 additions & 18 deletions bin/mantle
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,27 @@ if ( file_exists( __DIR__ . '/../vendor/autoload.php' ) ) {
exit( 1 );
}

$app = require_once __DIR__ . '/../bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Run the Console Mantle Application
| Load the Application
|--------------------------------------------------------------------------
|
| Load the Mantle application and run the console application. With isolation
| mode enabled, we shouldn't have a dependency on WordPress.
| Load the Mantle application from the bootstrap file.
|
*/

$kernel = $app->make( Mantle\Contracts\Console\Kernel::class );

$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput(),
);
$app = require_once MANTLE_BASE_DIR . '/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Shutdown The Application
| Run the Mantle Console Application
|--------------------------------------------------------------------------
|
| Once the application has finished running, we will fire off the shutdown
| events so that any final work may be done by the application before it
| is shut down gracefully.
| Load the application with the base configuration and boot it. Booting it will
| cause the console application to run and exit with the status code.
|
*/

$kernel->terminate( $input, $status );

exit( $status );
bootloader( $app )
->set_base_path( MANTLE_BASE_DIR )
->boot();
18 changes: 12 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
],
"require": {
"alleyinteractive/composer-wordpress-autoloader": "^1.0",
"alleyinteractive/mantle-framework": "^0.10",
"fakerphp/faker": "^1.9"
"alleyinteractive/mantle-framework": "^0.12",
"fakerphp/faker": "^1.23"
},
"require-dev": {
"alleyinteractive/alley-coding-standards": "^1.0",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
"alleyinteractive/alley-coding-standards": "^2.0",
"nunomaduro/collision": "^6.4",
"phpstan/phpstan": "1.10.15",
"phpunit/phpunit": "^9.6.10",
"szepeviktor/phpstan-wordpress": "^1.3"
},
"config": {
"allow-plugins": {
Expand Down Expand Up @@ -46,10 +48,14 @@
"bin/mantle package:discover",
"bin/mantle model:discover"
],
"lint": "@phpcs",
"lint": [
"@phpcs",
"@phpstan"
],
"lint:fix": "@phpcbf",
"phpcbf": "phpcbf --standard=./phpcs.xml .",
"phpcs": "phpcs --standard=./phpcs.xml .",
"phpstan": "phpstan --memory-limit=512M",
"phpunit": "phpunit",
"test": [
"@lint",
Expand Down
11 changes: 11 additions & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,15 @@
|
*/
'namespace' => environment( 'APP_NAMESPACE', 'App' ),

/*
|--------------------------------------------------------------------------
| Application Text Domain
|--------------------------------------------------------------------------
|
| The text domain used by Mantle when scaffolding files with translatable
| strings.
|
*/
'i18n_domain' => environment( 'APP_I18N_DOMAIN', 'mantle' ),
];
Loading

0 comments on commit bc9d1e3

Please sign in to comment.