Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[PhpUnitBridge] Lint files with PHP 5.5 #39421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 14, 2020
Merged
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
28 changes: 28 additions & 0 deletions .github/workflows/phpunit-bridge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PhpUnitBridge

on:
push:
paths:
- 'src/Symfony/Bridge/PhpUnit/**'
pull_request:
paths:
- 'src/Symfony/Bridge/PhpUnit/**'

jobs:

lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
coverage: "none"
php-version: "5.5"

- name: Lint
run: find ./src/Symfony/Bridge/PhpUnit -name '*.php' | grep -v -e /Tests/ -e ForV6 -e ForV7 -e ForV8 -e ForV9 -e ConstraintLogicTrait | parallel -j 4 php -l {}
12 changes: 9 additions & 3 deletions src/Symfony/Bridge/PhpUnit/ClassExistsMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,23 @@ public static function withMockedClasses(array $classes)

public static function class_exists($name, $autoload = true)
{
return (bool) (self::$classes[ltrim($name, '\\')] ?? \class_exists($name, $autoload));
$name = ltrim($name, '\\');

return isset(self::$classes[$name]) ? (bool) self::$classes[$name] : \class_exists($name, $autoload);
}

public static function interface_exists($name, $autoload = true)
{
return (bool) (self::$classes[ltrim($name, '\\')] ?? \interface_exists($name, $autoload));
$name = ltrim($name, '\\');

return isset(self::$classes[$name]) ? (bool) self::$classes[$name] : \interface_exists($name, $autoload);
}

public static function trait_exists($name, $autoload = true)
{
return (bool) (self::$classes[ltrim($name, '\\')] ?? \trait_exists($name, $autoload));
$name = ltrim($name, '\\');

return isset(self::$classes[$name]) ? (bool) self::$classes[$name] : \trait_exists($name, $autoload);
}

public static function register($class)
Expand Down