Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump/php7.4 #237

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
]
},
"require" : {
"php":"^7.2",
"php":"^7.4",
"twig/twig": "^3.1",
"twig/string-extra": "^3.1",
"twig/intl-extra": "^3.1",
Expand All @@ -53,9 +53,14 @@
},
"require-dev": {
"giacocorsiglia/wordpress-stubs": "^5.1",
"vimeo/psalm": "^3.4",
"vimeo/psalm": "^4.20",
"10up/wp_mock": "^0.4.2",
"wp-coding-standards/wpcs": "^2.3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
2 changes: 1 addition & 1 deletion docs/getting-started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Installation
Requirements
---

- PHP 7.2 or higher
- PHP 7.4 or higher
- WordPress 4.7 or higher

Using composer
Expand Down
3 changes: 1 addition & 2 deletions src/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ public function get_template_filename( $post_id ):string {
$filename = '';

if ( ! empty( $page_template_slug ) ) {
$pathinfo = pathinfo( $page_template_slug );
$filename = array_key_exists( 'filename', $pathinfo ) ? (string) $pathinfo['filename'] : '';
$filename = pathinfo( $page_template_slug, PATHINFO_FILENAME );
}
return $filename;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Template_Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function add_posts_page( array $context ):array {
}

$post = get_post( get_option( 'page_for_posts' ) );
$context['posts_page'] = Objects::get_instance()->get_object( $post );
$context['posts_page'] = $post instanceof \WP_Post ? Objects::get_instance()->get_object( $post ) : null;

return $context;
}
Expand Down
10 changes: 4 additions & 6 deletions src/WordPress_Object/Clarkson_Object.php
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,12 @@ public function add_term( $term ) {
/**
* Bulk add terms to a post.
*
* @param string $taxonomy Taxonomy.
* @param string $taxonomy Taxonomy.
* @param Clarkson_Term[] $terms Terms.
* @var Clarkson_Term $term Term objects.
*
* @return array|\WP_Error Terms array.
*/
public function add_terms( $taxonomy, $terms ) {
public function add_terms( string $taxonomy, array $terms ) {
// Filter terms to ensure they are in the correct taxonomy.
$terms = array_filter(
$terms,
Expand All @@ -558,13 +557,12 @@ function( $term ) {
* Will delete all terms for a given taxonomy.
* Adds all passed terms or overwrites existing terms.
*
* @param string $taxonomy Taxonomy.
* @param string $taxonomy Taxonomy.
* @param Clarkson_Term[] $terms Terms.
* @var Clarkson_Term $term Term objects.
*
* @return array|\WP_Error Affected Term IDs.
*/
public function reset_terms( $taxonomy, $terms ) {
public function reset_terms( string $taxonomy, array $terms ) {
// Filter terms to ensure they are in the correct taxonomy.
$terms = array_filter(
$terms,
Expand Down