New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.4 - Prevent autoloading targets of static analysis #24

merged 7 commits into from Sep 4, 2018


None yet
4 participants

johmanx10 commented Sep 3, 2018

This pull request fixes #21

Using native Reflection, the target symbols are loaded in using the autoloader, thus contaminating the current code base. When the target for static analysis conflicts with the code base of DependencyGuard, this results in fatal errors.

The commits in this pull request use BetterReflection instead, which can apply static analysis of symbols, without having to load in the code.

The DependencyGuard command no longer registers the autoloader for vendor directories, as that will cause targets for analysis to be loaded in the active code base.

johmanx10 and others added some commits Aug 31, 2018

Use static symbol analysis
By using BetterReflection, the code symbols are not loaded in order to
determine information about them.

This prevents fatal errors when a code base is analysed that otherwise
conflicts with the code used by DependencyGuard.
Supply event dispatcher within Composer commands
The Composer package has changed slightly since the last time the
Composer command was tested and now requires an event dispatcher to be
provided during any Composer command.
Simplify documented return types
Since the return types were originally documented in the data provider
docblocks, the static analysis that verifies them has become more strict
and correctly determines that some types cannot be asserted.

Since the return types of data providers are of no practical use and are
written more out of vanity than to support their users, the return types
can be simplifies to satisfy static analysis.
Merge pull request #23 from Idrinth/issue/21
Regression test for issue #21
Reduce responsibilities of regression test
The regression test is no longer concerned with running processes or
cleaning up filesystem entries recursively.

A reference to the issue is added to the docblock of the regression

Assumptions about the presence of `php`, `composer` and `composer.phar`
have been solved by using the `PHP_BINARY` constant and by chaining
calls to the `which` UNIX command.
Do not autoload targets for static analysis
While using BetterReflection, there is no need to autoload vendor
directories. Autoloading will actually break the static analysis when
the code base conflicts with the internal code base of DependencyGuard.

@johmanx10 johmanx10 added the bug label Sep 3, 2018

@johmanx10 johmanx10 self-assigned this Sep 3, 2018

@johmanx10 johmanx10 requested review from ksangers and sjokki Sep 3, 2018


This comment has been minimized.

Show comment
Hide comment

Idrinth Sep 3, 2018


I can confirm the fatal no longer occurs.


Idrinth commented Sep 3, 2018

I can confirm the fatal no longer occurs.


sjokki approved these changes Sep 4, 2018

@sjokki sjokki merged commit 6a99bd2 into master Sep 4, 2018

1 check passed

Scrutinizer Analysis: No new issues – Tests: passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment