Closed benr77 closed 3 years ago
What are our options here?
Option 1 is an easy fix that requires no effort apart from anyone suffering from the same issue as me. But it's going against the reasoning behind using phpqa in the first place (for me at least). I was forever having issues forgetting to upgrade PHPStan, Rector, ECS etc - they all have quite a fast release velocity and if you don't upgrade you spend quite a bit of time investigating issues they report that are actually no longer issues in the latest release.
Using phpqa gives me a single upgrade point, smaller project composer.jsons, cut'n'paste'able tool configs for new projects etc. With this in mind I'm keen to explore other options.
ondrejmirtes pointed out adding phpstan/phpstan
to your project composer is not too much hassle, but then you also have to add all the extensions you use as well. I also think Rector then starts complaining if running that from inside phpqa as it gets a different PHPStan version than expected (untested assumption here).
Option 5 will not be popular with Laravel developers - but presumably this issue will affect them as well?
Option 4 might be good start - the issues are arising with typed parameters in method signatures vs non-typed params - are there any reasons why they'd object to using slightly newer dependencies? With Symfony dependencies I'm guessing it would be nothing more than tweaking some version constraints in their composer.json.
Option 1 is an easy fix that requires no effort apart from anyone suffering from the same issue as me. But it's going against the reasoning behind using phpqa in the first place (for me at least). I was forever having issues forgetting to upgrade PHPStan, Rector, ECS etc - they all have quite a fast release velocity and if you don't upgrade you spend quite a bit of time investigating issues they report that are actually no longer issues in the latest release.
Just a note, this is a different problem. Automated updates are possible (like with dependabot on github).
Option 4 might be good start - the issues are arising with typed parameters in method signatures vs non-typed params - are there any reasons why they'd object to using slightly newer dependencies? With Symfony dependencies I'm guessing it would be nothing more than tweaking some version constraints in their composer.json.
My worry is, they're a phpstan extension which in my mind should be small, but for some reason it brings loads of dependencies in.
Regarding options 2 or 3 - I must admit, the huge list of available tools is enticing at first - I actually found it a good centralised resource of PHP quality tools - regardless of whether I then used the phpqa package. It made me want to explore a lot of them. However, in day to day use I only, so far, use a handful of them. We were talking about the image size the other day when we added ext-intl
and having a restricted set would be good if you want to use the image in CI etc.
However, I think having an opinionated build (a.k.a. option 7) might be a big ask, as the handful of tools I use may well be totally different to the tools the next person uses.
Perhaps removing the Larastan extension, and pointing out it can easily be added back in as needed as per the README file is a good option. PHPStan extensions are one of the things already documented for adding back in to the image, so removing one of them for causing trouble to others, but allowing it to be added by users that needed, sounds like a good compromise.
Hi @jakzal - did you have any thoughts on this issue? I'm still in favour of removing the extension and adding a note to the readme or release notes that it can be added back in if needed by Laravel users. Thanks.
@danielsuguimoto since you're the one that contributed #200, would you mind jumping into the conversation? What I don't understand is why a phptsan extension would need to fetch so many dependencies.
Sorry, but I guess @nunomaduro is the best guy to explain how PHPStan really works under the hood, since he's the maintainer and creator of the package
@nunomaduro For reference, the error @benr77 reported is:
At the end of every PHPStan analysis I get several errors like this.
Child process error (exit code 255): Warning: Declaration of
Symfony\Component\Translation\DependencyInjection\TranslatorPathsPass::processValue($value, bool $isRoot =
false) should be compatible with
Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass::processValue($value, $isRoot = false) in
/tools/.composer/vendor-bin/phpstan/vendor/symfony/translation/DependencyInjection/TranslatorPathsPass.php on
line 82
Fatal error: Declaration of Symfony\Bridge\Monolog\Processor\DebugProcessor::getLogs() must be compatible with
Symfony\Component\HttpKernel\Log\DebugLoggerInterface::getLogs(?Symfony\Component\HttpFoundation\Request
$request = NULL) in /project/vendor/symfony/monolog-bridge/Processor/DebugProcessor.php on line 64
It is complaining about a method signature mismatch between (I think!) my Symfony installation which is being analysed, and /tools/.composer/vendor-bin/phpstan/vendor/symfony/translation/DependencyInjection/TranslatorPathsPass.php which appears to be a Symfony component as part of the PHPStan installation.
@benr77 can you paste output of your composer show
?
almasaeed2010/adminlte v2.3.11 AdminLTE - admin control panel and dashboard that's based...
alsatian/form-bundle dev-master 4777789 Symfony form types to extend built-in types. Ideal for Se...
aws/aws-sdk-php 3.168.3 AWS SDK for PHP - Use Amazon Web Services in your PHP pro...
backup-manager/backup-manager 1.4.1 A framework agnostic database backup manager with user-de...
backup-manager/symfony 2.3.0 A simple database backup manager for Symfony2 with suppor...
behat/gherkin v4.6.2 Gherkin DSL parser for PHP 5.3
brick/math 0.9.1 Arbitrary-precision arithmetic library
clue/stream-filter v1.5.0 A simple and modern approach to stream filtering in PHP
cocur/slugify v4.0.0 Converts a string into a slug.
codeception/codeception 4.1.12 BDD-style testing framework
codeception/lib-asserts 1.13.2 Assertion methods used by Codeception core and Asserts mo...
codeception/lib-innerbrowser 1.3.4 Parent library for all Codeception framework modules and ...
codeception/module-asserts 1.3.1 Codeception module containing various assertions
codeception/module-cli 1.1.0 Codeception module for testing basic shell commands and s...
codeception/module-db 1.0.2 DB module for Codeception
codeception/module-phpbrowser 1.0.2 Codeception module for testing web application over HTTP
codeception/module-rest 1.2.7 REST module for Codeception
codeception/module-symfony 1.5.0 Codeception module for Symfony framework
codeception/module-webdriver 1.1.4 WebDriver module for Codeception
codeception/phpunit-wrapper 9.0.5 PHPUnit classes used by Codeception
codeception/stub 3.7.0 Flexible Stub wrapper for PHPUnit's Mock Builder
composer/package-versions-deprecated 1.11.99.1 Composer plugin that provides efficient querying for inst...
craue/formflow-bundle 3.3.2 Multi-step forms for your Symfony project.
dg/bypass-finals v1.3.0 Removes final keyword from source code on-the-fly and all...
doctrine/annotations 1.11.1 Docblock Annotations Parser
doctrine/cache 1.10.2 PHP Doctrine Cache library is a popular cache implementat...
doctrine/collections 1.6.7 PHP Doctrine Collections library that adds additional fun...
doctrine/common 2.13.3 PHP Doctrine Common project is a library that provides ad...
doctrine/data-fixtures 1.4.4 Data Fixtures for all Doctrine Object Managers
doctrine/dbal 2.12.1 Powerful PHP database abstraction layer (DBAL) with many ...
doctrine/doctrine-bundle 1.12.13 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle 1.4.0 Symfony Bundle for Doctrine Cache
doctrine/doctrine-fixtures-bundle 3.4.0 Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle 3.0.1 Symfony DoctrineMigrationsBundle
doctrine/event-manager 1.1.1 The Doctrine Event Manager is a simple PHP event system t...
doctrine/inflector 1.4.3 PHP Doctrine Inflector is a small library that can perfor...
doctrine/instantiator 1.4.0 A small, lightweight utility to instantiate objects in PH...
doctrine/lexer 1.2.1 PHP Doctrine Lexer parser library that can be used in Top...
doctrine/migrations 3.0.1 PHP Doctrine Migrations project offer additional function...
doctrine/orm 2.7.5 Object-Relational-Mapper for PHP
doctrine/persistence 1.3.8 The Doctrine Persistence project is a set of shared inter...
doctrine/reflection 1.2.2 The Doctrine Reflection project is a simple library used ...
dzunke/feature-flags-bundle 5.0 Symfony2 Bundle to implement Feature Flags to your Applic...
egulias/email-validator 2.1.24 A library for validating emails against several RFCs
elasticsearch/elasticsearch v7.10.0 PHP Client for Elasticsearch
esendex/sdk v1.3.0 Send SMS from your application using the Esendex API
ezimuel/guzzlestreams 3.0.1 Fork of guzzle/streams (abandoned) to be used with elasti...
ezimuel/ringphp 1.1.2 Fork of guzzle/RingPHP (abandoned) to be used with elasti...
fakerphp/faker v1.13.0 Faker is a PHP library that generates fake data for you.
friendsofsymfony/ckeditor-bundle 2.2.0 Provides a CKEditor integration for your Symfony project.
friendsofsymfony/elastica-bundle v6.0.0-beta3 Elasticsearch PHP integration for your Symfony project us...
friendsofsymfony/jsrouting-bundle 2.7.0 A pretty nice way to expose your Symfony2 routing to clie...
giggsey/libphonenumber-for-php 8.12.14 PHP Port of Google's libphonenumber
giggsey/locale 1.9 Locale functions required by libphonenumber-for-php
guzzlehttp/guzzle 6.5.5 Guzzle is a PHP HTTP client library
guzzlehttp/promises 1.4.0 Guzzle promises library
guzzlehttp/psr7 1.7.0 PSR-7 message implementation that also provides common ut...
imagine/imagine 1.2.4 Image processing for PHP 5.3
jdorn/sql-formatter v1.2.17 a PHP SQL highlighting library
jean85/pretty-package-versions 1.5.1 A wrapper for ocramius/package-versions to get pretty ver...
jmikola/geojson 1.0.2 GeoJSON implementation for PHP
justinrainbow/json-schema 5.2.10 A library to validate a json schema.
kevinpapst/adminlte-bundle 3.2.4 Admin theme bundle for Symfony 4+ based on AdminLTE 2.4 w...
knplabs/knp-menu 2.6.0 An object oriented menu library
knplabs/knp-menu-bundle v2.3.0 This bundle provides an integration of the KnpMenu library
kriswallsmith/buzz 0.17.2 Lightweight HTTP client
laminas/laminas-code 3.5.1 Extensions to the PHP Reflection API, static code scannin...
laminas/laminas-eventmanager 3.3.0 Trigger and listen to events within a PHP application
laminas/laminas-zendframework-bridge 1.1.1 Alias legacy ZF class names to Laminas Project equivalents.
league/flysystem 1.1.3 Filesystem abstraction: Many filesystems, one API.
league/flysystem-aws-s3-v3 1.0.29 Flysystem adapter for the AWS S3 SDK v3.x
league/mime-type-detection 1.5.1 Mime-type detection for Flysystem
liip/imagine-bundle 2.3.1 This bundle provides an image manipulation abstraction to...
lorenzo/pinky 1.0.5 A Foundation for Emails (Inky) template transpiler
misd/phone-number-bundle v1.3.2 Integrates libphonenumber into your Symfony2 application
moneyphp/money v3.3.1 PHP implementation of Fowler's Money pattern
monolog/monolog 1.25.5 Sends your logs to files, sockets, inboxes, databases and...
mtdowling/jmespath.php 2.6.0 Declaratively specify how to extract elements from a JSON...
myclabs/deep-copy 1.10.2 Create deep copies (clones) of your objects
nelmio/cors-bundle 2.1.0 Adds CORS (Cross-Origin Resource Sharing) headers support...
nelmio/js-logger-bundle 1.6.1 Adds logging of JS errors in your Symfony application
nesbot/carbon 2.42.0 An API extension for DateTime that supports 281 different...
nikic/php-parser v4.10.3 A PHP parser written in PHP
nyholm/dsn 1.0.1 Parse your DSN
nyholm/psr7 1.3.2 A fast PHP7 implementation of PSR-7
ocramius/proxy-manager 2.10.0 A library providing utilities to generate, instantiate an...
oneup/flysystem-bundle 3.6.0 Integrates Flysystem filesystem abstraction library to yo...
pagerfanta/pagerfanta v2.5.1 Pagination for PHP
phar-io/manifest 2.0.1 Component for reading phar.io manifest information from a...
phar-io/version 3.0.3 Library for handling version information and constraints
php-http/client-common 1.10.0 Common HTTP Client implementations and tools for HTTPlug
php-http/discovery 1.13.0 Finds installed HTTPlug implementations and PSR-7 message...
php-http/httplug v1.1.0 HTTPlug, the HTTP client abstraction for PHP
php-http/message 1.10.0 HTTP Message related tools
php-http/message-factory v1.0.2 Factory interfaces for PSR-7 HTTP Message
php-http/promise 1.1.0 Promise used for asynchronous HTTP requests
php-webdriver/webdriver 1.9.0 A PHP client for Selenium WebDriver. Previously facebook/...
phpdocumentor/reflection-common 2.2.0 Common reflection classes used by phpdocumentor to reflec...
phpdocumentor/reflection-docblock 5.2.2 With this component, a library can provide support for an...
phpdocumentor/type-resolver 1.4.0 A PSR-5 based resolver of Class names, Types and Structur...
phpspec/prophecy 1.12.1 Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage 9.2.5 Library that provides collection, processing, and renderi...
phpunit/php-file-iterator 3.0.5 FilterIterator implementation that filters files based on...
phpunit/php-invoker 3.1.1 Invoke callables with a timeout
phpunit/php-text-template 2.0.4 Simple template engine.
phpunit/php-timer 5.0.3 Utility class for timing
phpunit/phpunit 9.5.0 The PHP Unit Testing framework.
psr/cache 1.0.1 Common interface for caching libraries
psr/container 1.0.0 Common Container Interface (PHP FIG PSR-11)
psr/http-client 0.1.0 Common interface for HTTP clients
psr/http-factory 1.0.1 Common interfaces for PSR-7 HTTP message factories
psr/http-message 1.0.1 Common interface for HTTP messages
psr/log 1.1.3 Common interface for logging libraries
pugx/sentry-sdk v2.0.0 This is a metapackage shipping sentry/sentry with Symfony...
ralouphie/getallheaders 3.0.3 A polyfill for getallheaders.
ramsey/collection 1.1.1 A PHP 7.2+ library for representing and manipulating coll...
ramsey/uuid 4.1.1 A PHP library for generating and working with universally...
ramsey/uuid-doctrine 1.6.0 Allow the use of ramsey/uuid as a Doctrine field type.
react/promise v2.8.0 A lightweight implementation of CommonJS Promises/A for PHP
ruflin/elastica 7.0.0 Elasticsearch Client
sebastian/cli-parser 1.0.1 Library for parsing CLI options
sebastian/code-unit 1.0.8 Collection of value objects that represent the PHP code u...
sebastian/code-unit-reverse-lookup 2.0.3 Looks up which function or method a line of code belongs to
sebastian/comparator 4.0.6 Provides the functionality to compare PHP values for equa...
sebastian/complexity 2.0.2 Library for calculating the complexity of PHP code units
sebastian/diff 4.0.4 Diff implementation
sebastian/environment 5.1.3 Provides functionality to handle HHVM/PHP environments
sebastian/exporter 4.0.3 Provides the functionality to export PHP variables for vi...
sebastian/global-state 5.0.2 Snapshotting of global state
sebastian/lines-of-code 1.0.3 Library for counting the lines of code in PHP source code
sebastian/object-enumerator 4.0.4 Traverses array structures and object graphs to enumerate...
sebastian/object-reflector 2.0.4 Allows reflection of object attributes, including inherit...
sebastian/recursion-context 4.0.4 Provides functionality to recursively process PHP variables
sebastian/resource-operations 3.0.3 Provides a list of PHP built-in functions that operate on...
sebastian/type 2.3.1 Collection of value objects that represent the types of t...
sebastian/version 3.0.2 Library that helps with managing the version number of Gi...
sensio/framework-extra-bundle v5.6.1 This bundle provides a way to configure your controllers ...
sentry/sentry 3.1.4 A PHP SDK for Sentry (http://sentry.io)
sentry/sentry-symfony 4.0.1 Symfony integration for Sentry (http://getsentry.com)
shapecode/hidden-entity-type-bundle 2.1.0 Hidden field for Symfony2 entities
simshaun/recurr v3.1.1 PHP library for working with recurrence rules
softcreatr/jsonpath 0.7.2 JSONPath implementation for parsing, searching and flatte...
symfony/amqp-pack v1.0.13 A pack for using the AMQP transport with Symfony Messenger
symfony/asset v4.4.19 Manages URL generation and versioning of web assets such ...
symfony/browser-kit v4.4.19 Simulates the behavior of a web browser, allowing you to ...
symfony/cache v4.4.19 Provides an extended PSR-6, PSR-16 (and tags) implementation
symfony/cache-contracts v2.2.0 Generic abstractions related to caching
symfony/config v4.4.19 Helps you find, load, combine, autofill and validate conf...
symfony/console v4.4.19 Eases the creation of beautiful and testable command line...
symfony/css-selector v4.4.19 Converts CSS selectors to XPath expressions
symfony/debug v4.4.19 Provides tools to ease debugging PHP code
symfony/debug-bundle v4.4.19 Provides a tight integration of the Symfony Debug compone...
symfony/debug-pack v1.0.9 A debug pack for Symfony projects
symfony/dependency-injection v4.4.19 Allows you to standardize and centralize the way objects ...
symfony/deprecation-contracts v2.2.0 A generic function and convention to trigger deprecation ...
symfony/doctrine-bridge v4.4.19 Provides integration for Doctrine with various Symfony co...
symfony/dom-crawler v4.4.19 Eases DOM navigation for HTML and XML documents
symfony/dotenv v4.4.19 Registers environment variables from a .env file
symfony/error-handler v4.4.19 Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher v4.4.19 Provides tools that allow your application components to ...
symfony/event-dispatcher-contracts v1.1.9 Generic abstractions related to dispatching event
symfony/expression-language v4.4.19 Provides an engine that can compile and evaluate expressions
symfony/filesystem v4.4.19 Provides basic utilities for the filesystem
symfony/finder v4.4.19 Finds files and directories via an intuitive fluent inter...
symfony/flex v1.12.1 Composer plugin for Symfony
symfony/form v4.4.19 Allows to easily create, process and reuse HTML forms
symfony/framework-bundle v4.4.19 Provides a tight integration between Symfony components a...
symfony/http-client v4.4.19 Provides powerful methods to fetch HTTP resources synchro...
symfony/http-client-contracts v2.3.1 Generic abstractions related to HTTP clients
symfony/http-foundation v4.4.19 Defines an object-oriented layer for the HTTP specification
symfony/http-kernel v4.4.19 Provides a structured process for converting a Request in...
symfony/inflector v4.4.19 Converts words between their singular and plural forms (E...
symfony/intl v4.4.19 Provides a PHP replacement layer for the C intl extension...
symfony/lock v4.4.19 Creates and manages locks, a mechanism to provide exclusi...
symfony/mailer v4.4.19 Helps sending emails
symfony/maker-bundle v1.28.0 Symfony Maker helps you create empty commands, controller...
symfony/messenger v4.4.19 Helps applications send and receive messages to/from othe...
symfony/mime v4.4.19 Allows manipulating MIME messages
symfony/monolog-bridge v4.4.19 Provides integration for Monolog with various Symfony com...
symfony/monolog-bundle v3.6.0 Symfony MonologBundle
symfony/options-resolver v4.4.19 Provides an improved replacement for the array_replace PH...
symfony/orm-pack v1.0.8 A pack for the Doctrine ORM
symfony/phpunit-bridge v5.2.3 Provides utilities for PHPUnit, especially user deprecati...
symfony/polyfill-intl-icu v1.22.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn v1.22.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 ...
symfony/polyfill-intl-normalizer v1.22.0 Symfony polyfill for intl's Normalizer class and related ...
symfony/polyfill-mbstring v1.22.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72 v1.22.0 Symfony polyfill backporting some PHP 7.2+ features to lo...
symfony/polyfill-php73 v1.22.0 Symfony polyfill backporting some PHP 7.3+ features to lo...
symfony/polyfill-php80 v1.22.0 Symfony polyfill backporting some PHP 8.0+ features to lo...
symfony/polyfill-uuid v1.22.0 Symfony polyfill for uuid functions
symfony/process v4.4.19 Executes commands in sub-processes
symfony/profiler-pack v1.0.5 A pack for the Symfony web profiler
symfony/property-access v4.4.19 Provides functions to read and write from/to an object or...
symfony/property-info v4.4.19 Extracts information about PHP class' properties using me...
symfony/psr-http-message-bridge v2.0.2 PSR HTTP message bridge
symfony/routing v4.4.19 Maps an HTTP request to a set of configuration variables
symfony/security-bundle v4.4.19 Provides a tight integration of the Security component in...
symfony/security-core v4.4.19 Symfony Security Component - Core Library
symfony/security-csrf v4.4.19 Symfony Security Component - CSRF Library
symfony/security-guard v4.4.19 Symfony Security Component - Guard
symfony/security-http v4.4.19 Symfony Security Component - HTTP Integration
symfony/serializer v4.4.19 Handles serializing and deserializing data structures, in...
symfony/serializer-pack v1.0.4 A pack for the Symfony serializer
symfony/service-contracts v2.2.0 Generic abstractions related to writing services
symfony/stopwatch v4.4.19 Provides a way to profile code
symfony/templating v4.4.19 Provides all the tools needed to build any kind of templa...
symfony/test-pack v1.0.7 A pack for functional and end-to-end testing within a Sym...
symfony/translation v4.4.19 Provides tools to internationalize your application
symfony/translation-contracts v2.3.0 Generic abstractions related to translation
symfony/twig-bridge v4.4.19 Provides integration for Twig with various Symfony compon...
symfony/twig-bundle v4.4.19 Provides a tight integration of Twig into the Symfony ful...
symfony/validator v4.4.19 Provides tools to validate values
symfony/var-dumper v4.4.19 Provides mechanisms for walking through any arbitrary PHP...
symfony/var-exporter v4.4.19 Allows exporting any serializable PHP data structure to p...
symfony/web-profiler-bundle v4.4.19 Provides a development tool that gives detailed informati...
symfony/webpack-encore-bundle v1.9.0 Integration with your Symfony app & Webpack Encore!
symfony/workflow v4.4.19 Provides tools for managing a workflow or finite state ma...
symfony/yaml v4.4.19 Loads and dumps YAML files
theseer/tokenizer 1.2.0 A small library for converting tokenized PHP source code ...
tijsverkoyen/css-to-inline-styles 2.2.3 CssToInlineStyles is a class that enables you to convert ...
twig/cssinliner-extra v3.1.1 A Twig extension to allow inlining CSS
twig/extensions v1.5.4 Common additional features for Twig that do not directly ...
twig/extra-bundle v3.1.1 A Symfony bundle for extra Twig extensions
twig/inky-extra v3.1.1 A Twig extension for the inky email templating engine
twig/twig v2.14.1 Twig, the flexible, fast, and secure template language fo...
webimpress/safe-writer 2.1.0 Tool to write files safely, to avoid race conditions
webmozart/assert 1.9.1 Assertions to validate method input/output with nice erro...
white-october/pagerfanta-bundle v1.3.2 Bundle to use Pagerfanta with Symfony2
willdurand/js-translation-bundle 3.0.1 A pretty nice way to expose your translation messages to ...
willdurand/jsonp-callback-validator v1.1.0 JSONP callback validator.
Found another solution
Great solution, but doesn't this create more complexity rather than just taking out the Larastan extension and allowing users to add it back in as required? Or are you keen to not remove a package that's already in the Toolbox?
Or are you keen to not remove a package that's already in the Toolbox?
I think a tool should only be removed if it hasn't been maintained for a long time or is fundamentally broken/unsuable.
Ok fair enough. Are you ready to tag a release with this fix? I will test and report back. Thanks
As per the discussion here https://github.com/jakzal/toolbox/issues/338 - having the Larastan PHPStan extension as part of the phpqa package causes PHPStan to report errors that are not part of the codebase being analysed.