-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add Psalm #74
base: master
Are you sure you want to change the base?
Add Psalm #74
Changes from all commits
98f5df6
ad5e2e8
f760225
a96da69
6d05f1f
591e488
d125d1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,7 @@ php: | |
- '7.4' | ||
install: | ||
- composer install | ||
jobs: | ||
include: | ||
- name: Psalm | ||
script: vendor/bin/psalm |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<files psalm-version="4.6.2@bca09d74adc704c4eaee36a3c3e9d379e290fc3b"> | ||
<file src="src/AutoMapper.php"> | ||
<TooManyArguments occurrences="1"> | ||
<code>mapToObject</code> | ||
</TooManyArguments> | ||
</file> | ||
<file src="src/MappingOperation/Implementations/MapTo.php"> | ||
<TooManyArguments occurrences="2"> | ||
<code>map</code> | ||
<code>mapMultiple</code> | ||
</TooManyArguments> | ||
</file> | ||
<file src="src/PropertyAccessor/ArrayPropertyReader.php"> | ||
<LessSpecificImplementedReturnType occurrences="1"> | ||
<code>array</code> | ||
</LessSpecificImplementedReturnType> | ||
<MoreSpecificImplementedParamType occurrences="1"> | ||
<code>$array</code> | ||
</MoreSpecificImplementedParamType> | ||
<ParamNameMismatch occurrences="2"> | ||
<code>$array</code> | ||
<code>$array</code> | ||
</ParamNameMismatch> | ||
</file> | ||
</files> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0"?> | ||
<psalm | ||
errorLevel="4" | ||
resolveFromConfigFile="true" | ||
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="psalm-baseline.xml" | ||
> | ||
<projectFiles> | ||
<directory name="src" /> | ||
<ignoreFiles> | ||
<directory name="vendor" /> | ||
</ignoreFiles> | ||
</projectFiles> | ||
</psalm> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,17 +15,20 @@ interface MapperInterface | |
* Maps an object to an instance of class $to, provided a mapping is | ||
* configured. | ||
* | ||
* @template T of object | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These templates are the main improvements for the end user. |
||
* @param array|object $source | ||
* The source object. | ||
* @param string $targetClass | ||
* The target classname. | ||
* @psalm-param class-string<T> $targetClass | ||
* @param array $context | ||
* An arbitrary array of values that will be passed to supporting | ||
* mapping operations (e.g. MapFrom) to alter their behaviour based on | ||
* the context. | ||
* This is not explicitly required on the interface yet to preserve | ||
* backwards compatibility, but will be added in version 2.0. | ||
* @return mixed | ||
* @psalm-return T | ||
* An instance of class $to. | ||
* @throws UnregisteredMappingException | ||
*/ | ||
|
@@ -34,13 +37,16 @@ public function map($source, string $targetClass/**, array $context = [] */); | |
/** | ||
* Maps properties of object $from to an existing object $to. | ||
* | ||
* @template T of object | ||
* @param array|object $source | ||
* The source object. | ||
* @param object $destination | ||
* The target object. | ||
* @psalm-param T $destination | ||
* @param array $context | ||
* See MapperInterface::map() | ||
* @return mixed | ||
* @psalm-return T | ||
* $to, with properties copied from $from. | ||
* @throws UnregisteredMappingException | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,14 +10,14 @@ | |
interface PropertyReaderInterface | ||
{ | ||
/** | ||
* @param $object | ||
* @param object|array $object | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was added to be more correct, but the |
||
* @param string $propertyName | ||
* @return bool | ||
*/ | ||
public function hasProperty($object, string $propertyName): bool; | ||
|
||
/** | ||
* @param $object | ||
* @param object|array $object | ||
* @param string $propertyName | ||
* @return mixed | ||
*/ | ||
|
@@ -26,7 +26,7 @@ public function getProperty($object, string $propertyName); | |
/** | ||
* Returns a list of property names available on the object. | ||
* | ||
* @param object $object | ||
* @param object|array $object | ||
* @return string[] | ||
*/ | ||
public function getPropertyNames($object): array; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those renames are probably due to PHP 8 named arguments.