Skip to content

Commit

Permalink
Merge pull request #20 from ray-di/from-dir
Browse files Browse the repository at this point in the history
Fix Queries::fromDir() class discovery problems
  • Loading branch information
koriym committed Nov 13, 2021
2 parents 6317704 + 404e647 commit aa2fd92
Show file tree
Hide file tree
Showing 14 changed files with 445 additions and 221 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Expand Up @@ -136,4 +136,4 @@ jobs:
composer require --dev maglnet/composer-require-checker ^3.0
- name: Run composer-require-checker
run: ./vendor/bin/composer-require-checker
run: ./vendor/bin/composer-require-checker --config-file=./php-require-checker.config.json
225 changes: 225 additions & 0 deletions baseline.xml
@@ -0,0 +1,225 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.12.0@e42bc4a23f67acba28a23bb09c348e2ff38a1d87">
<file src="vendor/roave/better-reflection/src/Reflection/ReflectionAttribute.php">
<ParseError occurrences="16">
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>=&gt;</code>
<code>=&gt;</code>
<code>=&gt;</code>
<code>=&gt;</code>
<code>=&gt;</code>
<code>=&gt;</code>
<code>=&gt;</code>
<code>public</code>
<code>}</code>
</ParseError>
</file>
<file src="vendor/roave/better-reflection/src/Reflection/ReflectionClass.php">
<ParseError occurrences="106">
<code>$ancestor</code>
<code>$classConstant</code>
<code>$classConstant</code>
<code>$classConstant</code>
<code>$constant</code>
<code>$importedTrait</code>
<code>$interface</code>
<code>$interface</code>
<code>$interfaceName</code>
<code>$interfaceName</code>
<code>$interfaceName</code>
<code>$interfaceName</code>
<code>$method</code>
<code>$method</code>
<code>$method</code>
<code>$method</code>
<code>$methodNode</code>
<code>$name</code>
<code>$node</code>
<code>$node</code>
<code>$parentClass</code>
<code>$property</code>
<code>$property</code>
<code>$property</code>
<code>$property</code>
<code>$property</code>
<code>$property</code>
<code>$propertyProperty</code>
<code>$reflectionClass</code>
<code>$reflectionClass</code>
<code>$stmt</code>
<code>$trait</code>
<code>$traitUse</code>
<code>)</code>
<code>)</code>
<code>)</code>
<code>)</code>
<code>)</code>
<code>)</code>
<code>)</code>
<code>)</code>
<code>)</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>?</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
<code>fn</code>
</ParseError>
</file>
<file src="vendor/roave/better-reflection/src/Reflection/ReflectionEnum.php">
<ParseError occurrences="8">
<code>$node</code>
<code>$node</code>
<code>$stmt</code>
<code>)</code>
<code>,</code>
<code>,</code>
<code>fn</code>
<code>fn</code>
</ParseError>
</file>
<file src="vendor/roave/better-reflection/src/Reflection/ReflectionFunction.php">
<ParseError occurrences="2">
<code>=&gt;</code>
<code>fn</code>
</ParseError>
</file>
<file src="vendor/roave/better-reflection/src/Reflection/ReflectionFunctionAbstract.php">
<ParseError occurrences="5">
<code>$p</code>
<code>,</code>
<code>...</code>
<code>fn</code>
<code>fn</code>
</ParseError>
</file>
<file src="vendor/roave/better-reflection/src/Reflection/ReflectionIntersectionType.php">
<ParseError occurrences="11">
<code>$type</code>
<code>$type</code>
<code>)</code>
<code>)</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>:</code>
<code>=&gt;</code>
<code>fn</code>
<code>fn</code>
</ParseError>
</file>
<file src="vendor/roave/better-reflection/src/Reflection/ReflectionMethod.php">
<ParseError occurrences="7">
<code>$implementingClassName</code>
<code>$methodName</code>
<code>)</code>
<code>,</code>
<code>,</code>
<code>=&gt;</code>
<code>=&gt;</code>
</ParseError>
</file>
<file src="vendor/roave/better-reflection/src/Reflection/ReflectionProperty.php">
<ParseError occurrences="4">
<code>$implementingClassName</code>
<code>$instance</code>
<code>,</code>
<code>,</code>
</ParseError>
</file>
<file src="vendor/roave/better-reflection/src/Reflection/ReflectionUnionType.php">
<ParseError occurrences="11">
<code>$type</code>
<code>$type</code>
<code>)</code>
<code>)</code>
<code>,</code>
<code>,</code>
<code>,</code>
<code>:</code>
<code>=&gt;</code>
<code>fn</code>
<code>fn</code>
</ParseError>
</file>
<file src="vendor/roave/better-reflection/src/SourceLocator/Type/AggregateSourceLocator.php">
<ParseError occurrences="6">
<code>$sourceLocator</code>
<code>)</code>
<code>,</code>
<code>...</code>
<code>fn</code>
<code>fn</code>
</ParseError>
</file>
<file src="vendor/roave/better-reflection/src/SourceLocator/Type/AutoloadSourceLocator.php">
<ParseError occurrences="2">
<code>:</code>
<code>fn</code>
</ParseError>
</file>
</files>
7 changes: 4 additions & 3 deletions composer.json
Expand Up @@ -18,7 +18,8 @@
"pagerfanta/pagerfanta": "^1.1",
"ray/aop": "^2.10.4",
"ray/aura-sql-module": "^1.10",
"ray/di": "^2.12"
"ray/di": "^2.12",
"roave/better-reflection": "^4.0 || 5.0.x-dev"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4",
Expand Down Expand Up @@ -50,8 +51,8 @@
"./vendor/bin/psalm --clear-cache"
],
"sa": [
"./vendor/bin/phpstan analyse -c phpstan.neon",
"psalm --show-info=true"
"psalm --show-info=true",
"./vendor/bin/phpstan analyse -c phpstan.neon"
],
"tests": [
"@cs",
Expand Down
8 changes: 8 additions & 0 deletions php-require-checker.config.json
@@ -0,0 +1,8 @@
{
"symbol-whitelist": [
"null", "true", "false",
"static", "self", "parent",
"array", "string", "int", "float", "bool", "iterable", "callable", "void", "object",
"Attribute", "ReflectionAttribute", "Roave\\BetterReflection\\Reflector\\DefaultReflector"
]
}
55 changes: 33 additions & 22 deletions phpcs.xml
@@ -1,15 +1,14 @@
<?xml version="1.0"?>
<ruleset
name=""
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Ray.Aop coding standard"
xsi:noNamespaceSchemaLocation="./vendor-bin/tools/vendor/squizlabs/php_codesniffer/phpcs.xsd">

<arg name="basepath" value="."/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="80"/>
<arg name="cache" value=".phpcs-cache"/>

<!-- Compatibility with PHP 7.2.0 -->
<!-- Compatibility with PHP 7.3.0 -->
<config name="php_version" value="70300"/>

<!-- Ignore warnings, show progress of the run and show sniff names -->
Expand All @@ -18,42 +17,35 @@
<!-- Directories to be checked -->
<file>src</file>
<file>tests</file>
<exclude-pattern>*/tmp/*</exclude-pattern>
<exclude-pattern>*/tests/Fake/*</exclude-pattern>
<exclude-pattern>*/tests/tmp/*</exclude-pattern>

<!-- PSR12 Coding Standard -->
<rule ref="PSR12"/>

<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" value="true"/>
</properties>
</rule>


<!-- Doctrine Coding Standard -->
<rule ref="Doctrine">

<!-- Exclude Rules -->
<!-- Inapplicable for this project -->
<!-- Base -->
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSame"/>
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming.SuperfluousSuffix"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousTraitNaming.SuperfluousSuffix"/>
<exclude name="SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.MissingVariable"/>
<exclude name="SlevomatCodingStandard.Commenting.UselessInheritDocComment.UselessInheritDocComment"/>
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint"/>
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint"/>
<exclude name="SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed"/>
<exclude name="Squiz.WhiteSpace.FunctionSpacing.Before"/>
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint"/>
<exclude name="SlevomatCodingStandard.PHP.RequireExplicitAssertion.RequiredExplicitAssertion"/>
<exclude name="PSR12.Files.FileHeader.IncorrectOrder"/>
<exclude name="PSR12.Files.FileHeader.SpacingAfterBlock"/>
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint"/>
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.UselessAnnotation"/>
<exclude name="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants.DisallowedLateStaticBindingForConstant"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousTraitNaming.SuperfluousSuffix"/>
<!-- /Base -->
<!-- Option -->
<exclude name="SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed"/>
<!-- /Option -->
<!-- Exclude Fake files form Doctrine CS -->
</rule>


<!-- Additional Rules -->
<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
<properties>
Expand All @@ -64,11 +56,30 @@
</property>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Commenting.DocCommentSpacing">
<properties>
<property name="annotationsGroups" type="array">
<element value="@param, @psalm-param, @phpstan-param"/>
<element value="@return, @psalm-return, @phpstan-return"/>
<element value="@throws"/>
</property>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint">
<include-pattern>tests/*</include-pattern>
</rule>
<rule ref="SlevomatCodingStandard.Classes.PropertySpacing">
<properties>
<property name="minLinesCountBeforeWithComment" value="1"/>
<property name="maxLinesCountBeforeWithComment" value="1"/>
<property name="maxLinesCountBeforeWithoutComment" value="0"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" value="true"/>
</properties>
</rule>
<exclude-pattern>*/Fake/*</exclude-pattern>
<exclude-pattern>*/tmp/*</exclude-pattern>
</ruleset>
1 change: 1 addition & 0 deletions phpstan.neon
Expand Up @@ -5,4 +5,5 @@ parameters:
- tests
excludePaths:
- tests/Fake/*
- tests/tmp/*
- src/MediaQueryModule.php
2 changes: 1 addition & 1 deletion psalm.xml
Expand Up @@ -5,12 +5,12 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="baseline.xml"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
<directory name="tests" />
</ignoreFiles>
</projectFiles>
</psalm>

0 comments on commit aa2fd92

Please sign in to comment.