Skip to content

Commit

Permalink
Upgrading mantle to alley-coding-standards 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
srtfisher committed Nov 16, 2023
1 parent 4d9858c commit 358b373
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 28 deletions.
3 changes: 2 additions & 1 deletion 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 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 );
}
}
6 changes: 3 additions & 3 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 Down
11 changes: 2 additions & 9 deletions 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
2 changes: 1 addition & 1 deletion 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 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 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 358b373

Please sign in to comment.