Skip to content

Commit

Permalink
Syncing from alleyinteractive/mantle
Browse files Browse the repository at this point in the history
  • Loading branch information
srtfisher committed Nov 17, 2023
1 parent 6f476b9 commit 22b4b05
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 35 deletions.
3 changes: 2 additions & 1 deletion mu-plugins/mantle-app/app/jobs/class-example-job.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
* Example Job that can be queued.
*/
class Example_Job implements Job, Can_Queue {
use Queueable, Dispatchable;
use Queueable;
use Dispatchable;

/**
* Handle the job.
Expand Down
2 changes: 1 addition & 1 deletion mu-plugins/mantle-app/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 mu-plugins/mantle-app/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 mu-plugins/mantle-app/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 );
}
}
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 Down
11 changes: 2 additions & 9 deletions mu-plugins/mantle-app/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
"fakerphp/faker": "^1.23"
},
"require-dev": {
"alleyinteractive/alley-coding-standards": "^1.0",
"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",
"wp-coding-standards/wpcs": "dev-php-8-1 as 2.3.x-dev"
"szepeviktor/phpstan-wordpress": "^1.3"
},
"config": {
"allow-plugins": {
Expand All @@ -44,12 +43,6 @@
},
"minimum-stability": "dev",
"prefer-stable": true,
"repositories": [
{
"type": "vcs",
"url": "https://github.com/alleyinteractive/WordPress-Coding-Standards"
}
],
"scripts": {
"post-autoload-dump": [
"bin/mantle package:discover",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
/**
* Category Factory
*
* @extends \Mantle\Database\Factory\Term_Factory<\App\Models\Category>
* @extends \Mantle\Database\Factory\Term_Factory<\App\Models\Category, \WP_Term, \App\Models\Category>
*/
class Category_Factory extends \Mantle\Database\Factory\Term_Factory {
/**
* Model to use when creating objects.
*
* @var class-string<\Mantle\Database\Model\Model>
* @var class-string<\App\Models\Category>
*/
protected string $model = Category::class;

Expand Down
6 changes: 3 additions & 3 deletions mu-plugins/mantle-app/database/factory/class-post-factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
/**
* Post Factory
*
* @extends \Mantle\Database\Factory\Post_Factory<\App\Models\Post>
* @extends \Mantle\Database\Factory\Post_Factory<\App\Models\Post, \WP_Post, \App\Models\Post>
*/
class Post_Factory extends \Mantle\Database\Factory\Post_Factory {
/**
* Model to use when creating objects.
*
* @var class-string<\Mantle\Database\Model\Model>
* @var class-string<\App\Models\Post>
*/
protected string $model = Post::class;

Expand All @@ -33,7 +33,7 @@ class Post_Factory extends \Mantle\Database\Factory\Post_Factory {
public function definition(): array {
return [
'post_title' => $this->faker->sentence(),
'post_content' => trim( $this->faker->paragraph_blocks( 3 ) ),
'post_content' => trim( $this->faker->paragraph_blocks( 3 ) ), // @phpstan-ignore-line undefined method
'post_status' => 'publish',
'post_type' => 'post',
];
Expand Down
4 changes: 2 additions & 2 deletions mu-plugins/mantle-app/database/factory/class-tag-factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
/**
* Tag Factory
*
* @extends \Mantle\Database\Factory\Term_Factory<\App\Models\Tag>
* @extends \Mantle\Database\Factory\Term_Factory<\App\Models\Tag, \WP_Term, \App\Models\Tag>
*/
class Tag_Factory extends \Mantle\Database\Factory\Term_Factory {
/**
* Model to use when creating objects.
*
* @var class-string<\Mantle\Database\Model\Model>
* @var class-string<\App\Models\Tag>
*/
protected string $model = Tag::class;

Expand Down
2 changes: 1 addition & 1 deletion mu-plugins/mantle-app/mantle.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
if ( ! file_exists( __DIR__ . '/vendor/wordpress-autoload.php' ) ) {
add_action(
'admin_notices',
function() {
function () {
printf(
'<div class="notice notice-error"><p>%s</p></div>',
esc_html__( 'Mantle requires a `composer install` to run properly.', 'mantle' )
Expand Down
8 changes: 4 additions & 4 deletions mu-plugins/mantle-app/routes/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
|
| Register a closure-based route:
|
| Route::get( '/closure-route', function( \WP_REST_Request $request ) {
| dd( $request );
| } );
| Route::get( '/closure-route', function( \WP_REST_Request $request ) {
| dd( $request );
| } );
|
*/

Route::rest_api( '/example-namespace', function() {
Route::rest_api( '/example-namespace', function () {
//
} );
14 changes: 7 additions & 7 deletions mu-plugins/mantle-app/routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
|
| Register a controller route:
|
| Route::get( '/controller-route', Example_Controller::class . '@method_to_call' );
| Route::get( '/controller-route', Example_Controller::class . '@method_to_call' );
|
| Register a closure-based route:
|
| Route::get( '/closure-route', function( \Mantle\Http\Request $request ) {
| dd( $request->all() );
| } );
| Route::get( '/closure-route', function( \Mantle\Http\Request $request ) {
| dd( $request->all() );
| } );
|
| Register a route with variables:
|
| Route::get( '/hello/{who}', function( $name ) {
| return "Why hello {$name}!";
| } );
| Route::get( '/hello/{who}', function( $name ) {
| return "Why hello {$name}!";
| } );
|
*/

0 comments on commit 22b4b05

Please sign in to comment.