googleads / google-ads-php

Google Ads API Client Library for PHP
https://developers.google.com/google-ads/api/docs/client-libs/php
Apache License 2.0
280 stars 260 forks source link

ulrichsg - deprecated #1027

Closed Enkirch closed 1 week ago

Enkirch commented 3 months ago

Hello,

I'm currently setting everything up, and I'm getting several deprecated messages from "ulrichsg/getopt-php/src/GetOpt.php".

I am using PHP 8.1. Is there an updated version for the GetOpt.php somewhere ? Or what am I doing wrong ?

Im calling everything like this for testing $trackingsource_gclid = "test124"; $EK_WKDM_Date_Google = "2024-02-01 07:08:00 +00:00"; $marge = 10.00; $instanz = new Google\Ads\GoogleAds\Examples\Remarketing\UploadOfflineConversion(); $instanz->main($trackingsource_gclid, $EK_WKDM_Date_Google, $marge);

And this are the deprecated messages

Return type of GetOpt\GetOpt::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice google_upload/google-ads-php/vendor/ulrichsg/getopt-php/src/GetOpt.php:583

Return type of GetOpt\GetOpt::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice google_upload/google-ads-php/vendor/ulrichsg/getopt-php/src/GetOpt.php:529

Return type of GetOpt\GetOpt::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice google-ads-php/vendor/ulrichsg/getopt-php/src/GetOpt.php:545

Return type of GetOpt\GetOpt::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice google-ads-php/vendor/ulrichsg/getopt-php/src/GetOpt.php:561

Return type of GetOpt\GetOpt::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice wp-content/themes/wkdm/google_upload/google-ads-php/vendor/ulrichsg/getopt-php/src/GetOpt.php:572

Return type of GetOpt\GetOpt::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice google-ads-php/vendor/ulrichsg/getopt-php/src/GetOpt.php:509

fiboknacky commented 3 months ago

It's a warning message, right? If so, you can safely ignore them. It's from the third-party library that this one uses for parsing command-line arguments.

Enkirch commented 3 months ago

[21-May-2024 07:01:21 UTC] PHP Deprecated: Return type of GetOpt\GetOpt::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in D:\xampp-8-1-25\htdocs\abcd\wp-content\themes\abcd\google_upload\google-ads-php\vendor\ulrichsg\getopt-php\src\GetOpt.php on line 583 [21-May-2024 07:01:21 UTC] PHP Deprecated: Return type of GetOpt\GetOpt::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in D:\xampp-8-1-25\htdocs\abcd\wp-content\themes\abcd\google_upload\google-ads-php\vendor\ulrichsg\getopt-php\src\GetOpt.php on line 529

the problem is, it clutters up my error log. (debug.log) I'm using wordpress and php 8.1 here. it's annoying, so you can't debug everything else properly.

fiboknacky commented 3 months ago

If you use WordPress, do you need to use this example as is? When you use it in production, you can just copy the part you want without using this GetOpt library. I guess you just want to try code examples for now, no?

Enkirch commented 3 months ago

No, the example Funktion i already deleted. Im calling it like this for testing

` $trackingsource_gclid = "test124"; $EK_WKDM_Date_Google = "2024-02-01 07:08:00 +00:00"; $marge = 10.00;

$instanz = new Google\Ads\GoogleAds\Examples\Remarketing\UploadOfflineConversion();
$instanz->main($trackingsource_gclid, $EK_WKDM_Date_Google, $marge); `

sorry for the format.

i dont know what the "GetOpt " is for, or if i need this. or how to get rid of it. i just wanted it to work ^^°

fiboknacky commented 3 months ago

As written in Getting Started, our code examples are meant to be run from command prompt. It's not suited for using in a long run and not supposed to be created as a new object like you're doing.

Please copy what you need in runExample() and paste it in your WordPress project. Thanks.