google-api-php-client icon indicating copy to clipboard operation
google-api-php-client copied to clipboard

Light reformat code

Open WinterSilence opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe.

  1. Old PHP code
  2. src/aliases.php not compatible with PSR
  3. src/Task/Composer.php can't be loaded in production

Describe the solution you'd like

  1. Update outdated code to 5.6+, for example, replace array(...) to [...] by CodeSniffer
  2. Move up & update aliases.php(#2173) and update related files:
  • remove wrong https://github.com/googleapis/google-api-php-client/blob/1530583a711f4414407112c4068464bcbace1c71/composer.json#L40
  • phpcs.xml.dist(remove https://github.com/googleapis/google-api-php-client/blob/1530583a711f4414407112c4068464bcbace1c71/phpcs.xml.dist#L87
  • and etc.
  1. composer.json:
"autoload": {
    "psr-4": {"Google\\": "src/"},
    "files": ["aliases.php"],
    "exclude-from-classmap": ["src/Task/Composer.php"]
},
"autoload-dev": {
    "psr-4": {"Google\\Tests\\": "tests/Google/"},
    "files": ["src/Task/Composer.php", "tests/BaseTest.php"],
    "exclude-from-classmap": ["tests/clearToken.php,", "tests/bootstrap.php"]
},

WinterSilence avatar Dec 07 '21 11:12 WinterSilence

Hi @WinterSilence ! Thanks for filing this issue. I am a little confused about what your ask is (there are quite a few changes being proposed here). Is the request here mostly to ensure that src/Task/Composer.php is excluded from autoloading in production for security reasons? I'm also not sure why the autoload-dev section needs to be there for. We don't need any of those autoloaded, since that happens in bootstrap.php already.

I'm also not sure why we should remove PSR2.Classes.ClassDeclaration.

Maybe you'd be better off submitting a PR and we can review/comment these items individually?

Thanks!

bshaffer avatar Apr 22 '22 20:04 bshaffer