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

Use strict_types where appropriate #12631

Merged
merged 13 commits into from
Nov 14, 2022
2 changes: 2 additions & 0 deletions includes/AMP/Canonical_Sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\AMP;

use DOMElement;
Expand Down
2 changes: 2 additions & 0 deletions includes/AMP/Integration/AMP_Story_Sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\AMP\Integration;

use AMP_Base_Sanitizer;
Expand Down
2 changes: 2 additions & 0 deletions includes/AMP/Meta_Sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\AMP;

use Google\Web_Stories_Dependencies\AMP_Meta_Sanitizer;
Expand Down
2 changes: 2 additions & 0 deletions includes/AMP/Optimization.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\AMP;

use Google\Web_Stories_Dependencies\AmpProject\AmpWP\RemoteRequest\CachedRemoteGetRequest;
Expand Down
2 changes: 2 additions & 0 deletions includes/AMP/Output_Buffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\AMP;

use Google\Web_Stories\Context;
Expand Down
2 changes: 2 additions & 0 deletions includes/AMP/Sanitization.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\AMP;

use DOMElement;
Expand Down
2 changes: 2 additions & 0 deletions includes/AMP/Story_Sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\AMP;

use Google\Web_Stories\AMP\Traits\Sanitization_Utils;
Expand Down
2 changes: 2 additions & 0 deletions includes/AMP/Traits/Sanitization_Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\AMP\Traits;

use AmpProject\Dom\Document as AMP_Document;
Expand Down
2 changes: 2 additions & 0 deletions includes/AMP_Story_Player_Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories;

use Google\Web_Stories\Infrastructure\Registerable;
Expand Down
2 changes: 2 additions & 0 deletions includes/AdSense.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories;

use Google\Web_Stories\Infrastructure\HasRequirements;
Expand Down
2 changes: 2 additions & 0 deletions includes/Ad_Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories;

use Google\Web_Stories\Infrastructure\HasRequirements;
Expand Down
2 changes: 2 additions & 0 deletions includes/Admin/Activation_Notice.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Admin;

use Google\Web_Stories\Assets;
Expand Down
8 changes: 5 additions & 3 deletions includes/Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Admin;

use Google\Web_Stories\Context;
Expand Down Expand Up @@ -240,7 +242,7 @@ public function prefill_post_title( $title ) {
// Otherwise it runs through wptexturize() and the like, which we want to avoid.
return $post->post_title;
}

/**
* Adds active publisher logo to media state output.
*
Expand All @@ -251,8 +253,8 @@ public function prefill_post_title( $title ) {
* @return string[] updated media states.
*/
public function media_states( $media_states, $post ): array {
$active_publisher_logo_id = absint( $this->settings->get_setting( $this->settings::SETTING_NAME_ACTIVE_PUBLISHER_LOGO ) );
$active_publisher_logo_id = absint( $this->settings->get_setting( $this->settings::SETTING_NAME_ACTIVE_PUBLISHER_LOGO ) );

if ( $post->ID === $active_publisher_logo_id ) {
$media_states[] = __( 'Web Stories Publisher Logo', 'web-stories' );
}
Expand Down
2 changes: 2 additions & 0 deletions includes/Admin/Cross_Origin_Isolation.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Admin;

use Google\Web_Stories\Context;
Expand Down
2 changes: 2 additions & 0 deletions includes/Admin/Customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Admin;

use Google\Web_Stories\Infrastructure\Conditional;
Expand Down
2 changes: 2 additions & 0 deletions includes/Admin/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Admin;

use Google\Web_Stories\Assets;
Expand Down
2 changes: 2 additions & 0 deletions includes/Admin/Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Admin;

use Google\Web_Stories\Assets;
Expand Down
2 changes: 2 additions & 0 deletions includes/Admin/Google_Fonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Admin;

use Google\Web_Stories\Infrastructure\Conditional;
Expand Down
2 changes: 2 additions & 0 deletions includes/Admin/ImgAreaSelect_Patch.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Admin;

use Google\Web_Stories\Assets;
Expand Down
2 changes: 2 additions & 0 deletions includes/Admin/Meta_Boxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Admin;

use Google\Web_Stories\Service_Base;
Expand Down
2 changes: 2 additions & 0 deletions includes/Admin/PluginActionLinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Admin;

use Google\Web_Stories\Service_Base;
Expand Down
2 changes: 2 additions & 0 deletions includes/Admin/PluginRowMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Admin;

use Google\Web_Stories\Service_Base;
Expand Down
2 changes: 2 additions & 0 deletions includes/Admin/Site_Health.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Admin;

use Google\Web_Stories\Experiments;
Expand Down
2 changes: 2 additions & 0 deletions includes/Admin/TinyMCE.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Admin;

use Google\Web_Stories\Assets;
Expand Down
2 changes: 2 additions & 0 deletions includes/Analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories;

/**
Expand Down
2 changes: 2 additions & 0 deletions includes/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories;

/**
Expand Down
2 changes: 2 additions & 0 deletions includes/Block/Web_Stories_Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Block;

use Google\Web_Stories\AMP_Story_Player_Assets;
Expand Down
2 changes: 2 additions & 0 deletions includes/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories;

/**
Expand Down
2 changes: 2 additions & 0 deletions includes/Database_Upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories;

use Google\Web_Stories\Infrastructure\Injector;
Expand Down
2 changes: 2 additions & 0 deletions includes/Decoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories;

/**
Expand Down
2 changes: 2 additions & 0 deletions includes/Demo_Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories;

/**
Expand Down
2 changes: 2 additions & 0 deletions includes/Discovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories;

use Google\Web_Stories\Infrastructure\HasRequirements;
Expand Down
2 changes: 2 additions & 0 deletions includes/Embed_Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories;

use Google\Web_Stories\Model\Story;
Expand Down
2 changes: 2 additions & 0 deletions includes/Exception/FailedToMakeInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Exception;

use Google\Web_Stories\Infrastructure\Injector\InjectionChain;
Expand Down
2 changes: 2 additions & 0 deletions includes/Exception/InvalidEventProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Exception;

use InvalidArgumentException;
Expand Down
2 changes: 2 additions & 0 deletions includes/Exception/InvalidService.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Exception;

use InvalidArgumentException;
Expand Down
2 changes: 2 additions & 0 deletions includes/Exception/SanitizationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Exception;

use RuntimeException;
Expand Down
2 changes: 2 additions & 0 deletions includes/Exception/WebStoriesException.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories\Exception;

/**
Expand Down
2 changes: 2 additions & 0 deletions includes/Experiments.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories;

use Google\Web_Stories\Infrastructure\HasRequirements;
Expand Down
2 changes: 2 additions & 0 deletions includes/Font_Post_Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* limitations under the License.
*/

declare(strict_types=1);

namespace Google\Web_Stories;

use Google\Web_Stories\Infrastructure\HasRequirements;
Expand Down
2 changes: 2 additions & 0 deletions includes/Infrastructure/Conditional.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
*/

declare(strict_types=1);

namespace Google\Web_Stories\Infrastructure;

/**
Expand Down
2 changes: 2 additions & 0 deletions includes/Infrastructure/Delayed.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
*/

declare(strict_types=1);

namespace Google\Web_Stories\Infrastructure;

/**
Expand Down
Loading