Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions QA_IMPROVEMENTS_SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# PHP Code Quality Improvements Summary

## Task Completed Successfully

### 1. Added ninjify/qa as Development Dependency
- Added `ninjify/qa: *` to the `require-dev` section of `composer.json`
- Successfully installed the package along with its dependencies:
- `php-parallel-lint/php-parallel-lint` (v1.4.0)
- `squizlabs/php_codesniffer` (3.13.2)
- `slevomat/coding-standard` (7.2.1)
- `ninjify/coding-standard` (v0.12.1)
- Other supporting packages

### 2. Linting Analysis Performed
- **PHP Syntax Check**: No syntax errors found in source code
- **Code Standards Check**: Found 8 PSR12 violations across 2 files

### 3. Code Quality Issues Fixed
Applied PSR12 coding standard fixes to both source files:

#### `src/Utils/Arrays.php` (4 fixes):
- Added blank line after opening PHP tag
- Removed blank line after class opening brace
- Added newline at end of file
- Fixed class closing brace placement

#### `src/Utils/Colors.php` (4 fixes):
- Added blank line after opening PHP tag
- Changed `TRUE` to `true` (lowercase boolean)
- Removed blank line at end of control structure
- Added newline at end of file

### 4. Business Logic Verification
- **All tests pass**: 2 tests executed successfully (0.0 seconds)
- **No functionality changes**: Only coding style improvements were made
- **No breaking changes**: Business logic remains completely intact

### 5. Final Quality Check
- **Zero linting errors**: All PSR12 coding standard violations resolved
- **Clean syntax**: No PHP syntax errors
- **Comprehensive coverage**: Used professional quality assurance tools

## Tools Used
- `ninjify/qa` package for comprehensive code quality analysis
- `php-parallel-lint` for syntax checking
- `phpcs` (PHP CodeSniffer) for detecting coding standard violations
- `phpcbf` (PHP Code Beautifier and Fixer) for automatic fixes
- `nette/tester` for running unit tests

## Result
The aprila/utils project now adheres to PSR12 coding standards while maintaining full functionality and test coverage.
10 changes: 8 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@
"php": ">=7.1.0"
},
"require-dev": {
"nette/tester": "~2.3"
"nette/tester": "~2.3",
"ninjify/qa": "*"
},
"autoload": {
"classmap": ["src"]
},
"minimum-stability": "stable"
"minimum-stability": "stable",
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
Binary file added composer.phar
Binary file not shown.
5 changes: 2 additions & 3 deletions src/Utils/Arrays.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @author Honza Cerny (http://honzacerny.com)
*/
Expand All @@ -9,7 +10,6 @@

class Arrays
{

final public function __construct()
{
throw new LogicException("Static class - cannot be instantiated");
Expand Down Expand Up @@ -108,5 +108,4 @@ public static function getPreviousValue(&$array, $curr_val)

return $prev;
}

}
}
6 changes: 3 additions & 3 deletions src/Utils/Colors.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @author Honza Cerny (http://honzacerny.com)
*/
Expand All @@ -15,7 +16,7 @@ class Colors
*
* @return string
*/
public static function rgbToHex($rgb, $withHash = TRUE)
public static function rgbToHex($rgb, $withHash = true)
{
if (is_string($rgb)) {
$rgbString = $rgb;
Expand Down Expand Up @@ -54,9 +55,8 @@ public static function rgbToHex($rgb, $withHash = TRUE)

if ($withHash) {
return strtoupper('#' . sprintf("%02s%02s%02s", $hex[0], $hex[1], $hex[2]));

} else {
return strtoupper(sprintf("%02s%02s%02s", $hex[0], $hex[1], $hex[2]));
}
}
}
}