Releases: mediact/dependency-guard
1.1.2: Merge pull request #43 from Axent96/Axent96-composer-2
Fix ext-json for PHP 7.4
Merge pull request #39 from Axent96/forPullRequest fix ext-json for php 7.4
1.1.0 - Package requirements resolver
When DependencyGuard is expecting resolved dependents, it is expecting package links of the "require" type. Leveraging Composer to determine the dependents will result in a list with all types of package link, which causes DependencyGuard to make assumptions using a wrong dependency graph.
This problem is solved by adding a new violation filter based on package requirements as defined in the Composer Locker.
The package requirements filter will determine the package dependents based on the installed non-dev packages inside the locker and use the dependents to determine what package caused the violation of another package violation.
Resolving the locker and filtering violations based on the resulting graph have been split up in separate classes, to keep proper separation of concerns.
As a direct result, the functional test, verifying what packages are and are not dependent on a given package, has become easier to implement.
Solve infinite loop when resolving dependents
Merge pull request #34 from mediact/issue/33-proposal-fix 1.0.8 Issue/33 proposal fix
Solve issues with Windows directory separators
Tests failed because the paths on Windows were not escaped. This has been solved by using a forward slash in all paths. Thanks to @Idrinth for providing the fix.
Support older version of BetterReflection
Version 3 of BetterReflection requires PHP parser 4, which in turn is
also required by PHPStan. PHPStan has a dependency on Symfony Console,
which supports 3 | 4 in more recent versions, and goes back to 2 in
older versions, which in turn force PHP parser 3 and thus becomes
incompatible with the newer version of BetterReflection.
With the new changes, Magento 2 projects and modules can be statically
analyzed by DependencyGuard.
Fix out of memory error
When a ReflectionClass from BetterReflection was requested statically,
it created a new instance of BetterReflection under the hood. This
instance of BetterReflection created a new PHP parser under the hood,
every time. So, every time a PHP symbol was reflected upon, the whole
parser was instantiated, which was really memory consuming.
In the case of issue #25, this resulted in an out of memory error,
requesting over 1GB of memory to run Dependency Guard.
By preventing zealous object instantiation, the memory consumption is
now below a set threshold of 25MB of memory for the package that was
affected in issue #25.
Thanks to @willemstuursma for reporting the bug.
Prevent autoloading targets of static analysis
Using native Reflection, the target symbols were 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 resulted in fatal errors.
This release is built to 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.
Thanks to @Idrinth for reporting this issue, helping determine the cause and supplying a regression test to prevent this issue from returning.
Fix fread call when file size is zero
When the file size is zero, the call to SplFileObject::fread fails,
because it only accepts a size greater than zero.
This has been fixed by testing the size and optionally falling back to
an empty string.
The unit test has been expanded to prevent regression.
Thanks to @chekalskiy for reporting the bug
Thanks to @willemstuursma for offering an alternate fix
Improve symbol extraction performance
The performance of extraction of symbols from files has been improved. This is done by choosing a more efficient way to read the contents of files. Previously, file content was imploded to a string, by transforming an SplFileObject
to an array, which slowed down during traversal of the iterator. This is switched out with a singular synchronous read on the file.
In some places, array_reduce
is replaced by a foreach
, to allow early breaks without additional function call overhead.
Thanks to @willemstuursma