Skip to content

Commit

Permalink
Merge pull request #387 from Yoast/feature/various-minor-tweaks
Browse files Browse the repository at this point in the history
CS/QA: various minor tweaks
  • Loading branch information
jrfnl authored Nov 10, 2024
2 parents a65412f + 473a17d commit 07720b4
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Yoast/Sniffs/Commenting/CoversTagSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function process( File $phpcsFile, $stackPtr ) {
continue;
}

if ( ! isset( $first ) ) {
if ( $first === null ) {
$first = \explode( '-', $ptrs );
$data = [ $tokens[ $first[0] ]['line'] ];
continue;
Expand Down
4 changes: 2 additions & 2 deletions Yoast/Sniffs/Commenting/TestsHaveCoversTagSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function register() {
* @param File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token in the stack passed in $tokens.
*
* @return void|int Optionally returns a stack pointer. This sniff will not be
* @return int|void Optionally returns a stack pointer. This sniff will not be
* called again on the current file until the returned stack
* pointer is reached.
*/
Expand All @@ -57,7 +57,7 @@ public function process( File $phpcsFile, $stackPtr ) {
* @param File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token in the stack passed in $tokens.
*
* @return void|int If covers annotations were found (or this is not a test class),
* @return int|void If covers annotations were found (or this is not a test class),
* will return the stack pointer to the end of the class.
*/
private function process_class( File $phpcsFile, $stackPtr ) {
Expand Down
2 changes: 1 addition & 1 deletion Yoast/Sniffs/Files/FileNameSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function process( File $phpcsFile, $stackPtr ) {

$oo_name = ObjectDeclarations::getName( $phpcsFile, $oo_structure );

if ( ! empty( $oo_name ) ) {
if ( \is_string( $oo_name ) && $oo_name !== '' ) {

if ( $this->is_in_psr4_path( $phpcsFile, $file ) ) {
$error = 'Directory marked as a PSR-4 path. File names should 100%% match the name of the OO structure contained in the file for PSR-4 compliance.';
Expand Down
2 changes: 1 addition & 1 deletion Yoast/Sniffs/Files/TestDoublesSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function register() {
* @param File $phpcsFile The file being scanned.
* @param int $stackPtr The position of the current token in the stack passed in $tokens.
*
* @return void|int Void or $stackPtr to the end of the file if no basepath was set
* @return int|void Void or $stackPtr to the end of the file if no basepath was set
* or no valid doubles_path(s) were found.
*/
public function process( File $phpcsFile, $stackPtr ) {
Expand Down
1 change: 1 addition & 0 deletions Yoast/Sniffs/NamingConventions/ValidHookNameSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ public function process_parameters( $stackPtr, $group_name, $matched_content, $p
* @param string $regex The punctuation regular expression to use.
* @param string $transform_type Whether to do a partial or complete transform.
* Valid values are: 'full', 'case', 'punctuation'.
*
* @return string
*/
protected function transform( $text_string, $regex, $transform_type = 'full' ) {
Expand Down
10 changes: 5 additions & 5 deletions Yoast/Sniffs/Yoast/JsonEncodeAlternativeSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ final class JsonEncodeAlternativeSniff extends AbstractFunctionRestrictionsSniff
*
* @since 3.0.0
*
* @var array<string, string|string[]> Function names as the keys and the name of the first declared parameter
* as the value.
* There can be multiple parameter names if the parameter
* was renamed over time.
* @var array<string, string|array<string>> Function names as the keys and the name of the first declared parameter
* as the value.
* There can be multiple parameter names if the parameter
* was renamed over time.
*/
private const PARAM_INFO = [
'json_encode' => 'value',
Expand All @@ -47,7 +47,7 @@ final class JsonEncodeAlternativeSniff extends AbstractFunctionRestrictionsSniff
/**
* Groups of functions to restrict.
*
* @return array<string, array<string, string[]>>
* @return array<string, array<string, array<string>>>
*/
public function getGroups() {
return [
Expand Down
2 changes: 1 addition & 1 deletion phpunit-bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
for that PHPCS install.
';

die( 1 );
exit( 1 );
}

/*
Expand Down

0 comments on commit 07720b4

Please sign in to comment.