googleworkspace / php-samples

PHP samples for Google Workspace APIs
Apache License 2.0
289 stars 349 forks source link

Throughout PHP samples incorrect argmentes array([]) #141

Closed ssu-carlsoni closed 1 year ago

ssu-carlsoni commented 1 year ago

While working to get up and running with Google API's in PHP I've been constantly having to correct sample code's incorrect array arguments to class construction and function calls. Looks like maybe an automated tools damaged all the sample PHP trying to updated from array() to []. The problem is too numerous to point out all examples.

Example in repo:

https://github.com/googleworkspace/php-samples/blob/4c121d9c2635da8f90830316311f497a51855444/drive/snippets/drive_v3/src/DriveShareFile.php#L37

Example wrong code block:

                $userPermission = new Drive\Permission(array([
                    'type' => 'user',
                    'role' => 'writer',
                    'emailAddress' => 'user@example.com'
                ]));

Example corrected code block:

                $userPermission = new Drive\Permission([
                    'type' => 'user',
                    'role' => 'writer',
                    'emailAddress' => 'user@example.com'
                ]);
sqrrrl commented 1 year ago

Updated samples to remove the double arrays