Add WC Subscriptions stubs

This commit is contained in:
Alex P 2022-03-23 10:17:58 +02:00
parent 65a29eacd2
commit ade7107227
3 changed files with 1581 additions and 57 deletions

1579
.psalm/wcs.php Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.20.0@f82a70e7edfc6cf2705e9374c8a0b6a974a779ed">
<files psalm-version="4.22.0@fc2c6ab4d5fa5d644d8617089f012f3bb84b8703">
<file src="modules/ppcp-api-client/services.php">
<UndefinedConstant occurrences="2">
<code>PAYPAL_API_URL</code>
@ -206,25 +206,12 @@
<RedundantCast occurrences="1">
<code>(float) $item_total</code>
</RedundantCast>
<RedundantCastGivenDocblockType occurrences="6">
<code>(float) $cart-&gt;get_discount_total()</code>
<code>(float) $cart-&gt;get_shipping_total()</code>
<code>(float) $cart-&gt;get_total( 'numeric' )</code>
<code>(float) $order-&gt;get_total()</code>
<code>(float) $order-&gt;get_total_discount( false )</code>
<code>(float) $order-&gt;get_total_discount( false )</code>
</RedundantCastGivenDocblockType>
</file>
<file src="modules/ppcp-api-client/src/Factory/ItemFactory.php">
<ArgumentTypeCoercion occurrences="1"/>
<PossiblyInvalidArgument occurrences="1">
<code>$fees_from_session</code>
</PossiblyInvalidArgument>
<RedundantCastGivenDocblockType occurrences="3">
<code>(float) $order-&gt;get_item_subtotal( $item, false )</code>
<code>(float) $order-&gt;get_item_subtotal( $item, true )</code>
<code>(int) $item-&gt;get_quantity()</code>
</RedundantCastGivenDocblockType>
</file>
<file src="modules/ppcp-api-client/src/Factory/PayerFactory.php">
<PossiblyNullArgument occurrences="2">
@ -261,18 +248,11 @@
<MissingReturnType occurrences="1">
<code>delete</code>
</MissingReturnType>
<RedundantCastGivenDocblockType occurrences="1">
<code>(bool) set_transient( $this-&gt;prefix . $key, $value )</code>
</RedundantCastGivenDocblockType>
</file>
<file src="modules/ppcp-api-client/src/Repository/ApplicationContextRepository.php">
<PossiblyFalseArgument occurrences="1">
<code>strrpos( $locale, '-' )</code>
</PossiblyFalseArgument>
<RedundantCastGivenDocblockType occurrences="2">
<code>(string) home_url( \WC_AJAX::get_endpoint( ReturnUrlEndpoint::ENDPOINT ) )</code>
<code>(string) wc_get_checkout_url()</code>
</RedundantCastGivenDocblockType>
</file>
<file src="modules/ppcp-api-client/src/Repository/PayPalRequestIdRepository.php">
<UndefinedConstant occurrences="1">
@ -289,9 +269,6 @@
</UndefinedConstant>
</file>
<file src="modules/ppcp-button/src/Assets/SmartButton.php">
<InvalidScalarArgument occurrences="1">
<code>1</code>
</InvalidScalarArgument>
<MissingClosureParamType occurrences="1">
<code>$id</code>
</MissingClosureParamType>
@ -419,13 +396,6 @@
<PossiblyUndefinedMethod occurrences="1">
<code>get_payment_method</code>
</PossiblyUndefinedMethod>
<UndefinedFunction occurrences="5">
<code>wcs_get_subscription( absint( $_GET['subscription_id'] ) )</code>
<code>wcs_get_subscription( absint( get_query_var( 'order-pay' ) ) )</code>
<code>wcs_get_subscription( absint( get_query_var( 'view-subscription' ) ) )</code>
<code>wcs_is_view_subscription_page()</code>
<code>wcs_order_contains_renewal( $order )</code>
</UndefinedFunction>
</file>
<file src="modules/ppcp-onboarding/services.php">
<MissingClosureParamType occurrences="1">
@ -447,13 +417,6 @@
<code>PAYPAL_SANDBOX_API_URL</code>
</UndefinedConstant>
</file>
<file src="modules/ppcp-onboarding/src/Assets/OnboardingAssets.php">
<InvalidScalarArgument occurrences="3">
<code>1</code>
<code>1</code>
<code>1</code>
</InvalidScalarArgument>
</file>
<file src="modules/ppcp-onboarding/src/OnboardingModule.php">
<MissingClosureParamType occurrences="3">
<code>$config</code>
@ -517,11 +480,6 @@
<code>getKey</code>
</MissingReturnType>
</file>
<file src="modules/ppcp-subscription/src/Helper/SubscriptionHelper.php">
<UndefinedClass occurrences="1">
<code>\WC_Subscriptions_Admin</code>
</UndefinedClass>
</file>
<file src="modules/ppcp-subscription/src/RenewalHandler.php">
<FalsableReturnStatement occurrences="1">
<code>current( $tokens )</code>
@ -530,10 +488,6 @@
<code>process_order</code>
<code>renew</code>
</MissingReturnType>
<RedundantCastGivenDocblockType occurrences="2">
<code>(int) $customer-&gt;get_id()</code>
<code>(int) $wc_order-&gt;get_customer_id()</code>
</RedundantCastGivenDocblockType>
<TooManyArguments occurrences="1">
<code>apply_filters( 'woocommerce_paypal_payments_subscriptions_get_token_for_customer', null, $customer, $wc_order )</code>
</TooManyArguments>
@ -556,9 +510,6 @@
<PossiblyNullReference occurrences="1">
<code>get</code>
</PossiblyNullReference>
<UndefinedClass occurrences="1">
<code>\WC_Subscription</code>
</UndefinedClass>
</file>
<file src="modules/ppcp-vaulting/services.php">
<PossiblyFalseArgument occurrences="1">
@ -688,9 +639,6 @@
</PossiblyUndefinedVariable>
</file>
<file src="modules/ppcp-wc-gateway/src/Processor/AuthorizedPaymentsProcessor.php">
<MissingReturnType occurrences="1">
<code>capture_authorizations</code>
</MissingReturnType>
<PossiblyNullReference occurrences="1">
<code>authorizations</code>
</PossiblyNullReference>
@ -902,9 +850,6 @@
<code>$request['resource']['custom_id']</code>
<code>$request['resource']['id']</code>
</PossiblyNullArrayAccess>
<RedundantCastGivenDocblockType occurrences="1">
<code>(bool) $wc_order-&gt;update_status( 'cancelled' )</code>
</RedundantCastGivenDocblockType>
</file>
<file src="modules/ppcp-webhooks/src/IncomingWebhookEndpoint.php">
<InvalidReturnStatement occurrences="2">
@ -919,7 +864,6 @@
<PossiblyNullArgument occurrences="1">
<code>$request['event_type']</code>
</PossiblyNullArgument>
<RedundantCastGivenDocblockType occurrences="1"/>
</file>
<file src="src/services.php">
<PossiblyFalseArgument occurrences="1">

View file

@ -29,6 +29,7 @@
<stubs>
<file name=".psalm/stubs.php"/>
<file name=".psalm/wcs.php"/>
<file name="vendor/php-stubs/wordpress-stubs/wordpress-stubs.php"/>
<file name="vendor/php-stubs/woocommerce-stubs/woocommerce-stubs.php"/>
</stubs>