sascha-egerer / phpstan-typo3

TYPO3 CMS class reflection extension for PHPStan & framework-specific rules
MIT License
42 stars 22 forks source link

using phpstan/phpstan-shim to lower the risk of conflicting dependencies #8

Closed kszymukowicz closed 5 years ago

kszymukowicz commented 5 years ago

hi did you considered to put phpstan/phpstan-shim into dependencies instead of phpstan/phpstan ?

kszymukowicz commented 5 years ago

Or do you maybe know a way that I can use in my composer.json to replace use of phpstan/phpstan with phpstan/phpstan-shim.

ondrejmirtes commented 5 years ago

Hi, phpstan/phpstan-shim should be fully compatible with any extension package like this. You can install phpstan/phpstan-shim alongside extensions that require phpstan/phpstan.

On Sat, 11 May 2019 at 12:54, Krystian Szymukowicz notifications@github.com wrote:

Or do you maybe know a way that I can use in my composer.json to replace use of phpstan/phpstan with phpstan/phpstan-shim.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sascha-egerer/phpstan-typo3/issues/8#issuecomment-491500977, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAZTOBFL7RN7JTG7GHFV3LPU2QVZANCNFSM4HMH3A2Q .

--

Ondřej Mirtes

ondrejmirtes commented 5 years ago

Some issues might pop up if the extension relies on something that’s prefixed in the PHAR (it shouldn’t), but dependencies inside Composer are definitely not the issue.

On Sat, 11 May 2019 at 13:49, Ondřej Mirtes ondrej@mirtes.cz wrote:

Hi, phpstan/phpstan-shim should be fully compatible with any extension package like this. You can install phpstan/phpstan-shim alongside extensions that require phpstan/phpstan.

On Sat, 11 May 2019 at 12:54, Krystian Szymukowicz < notifications@github.com> wrote:

Or do you maybe know a way that I can use in my composer.json to replace use of phpstan/phpstan with phpstan/phpstan-shim.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sascha-egerer/phpstan-typo3/issues/8#issuecomment-491500977, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAZTOBFL7RN7JTG7GHFV3LPU2QVZANCNFSM4HMH3A2Q .

--

Ondřej Mirtes

--

Ondřej Mirtes

kszymukowicz commented 5 years ago

@ondrejmirtes Sure I can install also "phpstan/phpstan-shim" in my composer.json but if I also require "sascha-egerer/phpstan-typo3" which requires "phpstan/phpstan" then all packages from "phpstan/phpstan" will be also installed and this is what I would like to avoid. I want to have only "phpstan/phpstan-shim" without "phpstan/phpstan".

ondrejmirtes commented 5 years ago

It’s not like that. Try it.

On Sat, 11 May 2019 at 14:22, Krystian Szymukowicz notifications@github.com wrote:

@ondrejmirtes https://github.com/ondrejmirtes Sure I can install also "phpstan/phpstan-shim" in my composer.json but if I also require "sascha-egerer/phpstan-typo3" which requires "phpstan/phpstan" then all packages from "phpstan/phpstan" will be also installed and this is what I would like to avoid. I want to have only "phpstan/phpstan-shim" without "phpstan/phpstan".

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/sascha-egerer/phpstan-typo3/issues/8#issuecomment-491506640, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAZTOGRIRF4NQV3NDPS56LPU23CBANCNFSM4HMH3A2Q .

--

Ondřej Mirtes

ondrejmirtes commented 5 years ago

See: (all of the dependencies come from TYPO3, not PHPStan, there's not nette/di etc.):

$ composer require phpstan/phpstan-shim:^0.10 saschaegerer/phpstan-typo3
Using version ^0.10.0 for saschaegerer/phpstan-typo3
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 43 installs, 0 updates, 0 removals
  - Installing typo3/cms-composer-installers (v2.2.2): Downloading (100%)
  - Installing typo3/class-alias-loader (1.0.1): Downloading (100%)
  - Installing typo3fluid/fluid (2.6.1): Downloading (100%)
  - Installing typo3/phar-stream-wrapper (v3.1.1): Downloading (100%)
  - Installing typo3/cms-cli (2.0.0): Downloading (100%)
  - Installing symfony/polyfill-ctype (v1.11.0): Loading from cache
  - Installing symfony/yaml (v4.2.8): Loading from cache
  - Installing symfony/routing (v4.2.8): Loading from cache
  - Installing symfony/polyfill-mbstring (v1.11.0): Loading from cache
  - Installing symfony/polyfill-php72 (v1.11.0): Downloading (100%)
  - Installing symfony/polyfill-intl-idn (v1.11.0): Downloading (100%)
  - Installing symfony/intl (v4.2.8): Downloading (100%)
  - Installing symfony/polyfill-intl-icu (v1.11.0): Downloading (100%)
  - Installing symfony/finder (v4.2.8): Loading from cache
  - Installing symfony/contracts (v1.1.0): Loading from cache
  - Installing symfony/var-exporter (v4.2.8): Downloading (100%)
  - Installing psr/simple-cache (1.0.1): Loading from cache
  - Installing psr/log (1.0.2): Downloading (100%)
  - Installing psr/cache (1.0.1): Downloading (100%)
  - Installing symfony/cache (v4.2.8): Downloading (100%)
  - Installing symfony/expression-language (v4.2.8): Downloading (100%)
  - Installing symfony/console (v4.2.8): Loading from cache
  - Installing swiftmailer/swiftmailer (v5.4.12): Downloading (100%)
  - Installing psr/http-message (1.0.1): Loading from cache
  - Installing psr/http-server-handler (1.0.1): Downloading (100%)
  - Installing psr/http-server-middleware (1.0.1): Downloading (100%)
  - Installing psr/container (1.0.0): Loading from cache
  - Installing phpstan/phpstan-shim (0.10.8): Downloading (100%)
  - Installing guzzlehttp/promises (v1.3.1): Loading from cache
  - Installing ralouphie/getallheaders (2.0.5): Loading from cache
  - Installing guzzlehttp/psr7 (1.5.2): Loading from cache
  - Installing guzzlehttp/guzzle (6.3.3): Loading from cache
  - Installing doctrine/lexer (v1.0.1): Loading from cache
  - Installing doctrine/instantiator (1.2.0): Loading from cache
  - Installing doctrine/event-manager (v1.0.0): Loading from cache
  - Installing doctrine/cache (v1.8.0): Loading from cache
  - Installing doctrine/dbal (v2.8.1): Downloading (100%)
  - Installing doctrine/annotations (v1.6.1): Loading from cache
  - Installing cogpowered/finediff (0.3.1): Downloading (100%)
  - Installing algo26-matthias/idna-convert (v1.1.0): Downloading (100%)
  - Installing typo3/cms-core (v9.5.6): Downloading (100%)
  - Installing typo3/cms-extbase (v9.5.6): Downloading (100%)
  - Installing saschaegerer/phpstan-typo3 (0.10.0): Downloading (100%)
symfony/routing suggests installing symfony/http-foundation (For using a Symfony Request object)
symfony/routing suggests installing symfony/config (For using the all-in-one router or any loader)
symfony/contracts suggests installing symfony/event-dispatcher-implementation
symfony/contracts suggests installing symfony/http-client-contracts-implementation
symfony/contracts suggests installing symfony/service-contracts-implementation
symfony/contracts suggests installing symfony/translation-contracts-implementation
symfony/console suggests installing symfony/event-dispatcher
symfony/console suggests installing symfony/lock
symfony/console suggests installing symfony/process
doctrine/cache suggests installing alcaeus/mongo-php-adapter (Required to use legacy MongoDB driver)
typo3/cms-extbase suggests installing typo3/cms-scheduler (Additional scheduler tasks)
saschaegerer/phpstan-typo3 suggests installing typo3/testing-framework (Testing framework is used in the bootstrap (src/PhpStanTypo3Bootstrap.php). In most cases you need this package but you may also use your custom bootstrap (e.g. if you use nimut/testing-framework))
Writing lock file
Generating autoload files
Generating class alias map file
Inserting class alias loader into main autoload.php file
ondrejmirtes commented 5 years ago

It works thanks to this line: https://github.com/phpstan/phpstan-shim/blob/master/composer.json#L9

kszymukowicz commented 5 years ago

Indeed it works! Nice trick 👍 Thank you very much for explanation.