Skip to content

Commit

Permalink
Merge pull request #32 from spryker-sdk/bugfix/cc-30526-fix-dependenc…
Browse files Browse the repository at this point in the history
…y-issue

CC-30526 Add missing dependency to roave/better-reflection library.
  • Loading branch information
spryker-release-bot authored Dec 13, 2023
2 parents 867437d + 066eee0 commit 88d12a0
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
*.mo binary
*.pdf binary
*.xsd binary
*.ts binary
*.exe binary

# Remove files for archives generated using `git archive`
architecture-baseline.json export-ignore
dependency.json export-ignore
phpstan.json export-ignore
phpstan.neon export-ignore
psalm-report.json export-ignore linguist-generated=true
tooling.yml export-ignore
.coveralls.yml export-ignore
.travis.yml export-ignore
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Minimum PHP Version](http://img.shields.io/badge/php-%3E%3D%207.4-8892BF.svg)](https://php.net/)
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan)

Tool to detect extended core modules and to update composer.json constraints from using `^` (caret) to using `~` (tilde) for those extended modules.
Tool to detect extended core modules and to update composer.json constraints from using `^` (caret) to using `~` (tilde) for those extended modules.

### What will be found by this tool

Expand All @@ -29,20 +29,20 @@ Add the console command `SprykerSdk\Zed\ComposerConstrainer\Communication\Consol

[Spryker Documentation](https://docs.spryker.com/)

Spryker OS is modular and follows SemVer. Every BC-breaking change of module API (https://documentation.spryker.com/api/definition-api.htm) is considered as a major release.
But what happens to non-API? Spryker leverages the ability to change non-API functionality in minor and patch releases.
Spryker OS is modular and follows SemVer. Every BC-breaking change of module API (https://docs.spryker.com/docs/scos/dev/architecture/module-api/module-api.html) is considered as a major release.
But what happens to non-API? Spryker leverages the ability to change non-API functionality in minor and patch releases.
This way Spryker provides new features for different business verticals.

What does it mean for my customized modules?

When you customized Spryker modules (changed module behavior on project level) even minor changes could potentially cause migration efforts.
To avoid such cases and keep project updates safe and predictable a project should use `~` (tilde) composer constraint instead of `^` for modules with changed behavior.
When you customized Spryker modules (changed module behavior on project level) even minor changes could potentially cause migration efforts.
To avoid such cases and keep project updates safe and predictable a project should use `~` (tilde) composer constraint instead of `^` for modules with changed behavior.
And to simplify the process Spryker provides a development command `vendor/bin/console code:constraint:modules`, which will suggest required changes in composer.json.
It can also auto-adjust your composer.json.
It can also auto-adjust your composer.json.

## Usage

### Dry-run the command
### Dry-run the command

```
vendor/bin/console code:constraint:modules -d
Expand All @@ -61,5 +61,5 @@ This is the recommended hook for your CI system.
vendor/bin/console code:constraint:modules
```

This command will change the project's `composer.json`.
This command will change the project's `composer.json`.
Please dry-run the command before you apply any changes.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"license": "proprietary",
"require": {
"php": ">=7.4",
"roave/better-reflection": "^5.0.0 || ^6.0.0",
"spryker/kernel": "^3.33.0",
"spryker/laminas": "^1.0.0",
"spryker/symfony": "^3.2.2",
Expand Down
3 changes: 2 additions & 1 deletion dependency.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"include": {
"spryker/transfer": "Required for get*OrFail()."
"spryker/transfer": "Required for get*OrFail().",
"roave/better-reflection": "Provides reflection wrapper used for code analysis."
},
"exclude": {
"spryker/testify": "Only needed for require-dev."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
use Closure;
use Generated\Shared\Transfer\UsedModuleCollectionTransfer;
use Generated\Shared\Transfer\UsedModuleTransfer;
use PHPStan\BetterReflection\BetterReflection;
use PHPStan\BetterReflection\Reflector\ClassReflector;
use PHPStan\BetterReflection\SourceLocator\Type\SingleFileSourceLocator;
use Roave\BetterReflection\BetterReflection;
use Roave\BetterReflection\Reflector\DefaultReflector;
use Roave\BetterReflection\SourceLocator\Type\SingleFileSourceLocator;
use ReflectionClass;
use SprykerSdk\Zed\ComposerConstrainer\Business\Finder\FinderInterface;
use SprykerSdk\Zed\ComposerConstrainer\ComposerConstrainerConfig;
Expand Down Expand Up @@ -119,8 +119,8 @@ protected function addExtendedModules(UsedModuleCollectionTransfer $usedModuleCo
protected function getExtendedClassesInFile(SplFileInfo $splFileInfo): array
{
$astLocator = (new BetterReflection())->astLocator();
$reflector = new ClassReflector(new SingleFileSourceLocator($splFileInfo->getPathname(), $astLocator));
$classes = $reflector->getAllClasses();
$reflector = new DefaultReflector(new SingleFileSourceLocator($splFileInfo->getPathname(), $astLocator));
$classes = $reflector->reflectAllClasses();
$extendedClasses = [];

foreach ($classes as $class) {
Expand Down

0 comments on commit 88d12a0

Please sign in to comment.