You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ran phpcbf --colors -p src/ tests/ on my CakePHP 5 project:
Fatal error: Uncaught PHP_CodeSniffer\Exceptions\RuntimeException: Undefined property: PHPStan\PhpDocParser\Ast\PhpDoc\TypelessParamTagValueNode::$type in /srv/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Commenting/TypeHintSniff.php on line 104 in /srv/app/vendor/squizlabs/php_codesniffer/src/Runner.php:623
Stack trace:
#0 /srv/app/vendor/cakephp/cakephp-codesniffer/CakePHP/Sniffs/Commenting/TypeHintSniff.php(104): PHP_CodeSniffer\Runner->handleErrors(2, 'Undefined prope...', '/srv/app/vendor...', 104)
#1 /srv/app/vendor/squizlabs/php_codesniffer/src/Files/File.php(519): CakePHP\Sniffs\Commenting\TypeHintSniff->process(Object(PHP_CodeSniffer\Files\LocalFile), 103)
#2 /srv/app/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php(92): PHP_CodeSniffer\Files\File->process()
#3 /srv/app/vendor/squizlabs/php_codesniffer/src/Fixer.php(175): PHP_CodeSniffer\Files\LocalFile->process()
#4 /srv/app/vendor/squizlabs/php_codesniffer/src/Reports/Cbf.php(52): PHP_CodeSniffer\Fixer->fixFile()
#5 /srv/app/vendor/squizlabs/php_codesniffer/src/Reporter.php(285): PHP_CodeSniffer\Reports\Cbf->generateFileReport(Array, Object(PHP_CodeSniffer\Files\LocalFile), false, 190)
#6 /srv/app/vendor/squizlabs/php_codesniffer/src/Runner.php(706): PHP_CodeSniffer\Reporter->cacheFileReport(Object(PHP_CodeSniffer\Files\LocalFile))
#7 /srv/app/vendor/squizlabs/php_codesniffer/src/Runner.php(453): PHP_CodeSniffer\Runner->processFile(Object(PHP_CodeSniffer\Files\LocalFile))
#8 /srv/app/vendor/squizlabs/php_codesniffer/src/Runner.php(215): PHP_CodeSniffer\Runner->run()
#9 /srv/app/vendor/squizlabs/php_codesniffer/bin/phpcbf(14): PHP_CodeSniffer\Runner->runPHPCBF()
#10 /srv/app/vendor/bin/phpcbf(119): include('/srv/app/vendor...')
#11 {main}
thrown in /srv/app/vendor/squizlabs/php_codesniffer/src/Runner.php on line 623
After running in verbose mode I identified it was having issues with this class:
<?phpdeclare(strict_types=1);
namespaceApp\Model\Behavior;
useApp\Exception\InvalidSearchValueException;
useApp\Model\Filter\FilterValidationInterface;
useArrayObject;
useCake\Event\EventInterface;
useCake\ORM\Behavior;
useCake\ORM\Query;
/** * Runs validations of friendsofcake/search when this behavior is applied on the Table class. */classFilterRequestValidatorBehaviorextendsBehavior
{
/** * Runs validations on FilterCollections implementing FilterValidationInterface * * @param EventInterface $event * @param Query $query * @param ArrayObject $options * @param $primary * @return void */publicfunctionbeforeFind(EventInterface$event, Query$query, ArrayObject$options, $primary): void
{
$searchParams = $options['search'] ?? null;
if (!$this->table()->hasBehavior('Search') || !is_array($searchParams)) {
return;
}
/** @var \Search\Model\Behavior\SearchBehavior $searchBehavior */$searchBehavior = $this->table()->getBehavior('Search');
$filterCollection = $searchBehavior->searchManager()->getFilters();
if (!$filterCollection instanceof FilterValidationInterface) {
return;
}
$result = $filterCollection->getValidator()->validate($searchParams);
if (!empty($result)) {
$field = key($result);
$error = reset($result);
$type = key($error);
$msg = $error[$type];
thrownewInvalidSearchValueException("Search parameter value for `$field` is invalid. $msg");
}
}
}
Removing the comments above beforeFind seems to have resolved?
Versions:
/srv/app $ composer show -i | grep sniffYou are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.cakephp/cakephp-codesniffer 5.1.1 CakePHP CodeSniffer Standardsdealerdirect/phpcodesniffer-composer-installer v1.0.0 PHP_CodeSniffer Standards Composer Installer Pluginslevomat/coding-standard 8.15.0 Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.squizlabs/php_codesniffer 3.9.1 PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.
The text was updated successfully, but these errors were encountered:
Ran
phpcbf --colors -p src/ tests/
on my CakePHP 5 project:After running in verbose mode I identified it was having issues with this class:
Removing the comments above beforeFind seems to have resolved?
Versions:
The text was updated successfully, but these errors were encountered: