Skip to content

Commit

Permalink
Update coding standard
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfelles committed Dec 5, 2023
1 parent 2f9ed21 commit 1a90354
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"require-dev": {
"ext-xdebug": "*",
"aplus/coding-standard": "^1.14",
"aplus/coding-standard": "^2.1",
"ergebnis/composer-normalize": "^2.25",
"jetbrains/phpstorm-attributes": "^1.0",
"phpmd/phpmd": "^2.13",
Expand Down
4 changes: 2 additions & 2 deletions src/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ protected function renderRealName(string $name) : string
protected function renderFilePath(string $path) : string
{
$real = \realpath($path);
if ($real === false || ! \is_file($real)) {
if ($real === false || !\is_file($real)) {
throw new RuntimeException("Path is not a file: {$path}");
}
return $real;
Expand All @@ -460,7 +460,7 @@ protected function renderFilePath(string $path) : string
protected function renderDirectoryPath(string $path) : string
{
$real = \realpath($path);
if ($real === false || ! \is_dir($real)) {
if ($real === false || !\is_dir($real)) {
throw new RuntimeException("Path is not a directory: {$path}");
}
return $real . \DIRECTORY_SEPARATOR;
Expand Down
6 changes: 3 additions & 3 deletions src/Debug/AutoloadCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ protected function getDataByDeclaration(string $declaration) : array | false

protected function renderAutoloader() : string
{
if ( ! isset($this->autoloader)) {
if (!isset($this->autoloader)) {
return '<p>An Autoloader instance has not been set on this collector.</p>';
}
\ob_start(); ?>
Expand Down Expand Up @@ -227,10 +227,10 @@ protected function renderPreload() : string
if ($conf === null) {
return '<p>Preload is not available.</p>';
}
if ($conf && ! empty($conf['directives']['opcache.preload'])) {
if ($conf && !empty($conf['directives']['opcache.preload'])) {
$result = '<p><strong>File:</strong> '
. \htmlentities($conf['directives']['opcache.preload']) . '</p>';
if ( ! empty($conf['directives']['opcache.preload_user'])) {
if (!empty($conf['directives']['opcache.preload_user'])) {
$result .= '<p><strong>User:</strong> '
. \htmlentities($conf['directives']['opcache.preload_user']) . '</p>';
}
Expand Down
6 changes: 3 additions & 3 deletions src/Locator.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(Autoloader $autoloader)
*/
public function getClassName(string $filename) : ?string
{
if ( ! \is_file($filename)) {
if (!\is_file($filename)) {
return null;
}
$tokens = \token_get_all((string) \file_get_contents($filename));
Expand Down Expand Up @@ -110,7 +110,7 @@ public function getNamespacedFilepath(string $file, string $extension = '.php')
$namespace .= $namespace === ''
? \array_shift($segments)
: '\\' . \array_shift($segments);
if ( ! isset($namespaces[$namespace])) {
if (!isset($namespaces[$namespace])) {
continue;
}
foreach ($namespaces[$namespace] as $directory) {
Expand All @@ -130,7 +130,7 @@ public function getNamespacedFilepath(string $file, string $extension = '.php')
#[Pure]
protected function ensureExtension(string $filename, string $extension) : string
{
if ( ! \str_ends_with($filename, $extension)) {
if (!\str_ends_with($filename, $extension)) {
$filename .= $extension;
}
return $filename;
Expand Down
16 changes: 8 additions & 8 deletions src/Preloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function getLocator() : Locator
public function setPackagesDir(string $packagesDir) : static
{
$realpath = \realpath($packagesDir);
if ( ! $realpath || ! \is_dir($packagesDir)) {
if (!$realpath || !\is_dir($packagesDir)) {
throw new InvalidArgumentException('Invalid packages dir: ' . $packagesDir);
}
$this->packagesDir = $realpath . \DIRECTORY_SEPARATOR;
Expand Down Expand Up @@ -110,16 +110,16 @@ public function listPackagesFiles(bool $setClasses = true) : array
{
$result = [];
foreach ($this->getLocator()->listFiles($this->getPackagesDir()) as $file) {
if ( ! \str_ends_with($file, '.php')) {
if (!\str_ends_with($file, '.php')) {
continue;
}
$className = $this->getLocator()->getClassName($file);
if ( ! $className
|| ($className !== 'Aplus' && ! \str_starts_with($className, 'Framework\\'))
if (!$className
|| ($className !== 'Aplus' && !\str_starts_with($className, 'Framework\\'))
) {
continue;
}
if ( ! $this->loadDevPackages && $this->isDevelopmentClass($className)) {
if (!$this->loadDevPackages && $this->isDevelopmentClass($className)) {
continue;
}
if ($setClasses) {
Expand Down Expand Up @@ -152,12 +152,12 @@ public function listFiles(bool $setClasses = true) : array
foreach ($directories as $directory) {
$files = $this->getLocator()->listFiles($directory);
foreach ($files as $file) {
if ( ! \str_ends_with($file, '.php')) {
if (!\str_ends_with($file, '.php')) {
continue;
}
$className = $this->getLocator()->getClassName($file);
if ( ! $className
|| ! \str_starts_with($className, $namespace . '\\')
if (!$className
|| !\str_starts_with($className, $namespace . '\\')
) {
continue;
}
Expand Down

0 comments on commit 1a90354

Please sign in to comment.