We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | /** |
||
| 6 | * (c) Kitodo. Key to digital objects e.V. <[email protected]> |
||
| 7 | * |
||
| 8 | * This file is part of the Kitodo and TYPO3 projects. |
||
| 9 | * |
||
| 10 | * @license GNU General Public License version 3 or later. |
||
| 11 | * For the full copyright and license information, please read the |
||
| 12 | * LICENSE.txt file that was distributed with this source code. |
||
| 13 | */ |
||
| 14 | |||
| 15 | namespace Kitodo\Dlf\Validation; |
||
| 16 | |||
| 17 | use InvalidArgumentException; |
||
| 18 | use Psr\Log\LoggerAwareTrait; |
||
| 19 | use TYPO3\CMS\Core\Log\LogManager; |
||
| 20 | use TYPO3\CMS\Core\Utility\GeneralUtility; |
||
| 21 | use TYPO3\CMS\Extbase\Error\Result; |
||
| 22 | use TYPO3\CMS\Extbase\Validation\Validator\AbstractValidator; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Base Validator provides functionalities for using the derived validator within a validation stack. |
||
| 26 | * |
||
| 27 | * @package TYPO3 |
||
| 28 | * @subpackage dlf |
||
| 29 | * |
||
| 30 | * @access public |
||
| 31 | */ |
||
| 32 | abstract class AbstractDlfValidator extends AbstractValidator |
||
| 33 | { |
||
| 34 | use LoggerAwareTrait; |
||
| 35 | |||
| 36 | protected string $valueClassName; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param $valueClassName string The class name of the value |
||
| 40 | */ |
||
| 41 | public function __construct(string $valueClassName) |
||
| 42 | { |
||
| 43 | $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class); |
||
| 44 | $this->valueClassName = $valueClassName; |
||
| 45 | } |
||
| 46 | |||
| 47 | public function validate($value): Result |
||
| 48 | { |
||
| 49 | if (!$value instanceof $this->valueClassName) { |
||
| 50 | $this->logger->debug('Value must be an instance of ' . $this->valueClassName . '.'); |
||
|
0 ignored issues
–
show
|
|||
| 51 | throw new InvalidArgumentException('Type of value is not valid.', 1723126505626); |
||
| 52 | } |
||
| 53 | return parent::validate($value); |
||
| 54 | } |
||
| 55 | } |
||
| 56 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.