Skip to content

Commit 90d48e0

Browse files
authored
Merge pull request #2 from wearenolte/php8-composer-update
Update composer & libraries
2 parents adfa625 + 5f02d6c commit 90d48e0

File tree

7 files changed

+65
-73
lines changed

7 files changed

+65
-73
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
language: php
22
sudo: false
33
php:
4-
- 5.4
4+
- 7.4
5+
- 8.0
56

67
install:
78
- composer self-update;

codesniffer.ruleset.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
<exclude name="PEAR.Functions.FunctionCallSignature.Indent" />
99
<exclude name="WordPress.Files.FileName" />
1010
<exclude name="Generic.Files.LowercasedFilename" />
11-
<exclude name="WordPress.Variables.GlobalVariables" />
12-
<exclude name="WordPress.VIP.SuperGlobalInputUsage" />
13-
<exclude name="WordPress.VIP.RestrictedFunctions" />
14-
<exclude name="WordPress.VIP.SlowDBQuery" />
11+
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found" />
12+
<exclude name="WordPress.NamingConventions.ValidHookName" />
1513
</rule>
1614
</ruleset>

composer.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
}
1919
],
2020
"require": {
21-
"php": ">=5.4"
21+
"php": ">=7.4 || >=8.0"
2222
},
2323
"autoload": {
2424
"psr-4": {
2525
"Nolte\\": "src/"
2626
}
2727
},
2828
"require-dev": {
29-
"squizlabs/php_codesniffer": "2.*",
30-
"wp-coding-standards/wpcs": "0.9.0"
29+
"squizlabs/php_codesniffer": "3.*",
30+
"wp-coding-standards/wpcs": "2.*"
3131
},
3232
"scripts": {
3333
"installSniffer": [
@@ -43,4 +43,3 @@
4343
]
4444
}
4545
}
46-

composer.lock

Lines changed: 46 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/AbstractCollectionEndpoint.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ abstract class AbstractCollectionEndpoint extends AbstractEndpoint {
2828
* @since 0.1.0
2929
*
3030
* @param \WP_REST_Request $request The request object that mimics the request
31-
* made by the user.
31+
* made by the user.
3232
* @return array The data to be delivered to the endpoint
3333
*/
3434
public function endpoint_callback( \WP_REST_Request $request ) {
@@ -50,7 +50,7 @@ abstract protected function loop();
5050
* @param object $item The unformatted post object.
5151
*/
5252
protected function format_item( $item ) {
53-
return apply_filters( Filter::ITEM_FORMAT, $item, $item, $this->args );
53+
return apply_filters( Filters::ITEM_FORMAT, $item, $item, $this->args );
5454
}
5555

5656
/**
@@ -64,7 +64,7 @@ protected function format_item( $item ) {
6464
*/
6565
protected function get_pagination( $found, $pages ) {
6666
$total = absint( $found );
67-
$meta = [
67+
$meta = [
6868
'items' => $total,
6969
'pages' => 0,
7070
];

src/AbstractEndpoint.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ abstract class AbstractEndpoint {
2525
* @since 0.1.0
2626
*/
2727
public static function init() {
28-
$child = get_called_class();
29-
$endpoint = new $child;
28+
$child = get_called_class();
29+
$endpoint = new $child();
3030
$endpoint->create();
3131
}
3232

@@ -47,7 +47,7 @@ public function create() {
4747
*/
4848
private function set_variables() {
4949
$this->namespace = apply_filters( Filters::API_NAMESPACE, 'nolte', $this->endpoint );
50-
$this->version = apply_filters( Filters::API_VERSION, 'v2', $this->endpoint );
50+
$this->version = apply_filters( Filters::API_VERSION, 'v2', $this->endpoint );
5151
}
5252

5353
/**
@@ -100,10 +100,10 @@ protected function filter_format( $str = '' ) {
100100
*/
101101
protected function endpoint_options() {
102102
return [
103-
'methods' => \WP_REST_Server::READABLE,
104-
'callback' => [ $this, 'endpoint_callback' ],
103+
'methods' => \WP_REST_Server::READABLE,
104+
'callback' => [ $this, 'endpoint_callback' ],
105105
'permission_callback' => '__return_true',
106-
'args' => $this->endpoint_args(),
106+
'args' => $this->endpoint_args(),
107107
];
108108
}
109109

src/Endpoints/Filters.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
class Filters {
99
const API_NAMESPACE = 'nolte_endpoints_api_namespace';
10-
const API_VERSION = 'nolte_endpoints_api_version';
11-
const API_DATA = 'nolte_endpoints_data';
12-
const ITEM_FORMAT = 'nolte_endpoints_collection_item';
10+
const API_VERSION = 'nolte_endpoints_api_version';
11+
const API_DATA = 'nolte_endpoints_data';
12+
const ITEM_FORMAT = 'nolte_endpoints_collection_item';
1313
}

0 commit comments

Comments
 (0)