Skip to content

Commit

Permalink
Merge pull request #408 from justlevine/chore/strict-types-rules
Browse files Browse the repository at this point in the history
chore: implement strict types
  • Loading branch information
justlevine authored May 13, 2024
2 parents 84b2e17 + c2aee5f commit 36e6e2a
Show file tree
Hide file tree
Showing 321 changed files with 627 additions and 46 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- chore!: Bump minimum WPGraphQL version to v1.26.0.
- chore!: Bump minimum WordPress version to v6.0.0.
- chore!: Bump minimum Gravity Forms version to v2.7.0.
- chore: Declare `strict_types` in all PHP files.
- chore: Update Composer dev-dependencies and fix test compatibility with `wp-graphql-test-case` v3.0.x.

## v0.12.6.1
Expand Down Expand Up @@ -159,7 +160,6 @@ Lastly, we've exposed the `connectedChoice` and `connectedInput` fields on `Chec
- tests: Add tests for `submitGfForm` mutation.
- docs: replace `formId` with `id` in `submitGfForm` examples. Props: @mosesintech


## v0.11.11 - Bugfix

This _minor_ release fixes a bug where the `ip` field on `GfEntry` was not being properly stored when submitting a form.
Expand Down Expand Up @@ -275,7 +275,6 @@ This _minor_ release adds the reCaptcha V2 `type` and `publicKey` to `gfSettings
- tests: Use `gravityformscli` for installing GF plugins in test envs.
- chore: Upgrade composer deps


## v0.11.0 - reCAPTCHA Validation, Plugin Updates, and GF 2.6 Support

**:warning: This release contains breaking changes.**
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,4 @@ Priority support and custom development are available to [our Sponsors](https://
<a href="https://mysafetyhq.com/" target="_blank" rel="sponsored" title="SafetyHQ (previously Harness Software)"><img src="https://avatars.githubusercontent.com/u/50597878?s=150&v=4" alt="SafetyHQ (previously Harness Software)"></a>
</div>


<a href="https://github.com/sponsors/AxeWP" alt="GitHub Sponsors"><img src="https://img.shields.io/static/v1?label=Sponsor%20Us%20%40%20AxeWP&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86&style=for-the-badge" /></a>
1 change: 0 additions & 1 deletion bin/_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ install_plugins() {
fi
wp plugin activate wp-graphql-upload


# Install WPGatsby and Activate
if ! $( wp plugin is-installed wp-gatsby ); then
wp plugin install wp-gatsby
Expand Down
3 changes: 0 additions & 3 deletions docker/app.post-setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash


install_gf() {
# Install GF plugins and Activate.
echo "Installing and Activating Gravity Forms + extensions";
Expand Down Expand Up @@ -51,7 +50,6 @@ if ! $( wp plugin is-installed wp-graphql-upload --allow-root ); then
fi
wp plugin activate wp-graphql-upload --allow-root


# Install WPGatsby and Activate
if ! $( wp plugin is-installed wp-gatsby --allow-root ); then
wp plugin install wp-gatsby --allow-root
Expand Down Expand Up @@ -79,6 +77,5 @@ if $(wp maintenance-mode is-active --allow-root); then
wp maintenance-mode deactivate --allow-root
fi


chmod 777 -R .
chown -R $(id -u):$(id -g) .
3 changes: 0 additions & 3 deletions docker/testing.entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ run_tests() {
wp maintenance-mode deactivate --allow-root
fi


# Suites is the comma separated list of suites/tests to run.
echo "Running Test Suite $suites"
vendor/bin/codecept run -c codeception.dist.yml "${suites}" ${coverage:-} ${debug:-} --no-exit
Expand Down Expand Up @@ -86,7 +85,6 @@ fi
echo "Running composer install"
COMPOSER_MEMORY_LIMIT=-1 composer install --no-interaction


# Install pcov/clobber if PHP7.1+
if version_gt $PHP_VERSION 7.0 && [[ -n "$COVERAGE" ]] && [[ -z "$USING_XDEBUG" ]]; then
echo "Using pcov/clobber for codecoverage"
Expand Down Expand Up @@ -145,7 +143,6 @@ if [ -n "$(ls "$TESTS_OUTPUT")" ]; then
chmod 777 -R "$TESTS_OUTPUT"/*
fi


# Check results and exit accordingly.
if [ -f "${TESTS_OUTPUT}/failed" ]; then
echo "Uh oh, something went wrong."
Expand Down
4 changes: 0 additions & 4 deletions docs/actions-and-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ do_action( 'graphql_gf_after_register_form_field_' . $field->graphql_single_name
* **`$field`** _(GF_Field)_ : The Gravity Forms field object.
* **`$field_settings`** _(array)_ : The Gravity Forms field settings.


#### Parameters

* **`$field`** _(GF_Field)_ : The Gravity Forms field object.
Expand Down Expand Up @@ -141,7 +140,6 @@ apply_filters( 'graphql_gf_can_view_entries', bool $can_view_entries, int $form_
* **`$entry_id`** _(string)_ : The entry ID being queried by GraphQL.
* **`$draft_entry`** _(array)_ : The Gravity Forms entry data array.


### `graphql_gf_entries_connection_query_args`

Filter the Submitted Entry's $query_args to allow folks to customize queries programmatically.
Expand Down Expand Up @@ -365,7 +363,6 @@ apply_filters( 'graphql_gf_form_field_value_fields_' . $field->graphql_single_na
* **`$fields`** _(array)_ : An array of [WPGraphQL field `$config` arrays](https://www.wpgraphql.com/functions/register_graphql_fields/).
* **`$field`** _(GF_Field)_ : The Gravity Forms Field object.


### `graphql_gf_form_field_values_input_fields`

Filter to modify the Form Field value GraphQL fields.
Expand Down Expand Up @@ -448,7 +445,6 @@ apply_filters( 'graphql_gf_registered_{$type}_classes', array $classes_to_regist

Filters the list of PHP classes that register GraphQL Interfaces based on a particular Gravity Forms field setting.


```php
apply_filters( 'graphql_gf_registered_{$type}_classes', array $classes_to_register );
```
Expand Down
1 change: 0 additions & 1 deletion docs/form-field-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ These forms are hidden **by default**:

* `CreditCardField`


To enable these plugins, you can define the `WPGRAPHQL_GF_EXPERIMENTAL_FIELDS` constant to true in wp-config.php[https://wordpress.org/support/article/editing-wp-config-php/].

```php
Expand Down
2 changes: 2 additions & 0 deletions src/Connection/AbstractConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Connection;

use WPGraphQL\GF\Interfaces\Hookable;
Expand Down
2 changes: 2 additions & 0 deletions src/Connection/EntriesConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Connection;

use GraphQL\Error\UserError;
Expand Down
2 changes: 2 additions & 0 deletions src/Connection/FormFieldsConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Connection;

use WPGraphQL\GF\Type\Enum\FormFieldTypeEnum;
Expand Down
2 changes: 2 additions & 0 deletions src/Connection/FormsConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Connection;

use GraphQL\Type\Definition\ResolveInfo;
Expand Down
2 changes: 2 additions & 0 deletions src/CoreSchemaFilters.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF;

use WPGraphQL\GF\Data\Factory;
Expand Down
2 changes: 2 additions & 0 deletions src/Data/Connection/EntriesConnectionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @since 0.0.1
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\Connection;

use GFAPI;
Expand Down
2 changes: 2 additions & 0 deletions src/Data/Connection/FormFieldsConnectionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\Connection;

use GraphQL\Type\Definition\ResolveInfo;
Expand Down
2 changes: 2 additions & 0 deletions src/Data/Connection/FormsConnectionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @since 0.0.1
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\Connection;

use GFAPI;
Expand Down
2 changes: 2 additions & 0 deletions src/Data/EntryObjectMutation.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data;

use Exception;
Expand Down
2 changes: 2 additions & 0 deletions src/Data/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data;

use GraphQL\Deferred;
Expand Down
2 changes: 2 additions & 0 deletions src/Data/FieldValueInput/AbstractFieldValueInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\FieldValueInput;

use GF_Field;
Expand Down
2 changes: 2 additions & 0 deletions src/Data/FieldValueInput/AddressValuesInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\FieldValueInput;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Data/FieldValueInput/CaptchaValueInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.11.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\FieldValueInput;

use GF_Field;
Expand Down
2 changes: 2 additions & 0 deletions src/Data/FieldValueInput/CheckboxValuesInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\FieldValueInput;

use GFCommon;
Expand Down
2 changes: 2 additions & 0 deletions src/Data/FieldValueInput/ConsentValueInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\FieldValueInput;

use GFFormsModel;
Expand Down
2 changes: 2 additions & 0 deletions src/Data/FieldValueInput/EmailValuesInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\FieldValueInput;

/**
Expand Down
4 changes: 4 additions & 0 deletions src/Data/FieldValueInput/FileUploadValuesInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\FieldValueInput;

use GraphQL\Error\UserError;
Expand Down Expand Up @@ -35,6 +37,8 @@ protected function get_field_name(): string {
* @return string|mixed
*
* @throws \GraphQL\Error\UserError
*
* @return string|mixed
*/
protected function prepare_value() {
// Draft entries don't upload files.
Expand Down
2 changes: 2 additions & 0 deletions src/Data/FieldValueInput/ImageValuesInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\FieldValueInput;

use GF_Field;
Expand Down
2 changes: 2 additions & 0 deletions src/Data/FieldValueInput/ListValuesInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\FieldValueInput;

use GraphQL\Error\UserError;
Expand Down
2 changes: 2 additions & 0 deletions src/Data/FieldValueInput/NameValuesInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\FieldValueInput;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Data/FieldValueInput/ProductValueInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.12.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\FieldValueInput;

use GFCommon;
Expand Down
4 changes: 3 additions & 1 deletion src/Data/FieldValueInput/ValueInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\FieldValueInput;

use GFCommon;
Expand All @@ -30,7 +32,7 @@ protected function get_field_name(): string {
/**
* {@inheritDoc}
*/
protected function prepare_value(): string {
protected function prepare_value() {
// Handle choices with price.
if ( ! empty( $this->field->enablePrice ) && false === strpos( $this->args, '|' ) ) {
$value_key = ! empty( $this->field->enablePrice ) || ! empty( $this->field->enableChoiceValue ) ? 'value' : 'text';
Expand Down
2 changes: 2 additions & 0 deletions src/Data/FieldValueInput/ValuesInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\FieldValueInput;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Data/Loader/DraftEntriesLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\Loader;

use GFFormsModel;
Expand Down
2 changes: 2 additions & 0 deletions src/Data/Loader/EntriesLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @since 0.0.1
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\Loader;

use GFAPI;
Expand Down
2 changes: 2 additions & 0 deletions src/Data/Loader/FormsLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* @since 0.0.1
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Data\Loader;

use GFAPI;
Expand Down
2 changes: 2 additions & 0 deletions src/Extensions/Extensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Extensions;

use WPGraphQL\GF\Extensions\GFChainedSelects\GFChainedSelects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* @since 0.10.0
*/

declare( strict_types = 1 );

namespace WPGraphQL\GF\Extensions\GFChainedSelects\Data\FieldValueInput;

use WPGraphQL\GF\Data\FieldValueInput\CheckboxValuesInput;
Expand Down
Loading

0 comments on commit 36e6e2a

Please sign in to comment.